I have had a very hard time getting Linux to run on a MacBook Pro 8,2 in EFI mode. I finally managed to collect all the snippets of information at various places and was able to set it up properly. This howto works at least for this specific machine:
MacBook Pro 8,2
Intel(R) Core(TM) i7-2675QM CPU @ 2.20GHz
ATI Radeon HD 6750M 8GB Ram
500 GB HDD
1680x1050 non-glare display
Result: I can boot into MacOS (EFI), Ubuntu (EFI) with i915 chipset enabled and radeon disabled, and Ubuntu (EFI) with radeon enabled.
READ THIS FIRST
This Howto is specifically addressing issues that arise when trying to install Ubuntu Linux 13.04 on a MacBook 8,2, however, it has been confirmed as working also for installing Ubuntu Linux 13.10, and for me the system still works after the upgrade to 13.10 (and even better). To determine which revision of MacBook you have, click in OS X on the Apple on the top left, then “About this Mac” -> “More Info” and see the generation in the “Model Identifier” row. The 8,2 revision has proven to be especially stubborn not to allow Linux to be run on it, and the tweaks contained in the installation section may not apply to other revisions.
Preparing the boot medium
You should only attempt this after a fresh install of MacOs. Not doing so may result in undesired effects. After you have completed the fresh install of MacOS, boot with the MacOS Installation CD and start the disk utility app from the menu instead of re-installing MacOS again (who would want to do it twice anyway). Resize the MacOS partition reasonably to make space for the Ubuntu installation. Reboot into MacOS. Get Ubuntu ISO image from here: http://www.ubuntu.com/download/desktop, be sure to select the 64bit version. Convert the .iso file to .img using the convert option of hdiutil in terminal:
Note: OS X tends to put the .dmg ending on the output file automatically, but that doesn't hurt. Plug in an USB thumb drive - beware: the following steps will erase all data on the USB thumb drive, so make sure you don't have anything important on it. Run
hdiutil convert -format UDRW -o /<target directory>/target.img /ubuntu.iso
and determine the device node assigned to your flash media (e.g. /dev/disk2) To unmount the flash drive, run
(replace <N> with the disk number from the last command; in the previous example, <N> would be 2). Execute
diskutil unmountDisk /dev/disk<N>
whereas <N> is the disk number identified above. Run
sudo dd if=/<target directory>/target.img.dmg of=/dev/rdisk<N> bs=1m
Leave the USB stick plugged as we want to boot from it soon.
diskutil eject /dev/disk<N>
Install a proper Boot Manager
Now get rEFInd from here: http://sourceforge.net/projects/refi...2.zip/download If MacOS does not do that automatically, then extract it. Navigate to the extracted folder in Terminal, and issue
If prompted for your password, enter it. Then do
sudo mkdir -p /EFI/refind/drivers
cp /refind/drivers_x64/ext4_x64.efi /EFI/refind/drivers/.
Start the Installation
Reboot your MacBook. The rEFInd boot menu should appear. Select the Ubuntu EFI image for boot. When GRUB has loaded, make sure you highlight „Try out Ubuntu“ boot entry and hit the „e“ key to edit the boot line in order to fix broken graphical output with standard options. Add the following lines after „load_video“:
This will turn off the radeon GPU to avoid conflicting GPUs resulting in no output at all.
outb 0x728 1
outb 0x710 2
outb 0x740 2
outb 0x750 0
It has been reported that "load_video" is non-existant in the current install medium's grub configuration. It should work if you put it after "set gfxpayload=keep" as well.
Furthermore, in the kernel line, add after „quiet splash“:
i915.lvds_channel_mode=2 i915.modeset=1 i915.lvds_use_ssc=0
Double check you typed everything correctly! If you're done, hit F10 to boot. Once Ubuntu has loaded (it will take a short while), select „Install Ubuntu“ from the desktop. Follow the installation instructions. I created a 512 MB boot partition with ext4 starting after 128MB of free space after the MacOS partition (MacOS likes to have 128MB of free space after its partition for no apparent reason), and the rest I used for „/“, also ext4. Assign the mount points („/boot“ for the boot partition, „/“ for the other one). You might want to add another partition for swap, but with 4 GB of RAM you should be alright even without, with 8 GB in any case. Do as you deem reasonable. Do not mount the MacOS partition or the EFI partition. I recommend to encrypt your /home folder.
Setting up Ubuntu to actually work
Once completed, you can reboot. The MacBook will boot directly into GRUB. Now highlight the first line (Ubuntu) again and press „e“. Add the same „outb“ lines and kernel parameters as set forth above to the boot menu entry. After having logged in to gnome, start a terminal. You can also use a virtual console instead of logging in to gnome by pressing CTRL-ALT-F1 of course, as we don't need GUI for now. First of all we'll need to get rid of the boot menu editing, as that can become highly tedious. We do:
Change the line „GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash“ to
sudo nano /etc/default/grub
Uncomment (remove the "#" before) the line "GRUB_TERMINAL=console".
„GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash i915.lvds_channel_mode=2 i915.modeset=1 i915.lvds_use_ssc=0“
Exit with CTRL-X and confirm saving the changes without changing the output name. Then do:
Locate the line
sudo nano /etc/grub.d/10_linux
with CTRL-W (you can use the string „gzio“). Immediately BEFORE this line, enter the following so it looks like this:
echo " insmod gzio" | sed "s/^/$submenu_indentation/"
Thx hyao2 for telling me how to fix no-show of grub menu!
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/"
Again, double check your edits carefully. Save and close this file too with CTRL-X. Now you can do
to make the changes show up in the grub menu. Next we should update the system by doing
After that, reboot the system. When the screen goes black and turns bright again, hit and hold the „ALT“ key to bring up the Apple bootloader. It will show the option „EFI BOOT“. Select it and rEFInd is there again. Boot into MacOS and re-run the rEFInd installation routine again in terminal:
sudo apt-get update
sudo apt-get dist-upgrade
If you now reboot, you will get to the rEFInd menu without having to press „ALT“. Note that you should see at least 6 big boot options in rEFInd (as of June 2013). The first one is Ubuntu loading via GRUB, followed by MacOS. Then there should be at least two (depending on how many kernel upgrades you have made) penguin icons which may not be able to be properly booted. To the right there should be at least two additional Ubuntu Icons. With them, you can load the respective Ubuntu kernel directly via EFI stub. The difference between those and the left Ubuntu icon is, that with the left one we'll get to GRUB which we configured to turn off the ATI GPU. This will allow Ubuntu to make use of the integrated i915 GPU, resulting in 10 to 20 degree less temperature and higher battery life. However, the GRUB menu is no longer shown after re-installing rEFInd, I have yet to discover why the screen goes blank for the duration the GRUB menu is displayed (which I assume it is). If you wait for like 10 seconds without pressing a key, the Ubuntu loading screen appears. Should you need higher GPU performance for whatever reason, you can boot the most current kernel via the appropriate right icon. This will activate the ATI GPU, but will also result in higher temperature. I hope this saves some people the time I had to spend to get this up and running! I have yet to dig into the vgaswitcheroo configuration which I have seen reported to be working under certain circumstances. For now the selecting at boot time already exceeds my expectations and is absolutely sufficient for me.
cd <directory to which refind has been unpacked>/refind/
NOTE: with kernel 3.13 dynamic power management got introduced into the kernel, to make use of this feature and greatly enhance battery runtime under EFIStub, edit the kernel options line from within rEFInd and append
For now, this will have to be done each time you boot via EFIStub, until I have time to figure out how to add that permanently.
Enabling External Monitor via Displayport
So far accessing an external monitor works only when booting with radeon enabled (as the i915 sadly does not have any access to the MacBook’s displayport). Though it didn’t work for me at first, it suddenly started working after I had fiddled around with the drivers for a bit. I’m not sure what actually enabled the displayport, I would get only a black screen before, but after this it worked:
(This was executed in radeon enabled mode) I rebooted into radeon enabled mode, and ended up with a X-error resolving routine that looked like it was part of gnome or lightdm. I exited to the console, deinstalled the proprietary drivers (who would want those anyway) by doing
sudo apt-get install fglrx-amdcccle-updates fglrx-updates
and rebooted again into radeon enabled mode. I started up gnome to check if it was a KDE related thing, plugged the monitor in, and there you go, display is automatically extended to the external display. I logged out, and it worked in KDE too. No idea what made it work, but it works now!
sudo apt-get remove –purge fglrx-amdcccle-updates fglrx-updates
Enabling CD Eject Key in KDE
Right-click on the Kickoff Application Launcher, select "Edit Applications". Navigate to the System group, select "New Item" from the icon bar. You can name the new item "Eject" like I did or whatever you like. A description could be "Eject CD". The command to be run is "eject /dev/sr0". Un-check the "Enable launch feedback" checkbox. Save. Go to the "Advanced" tab, and click on the shortkey button. Hit the Eject CD key on your MacBook Pro's keyboard, it should register as "eject". Save again and exit. It should work now (it does for me at least).
Stuff that works out of the box for me:
Display backlight adjustment
Sound Volume adjustment
Suspend to RAM and Resume (so far no crashes)
iPhone Tethering via Bluetooth and USB works flawlessly too if you install
sudo apt-get install ipheth-utils libimobiledevice-dev libimobiledevice-utils
Since upgrade to 13.10:
SD Card Reader
Keyboard Backlight hotkeys
To be fixed:
Enabling proprietary drivers for AMD GPU in EFI STUB boot mode. So far I seem to use out of the box drivers that don't really provide a benefit over using the i915 chipset performance-wise. Installing the fglrx driver via jockey-kde leads to system crash upon boot (which can be fixed by removing fglrx after booting into grub mode). I didn't have much time to spend on this issue yet, though.
To be tried:
Setting up vgaswitcheroo for dynamic GPU switching.
Edit: After upgrading to 13.10 (replacing all packets with packet maintainer's version and re-applying changes to /etc/grub.d/00_header), keyboard backlight setting via function keys works, too, as does the SD Card Reader.