My company was really kind to get me a Macbook Pro (the 13.3-inch “5.5″ variant). It is an awesome piece of hardware! (especially after my own PoS HP laptop I’ve been cussing at for a while now)
That said, I still don’t like the idea of running a proprietary operating system on it (as beautiful as OS X is ;)), so I continue to happily use Gentoo. The standard amd64 install works just fine with some minor hiccups (keyboard doesn’t work on the LiveCD, kernel only shows a console with vesafb).
The one thing that did bother me is BIOS-emulation. For those coming from the PC world, Macs don’t have a BIOS. They run something called EFI which is significantly more advanced (though I think the jury’s out on quirkiness issues and Linus certainly doesn’t approve of the added complexity).
Anyway, in order to support booting other OSes (=> Windows) exactly as they would on PCs, Apple has added a BIOS emulation layer. This is how Ubuntu (at least as of 9.10) boots on Macbooks. Given that both the bootloader (be it Grub2 or elilo) and the Linux kernel support booting in an EFI environment, it rubbed me the wrong way to take the easy way out and just boot them in BIOS mode. There is a reasonable technical argument for this – I see no good reason to add one more layer of software (read bugs) when there is no need at all. After a lot of pain, I did manage do make Linux boot in EFI-only mode. There is not enough (accurate, easily-findable) documentation out there, so this is hard-won knowledge. :) I’m putting this up to help others avoid this pain.
Here’s what I did (I might be missing some stuff since this was done almost a month ago). The basic boot steps look something like this:
- EFI firmware starts on boot
- Starts rEFIt, a program that extends the default bootloader to provide a nice bootloader menu, shell, etc.
- Scans FAT/HFS partitions (no ext* support, despite some claims on the Internet) for bootable partitions (i.e. having a /efi/… directory with valid boot images)
- Runs the Grub2 EFI image from a FAT partition
- Loads the Linux kernel (and initrd/initramfs if any) from /boot
- Kernel boots normally with whatever your root partition is
Now you could use elilo instead of Grub2, but I found this it to not work well (or at all) for me, so I just used a Grub2 (1.97.1, with some minor modifications) (just adds an “efi” USE-flag to build with --with-platform=efi). While I could make /boot a FAT partition, this would break the installkernel script (it’s run by make install in your kernel source directory), which makes symlinks for your latest/previous kernel image.
Instructions for installing the Grub2 EFI image are here. Just ignore the “bless” instructions (that’s for OS X), and put the EFI image and other stuff in something like /efi/grub (the /efi is mandatory). You can create a basic config file using grub-mkconfig and then tweak it to taste. The Correct Way™ to do this, though, is to edit the files in /etc/grub.d/.
Of course, you need to enable EFI support in the kernel, but that’s it. With this, you’re all set for the (slightly obsessive-compulsive) satisfaction of not having to enable yet another layer to support yet another proprietary interface, neither of which you have visibility or control over.








17 Comments
Nice! Now I just need an EFI emulation layer for my BIOS.
I had a bit of rough time myself: http://debarshiray.wordpress.com/2010/01/15/fedora-11-12-on-an-intel-macbook-getting-it-to-boot/ However although I am now able to boot it without rEFIt it takes a very long time to get to GRUB after the power button is pressed.
Fortunately, I didn’t have too many issues with keeping the GPT and MBR in sync. GParted seems to be doing quite well these days. Only annoying thing was it seemed to be impossible to remove the bios_grub flag from a partition (which hides it from OS X). Seems to be gone with newer versions of parted, though.
Looks like you’re running BIOS emulation? Maybe that’s the reason for the slowness? :)
Try this: http://regebro.wordpress.com/2008/11/16/installing-linux-on-a-macbook-without-os-x/#comment-1075
Nice! elilo is a lost cause – as it appears to not support 64bit EFI 1.x. In the non-mac EFI world (such as it is), there was 32bit EFI 1.x and then 64bit UEFI. Apple decided to do their own thing, as usual :-)
Have you had much luck with the touchpad? Multitouch never worked well enough for me to drop OSX completely
I’m using it quite happily. There’s no multitouch yet (guess it’ll be a while before apps actually start using it). I do sometimes end up touching the pad while typing, which is really annoying. I’ve enabled the disable-touchpad-while-typing thing, which helps a bit.
While I don’t have full EFI (yet?), a few months ago I upgraded all my disks (both direct and running kernel/md RAID, and some of my USB sticks as well) to GPT. I haven’t (yet) switched to grub2, but Gentoo’s grub (0.97-rWhatever) has GPT patches at least for BIOS mode, and that’s what I’m using.
To do the partitioning I used gdisk, at the time using the bugzilla ebuild (#286535), but alexxy added it to the tree (with a bump) on Dec 6, 2009.
Some notes:
I chose gdisk as it seems to have more advanced GPT operations available than parted, it was more directly analogous to fdisk/cfdisk which I had been using and was comfortable with already, and I preferred to use separate filesystem tools anyway. (The description of the parted reiserfs support didn’t leave me very comfortable, that’s what I’m using on both my machines, with ext4 no journal on the thumb drives, and probably btrfs by the end of this year, so the filesystem support wasn’t going to meet my needs anyway.)
FWIW, for those who want it, gdisk offers better hibred GPT/MBR support, too, tho the documents recommend against it, preferring the protective MBR only. The documents also cover the technology a bit better (without getting /too/ techincal) than parted docs do, I suspect, which was nice learning about it, and will certainly come in handy in a disaster recovery situation, should I ever find myself needing that backup partition table…
AFAIK, kernel EFI support is simply GPT support. No big deal using GPT on BIOS once I enabled that.
Two things I like about GPT: It’s very nice having partition labels in the partition table (I put the same label in both the GPT partition entry and the filesystem label, helps keep things straight), and I LOVE not having to worry about primary/logical partitions any more! =:^)
But I still have to upgrade to grub2 one of these days…
Duncan
I had luck with pure EFI booting using sys-boot/mbr-gpt and then grub1, however that precludes dual-booting.
Do look at efibootmgr as well however.
Ah yes, I should have mentioned that it’d be easier to actually get a single-boot system going, but I wanted to keep OS X around to play with. :)
Without the bios emulation, how do the nVidia and noveau drivers work on the MacBook? Any luck?
I haven’t tried the Nouveau drivers (yet), but the NVidia binary drivers work flawlessly.
Hey its fantastic to see others using pure EFI on their Macbook pros. I to have a Macbook pro and I encountered alot of issues with this. The first is that on kernel 2.6.32-rc7 was the first kernel to support my audio drivers. The second was that 2.6.31 somewhere broke EFI booting and caused a system lock on boot. I could not ever isolate or resolve this issue with kernel developers (albeit because my C is not very good). A few other issues I had was the lack of bcm4322 support, though that is changing and also that my model has both a 9600GT and a 9400. Now when booting EFI its all great as you can actually access the 9400, and use it rather than the 9600(which makes your laptop feel like its on fire!), but I could never successfully disable the 9600, only idle it so it kept it cooler (50 degrees C rather than 60 – 70). Even alot of other things like pommed, and lm_sensors all stopped working on an EFI system, so there are a huge number of issues still present. I would love to know what kernel version you are using, what hardware you got supported etc, as it might be a great step forwards in my efforts to get linux compatibility to the Dual gfx card models.
Ah, I have only the 9400M (this being the 13″ model). I’ve had no major kernel issues (running 2.6.32.7).
pommed runs fine-ish for me. The ambient light sensor is not awfully sensitive, but it’s good enough. As for the bcm4322, I’m using the binary STA driver (yes, icky, but it seems to work if you’re not using NetworkManager).
lm_sensors integration is not great, but the Apple SMC driver does expose a whole bunch of devices, so it should be a matter of adding support. That said, between hddtemp, the nvidia driver and the ACPI thermal zone drivers for the CPU, you should be able to track all the important temperatures.
Ah, a couple of other things: the built-in mic sensitivity is awfully low, and unlike your 15″ MBP, the 13″ has only one audio port, so you need to manually toggle between input and output modes. I’ve yet to figure out if/how this works with the hda driver.
Finally, I can’t seem to get USB suspend to work on a bunch of USB devices (card reader, IR receiver) so battery life is on the lower side of 3 hours. I’d really like to try to see how to improve this.
Ahh okay, I had usb suspend working, it just worked out of the box for me, and audio was great but for some reason on my model kernels after 2.6.31 would not boot at all. You would select the entry in ELILO, and it would go to a black screen and nothing would happen. Its not the gfx card, its something in EFI booting itself on that kernel revision or higher on my model. Even on working efi kernels such as 2.6.30, there is horrid tearing all over the screen.
I also never managed to get the STA drivers working, but that was a few months ago, so I may want to try again. You can fix up the pommed sensors in their configuration if you have time and a torch to shine at the sensor, you can adjust it to a good level, I had is responding about the same as OSX does.
Really good work! Thanks for sharing!
rEFIt does support ext2/3 and reiserfs. These are case sensitive (unlike HFS+ most of the time, and msdos), so you need to store you grub binaries in /EFI/ not /efi/. See here:
http://sourceforge.net/tracker/?func=detail&aid=3031088&group_id=161917&atid=821764
2 Trackbacks
[...] Arun Raghavan: Pure EFI Linux Boot on Macbooks on Planet GentooTopics: MacBook Pro, MacBook, Mac OS X [...]
[...] Pure EFI Linux Boot on Macbooks [...]