English / Deutsch Plop Linux  
Twitter
twitter

MacBook Pro


Note: this is a raw text, written quickly. It needs a lot of updates.


This is a short description, how to install Plop Linux and a dual boot with Mac OSX on the MacBook Pro. Default boot is Plop Linux. I describe only what I needed for myself.

Booting Plop Linux from USB works out of the box since Plop Linux 4.3.5. WiFi does not work with the standard release. As the WiFi driver is not open source, you have to add it by yourself. See below how to compile it.

When I have time, I will add screenshots and more. But now, its just to have it documented.


Some eye candy


Plop Linux MacBook Pro

Plop Linux MacBook Pro


Install process


Backup your data!

Connect an USB thumb drive with Plop Linux Live 4.3.5. Also put the desktop tar.gz, the kernel source code, the WiFi driver and the patches onto the USB drive.

WiFi Driver (Debian repository): broadcom-sta_6.30.223.271.orig.tar.xz
WiFi Driver Patches (Arch Linux repository): broadcom-wl-dkms-6.30.223.271-18-x86_64.pkg.tar.xz

Restart the MacBook Pro and keep the "alt" key pressed, to open the boot menu.

Choose the USB drive.

Plop Linux boots....

Start Xfce with "startx".

Start "GParted".

Shrink the Mac OSX partition (sda2). I shrinked it to 100 GB.

Create a new partition, formatted with ext3. This became the Plop Linux partition.

Mount the new partition. I suggest to run the command "automount", which also mounts another file system that is required later.

Go to "/mnt/sda4" and extract the Plop Linux desktop archive from the USB drive to the disk drive as known from the usual desktop installation.

Now there are two options.
Option 1: Use Grub2 as boot manager to start Linux.
Option 2: Create a custom kernel to start Linux.

In the first stage you should use Grub2 as loader and then you can create a custom kernel to boot without Grub2.

Copy from the USB thumb drive the directories "efi" and "syslinux" to "/mnt/sda1/"

Edit the file "/mnt/sda1/efi/grub/grub.cfg" and add the following lines to boot Plop Linux.

menuentry "Plop Linux Desktop" {
        set gfxpayload=keep
        linux   /syslinux/kernel/bzImage root=/dev/sda4
}

Now reboot and keep the "alt" key pressed to open the boot menu.

Choose the hard disk with the name "EFI boot".

Now you should see the Grub2 menu. Choose "Plop Linux Desktop" to boot Plop Linux.

First steps are done. Next is setup the F keys, boot without Grub2, set default boot the Plop Linux, get WiFi working, setup keyboard light.


fn, F1-F12 keys


The multimedia buttons are not working out of the box. Personally, I don't need those keys. I prefer to have the keys F1-F12 without the need to press fn.

To switch the function key behaviour, change the value in the file "/sys/module/hid_apple/parameters/fnmode". Valid values are 0, 1 ,2. To set F1-F12 as default mode, set the value 2. To set this during booting, add the following line to "/etc/rc.local".

echo 2 > /sys/module/hid_apple/parameters/fnmode

Just a note about some missing keys on the keyboard:

DEL: fn backspace
INS: fn enter
POS1: fn cursor left
END: fn cursor right
Page up: fn cursor up
Page down: fn cursor down

See also how-to-swap-the-fn-use-of-function-keys-on-an-apple-keyboard-in-linux


Boot without Grub2


You have to recompile the kernel to boot without Grub or anoter Linux loader.

Grab the kernel file from your USB drive and extract it. Change into the kernel source code directory and get the kernel config file.

zcat /proc/config.gz > .config

Start the configuration program with "make menuconfig". Go to "Processor type and features". Move down to "Built-in kernel command line". Set the value

root=/dev/sda4

Choose "Exit" two times and save the new configuration.

Build the new kernel and modules with "make && make modules_install".

Mount the partition /dev/sda1 and copy the kernel file "arch/x86/boot/bzImage" to the mounted sda1 partition into the directory "/efi/boot".

The file "bootx64.efi" is the grub boot manager. Rename "bzImage" to "bootx64.efi" to overwrite Grub.

We have to add the file information to the EFI boot loader to setup the default boot.

efibootmgr command: efibootmgr -c -d /dev/sda -p 1 -L "Plop Linux" -l "\efi\boot\bootx64.efi"

-c: Create a new entry
-d: Device with the boot file
-p: Partition number
-L: Label
-l: File with the full path. You have to use the backslash here!

The new entry will be automatically the default boot. See below for more efibootmgr commands.


WiFi


If you did not recompile the kernel, then you have to do this now. See 'Boot without Grub2'. Setup the built-in kernel command line and the other things later don't have to be done.

Extract the WiFi Driver broadcom-sta_6.30.223.271.orig.tar.xz and the patches broadcom-wl-dkms-6.30.223.271-18-x86_64.pkg.tar.xz.

Copy the patches from 'broadcom-wl-dkms-6.30.223.271-18-x86_64.pkg.tar.xz/utar://usr/src/broadcom-wl-6.30.223.271/patches' to 'broadcom-sta-6.30.223.271/amd64'.

Execute all patches in 'broadcom-sta-6.30.223.271/amd64'.
for i in *.patch; do patch -p1 < $i; done

Compile and install the driver with "make && make install && depmod -a".

Add the follwing lines to the file '/etc/modprobe.d/blacklist.conf' to avoid driver loading conflicts.

blacklist ssb
blacklist bcma
blacklist b43
blacklist brcmsmac

Create the WiFi configuration with your settings 'wpa_passphrase MYNETSSID MYPASS > /etc/wpa_supplicant.conf'.

Add the follwing lines to the file '/etc/rc.local' before the 'exit' command to autostart WiFi.

ifconfig wlp3s0 up
wpa_supplicant -B -Dwext -i wlp3s0 -c/etc/wpa_supplicant.conf
sleep 2
dhclient wlp3s0

Reboot. WiFi should work now.


Battery


Add the Battery Monitor to the panel in Xfce. It works out of the box.


Display brightness


You can change the display brightness with the script 'bl-brightness'. You find the script in '/usr/share/macbook'. You can copy the file to '/usr/bin' to have it in your path.

Usage: bl-brightness <up|down>


Keyboard light


You can change the keyboard light with my script 'kbd-light'. You find the script in '/usr/share/macbook'. You can copy the file to '/usr/bin' to have it in your path.

kbd-light <percent>

The percent value goes from 0 to 100.


Power on sound


Disabling the awful power on sound (chime) did not work with the nvram command, as descibed in the web.

Finally, I booted Mac OSX and turned off the volume with the F10 key. Then there was silence :)



© 2018 by Elmar Hanlhofer