Arun Raghavan

Extremely pithy tagline here

TAG: laptop

Pure EFI Linux Boot on Macbooks

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:

  1. EFI firmware starts on boot
  2. Starts rEFIt, a program that extends the default bootloader to provide a nice bootloader menu, shell, etc.
  3. 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)
  4. Runs the Grub2 EFI image from a FAT partition
  5. Loads the Linux kernel (and initrd/initramfs if any) from /boot
  6. 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.

Of bloodletting imminent

So after all my whining about Dell laptops sucking and painting apocalyptic imagery of failing hard disks on those things,, the hard disk on my laptop seems to have problems. BIOS self-test as well as Seagate’s own SeaTools confirm it. First saw this as a set of failed writes in Linux. Mid-term tomorrow, so no time for extended diagnosis (umm…why are you posting to your blog then?). Further diagnosis and screaming at HP in the days to come. Oh joy.

Academic update at a later date.

“Lost in a Roman wilderness of pain. All the children are insane.”

One questions the sanity of the one who sang this, one who listens, and one who empathizes. :)

<em>Fake</em> …

Too long.

Got here (== UP) a couple of weeks ago. Getting monstrously slammed in Math, but studies are interesting, and being done far closer to right than under the aegis of the much venerated bastion of education of which I am but a chipping.

Rooms are decent, food is decent (except that I’ve transferred my malignant swearing from the peacocks to potatoes).

Turns out the audio on my laptop uses a Conexant chipset (Intel HD Audio using a Conexant codec chip for audio/modem). I hope I have better luck with getting it to work (with reasonable volume, now) than the last time. For what it’s worth — the codec’s a PCI ID 14f1:5047, which is, I believe, a CX20551-22 chip (not documented in their literature even).

Other news … I got way too many books (heh … there is no such thing, I realise) here. Slow progress. some Nabokov, some Amanda Cross, and Stephen Donaldson. Formal update to booklist when time permits. Currently, the Long, Dark Tea-Time of the Soul.

Yahoo(exclamation-and-all) Mail Beta sucks. If I want Outlook, I’ll use Outlook. Except I won’t want Outlook.

Now to get some lassi and ponder in vain some “elementary” problems in probability (… and whiner, too).

Happy Lappy

Idle thought — the tags field in Logjam should be below the text entry field. How do I know what I want to tag my entry with before I even start typing?

So I got meself the HP Pavilion DV5200TX. It’s not bad, as laptops go. I’ve got only one complaint — the damn blue LEDs are blinding in the dark. Particularly the bright wireless indicator LED. What were the morons thinking?

It’s running Gentoo primarily — fonts suck right now because the RENDER extension is turned off (X.org 7.1 introduces an ABI change that nVidia needs to address. Did I mention this baby has an nVidia GeForce Go 7400 with 256 megs of RAM? Downside — it’s a power hog). Need to put more detailed information up on Gentoo Wiki or some such so people do not grope in the dark like I did to get all the hardware up.

There are no more results.