EFI mode boot on Macbook3,1 with Debian

After my last post I got curious about booting the Macbook in EFI mode. Because, well, why not? So I googled for a while and found this blog post which served as a great reference and comment on two other.

I understand EFI is somewhat buggy and what works for me might not work for you. So be careful, have a rescue disk at hand. On that topic, I should say that I could not get this to work with Debian sid’s 3.2 kernel, but 3.5 from experimental worked fine for me.

Hopefully, you after booting EFI succesfully.

My main question before doing this was “What works?”, I had heard some weird rumours and mentions that you had to run X in framebuffer mode and weird stuff like that. This is bullshit. Everything works fine, with the same standard software and setup.

Features:

  • GNOME Shell, hence acceleration, works
  • All drivers work: wireless, bluetooth, etc.
  • No need to force AHCI mode on the disk controller
  • No graphic flicker during the boot process
  • A feeling of catching up with the times

So, here we go. I am posting my notes in “shell-like” since I find little benefit in turning them into an essay or something more textual. Good luck!

# Install grub-efi-$arch.
# Usually $arch depends on your processor.
# Best bet: you can use OSX to check for this:
#
# $ ioreg -l -p IODeviceTree | grep firmware-abi
# It will print EFI32, or EFI64. You know what to do.
$ sudo apt-get install grub-efi-amd64

# Now we need to mount the system EFI partition for GRUB2 to install
# itself on it.
# NOTE: you have to do this, installing the package is NOT enough.
$ sudo mkdir /boot/efi
$ sudo mount /dev/sda1 /boot/efi

# Did you get the right partition?
# It should have an EFI directory with an APPLE directory inside.
# DO NOT DELETE THE APPLE DIRECTORY, PRICK.
$ ls /boot/efi
EFI/
$ ls /boot/efi/EFI/
APPLE/

# Create a new directory, “debian” will do.
# Run grub-install so GRUB2 drops its EFI code in the new directory.
$ sudo mkdir /boot/efi/EFI/debian
$ sudo grub-install
$ ls /boot/efi/EFI/
$ ls /boot/efi/EFI/debian/

# Help rEFIt know this is a GNU/Linux boot.
# rEFIt assigns icons depending on the name of the EFI file, grub64x is not in its list
$ sudo mv /boot/efi/EFI/debian/grub64x.efi /boot/efi/EFI/debian/e.efi

# IMPORTANT: Add the proper modeset.
# For EFI-only systems: efi_uga
# For UEFI systems: efi_gop
# Without this you won’t have any graphics.
$ sudo vim /etc/default/grub
...
GRUB_VIDEO_BACKEND="efi_uga"
...

# Update grub, reboot. Hope that everything worked.
$ sudo update-grub

Extra credit
You can clean your MBR from the old GRUB2-pc installation (if you installed it to the hybryd-MBR, like a sane person) from OSX:
$ sudo fdisk -u /dev/disk(tab-to-complete, verify it is the right disk)

(Read the man page for your fdisk to be sure -u still means “fix MBR while keeping partitions”)

This entry was posted in English, planetdebian, planetgnome, Tips and tagged , , , . Bookmark the permalink.

One Response to EFI mode boot on Macbook3,1 with Debian

  1. glandium says:

    You also need to add “GRUB_GFXPAYLOAD_LINUX=keep” to /etc/default/grub if you don’t want the “error: no suitable mode found. Booting however” messages.

Comments are closed.