MacBookPro osX Ubuntu Dual boot

Hi guys, I tried to install Ubuntu on my MacBookPro early 2011 (MacBookPro8,2) without replacing the original Mac Boot loader. I wasn’t keen to install rEFIt or the fork rEFInd, they both do the job pretty ok but booting up with them adds quiet a lot of steps.

Luckily there are some How-tos around already but I run into some trouble with my MacBookPro manly because of the GPU that is build in and isn’t able to load the drivers without a bios boot. So this post is mostly a reminder for me to not forget the extra steps for working around my GPU problem. There is this guide nosemaj.org and this on glandium.org and they explain very well the steps to enable EFI booting.

disk space for the Linux installation

prepare some empty disk space with diskutil to install the linux later.

rEFInd USB-stick to boot

To not install rEFInd and uninstall it later on the Mac I just used a USB-Stick with for this. You can either download the USB-image from the rEFInd site and dd it to the USB-drive or run the install script

install.sh –usedefault /dev/sdb1 –alldrivers

to install it on /dev/sdb1 assuming sbd is the usb-drive.

install Ubuntu … or another distro of your liking

Boot up from the USB-stick
Holding alt-⎇ after turning on the Mac and selecting the USB-drive to boot from. Now you should be able to select either the install disk or usb-drive whatever you prepared to install your Linux from.
Run the installation on the before prepared space. (create a little disk max. 200MB for the EFI partition)
After that you should be able to boot into Ubuntu with help of rEFInd on the USB-drive.

Boot GRUB from Apple EFI

You will need some tools so install

apt-get install hfsprogs icnsutils

use gdisk to create the EFI disk

gdisk /dev/sda
n for new partition

choose the partition and size
the Hex code is AF00 for a Apple HFS/HFS+ partition

w for write table to disk and exit

then create the HFS+ file system

mkfs.hfsplus /dev/sdaX -v Ubuntu

replace /dev/sdaX with your partition
and add it to /etx/fstab

echo $(blkid -o export -s UUID /dev/sdaX) /boot/efi auto defaults 0 0 >> /etc/fstab

mount the file system

mkdir /boot/efi
mount /boot/efi (with the fstab present this should work without further options)

For some reason you need a file named mach_kernel present to be able to boot.

echo “This file is required for booting” > “/boot/efi/mach_kernel”

After that execute grub-install

sudo grub-install –target x86_64-efi –boot-directory=/boot –efi-directory=/boot/efi –bootloader-id=”$(lsb_release -ds)”

Booting from the boot.efi within /boot/efi/EFI/ubuntu/System/Library/CoreServices/ didn’t work for me.
I copied the boot.efi to

cp /boot/efi/EFI/ubuntu/System/Library/CoreServices/boot.efi /boot/efi/System/Library/CoreServices/boot.efi

and that worked fine.

Now you need to fetch the hfs-bless tool

wget http://www.codon.org.uk/~mjg59/mactel-boot/mactel-boot-0.9.tar.bz2
tar -jxf mactel-boot-0.9.tar.bz2
cd mactel-boot-0.9
make PRODUCTVERSION=UBUNTU

and copy the SystemVersion.plist

cp SystemVersion.plist /boot/efi/System/Library/CoreServices/

Now you can bless the boot.efi

hfs-bless “/boot/efi/System/Library/CoreServices/boot.efi”

Bonus: Logo

You can add a 128 x 128 icns to the boot directory that will show up in die drive list.

png2icns /boot/efi/.VolumeIcon.icns /some/png/file.png

Fixing the GPU issue

All this worked fine so far for me. Only problem I had now after choosing the Ubuntu EFI partition (holding alt-⎇ at boot up) my screen turned black. I could hear the ubuntu startup sound but no image would show.
After some digging around I found this post in the Ubuntu Form.
So the problem is, that the Radeon drivers won’t load in EFI mode. The quick fix is we switch to the Intel GPU.

Boot into Linux (with the rEFInd boot-stick) and edit /etc/default/grub file
Change GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash“ to

„GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash i915.lvds_channel_mode=2 i915.modeset=1 i915.lvds_use_ssc=0“

and add some lines to /etc/grub.d/10_linux BEFORE
echo ” insmod gzio” | sed “s/^/$submenu_indentation/”

echo ” outb 0x728 1″ | sed “s/^/$submenu_indentation/”
echo ” outb 0x710 2″ | sed “s/^/$submenu_indentation/”
echo ” outb 0x740 2″ | sed “s/^/$submenu_indentation/”
echo ” outb 0x750 0″ | sed “s/^/$submenu_indentation/”

echo ” insmod gzio” | sed “s/^/$submenu_indentation/”

After this update grub

sudo update-grub

Now booting Linux in i915 mode works.

ToDO:

Unfortunately I’m now not able to use the ATI GPU so I need to find a way to enable it after the linux startup. And I also need to enable GPU switching after that.

I will update this post after I have found a way (and time to try it)

Leave a Reply

© 2020 IdrilsBlogEntries (RSS)