Adventures with kexec

You may know, my laptop is in a rather horrible state – it has no harddisk, and the BIOS only boots off harddisks and CD-ROMs.  It seems difficult/impossible to find a replacement harddisk due to the strange size and connector.  So, I use a PCMCIA (PCCARD) CFCard adapter for a root filesystem and knocked together a boot CD for the kernel and initrd.  In the initrd I wrote a custom linuxrc script to bootstrap PCMCIA, mount the root fs, and hand over to init.

The obvious problem with this solution is, every time I want to update the kernel or change a compiled in feature, I have to reburn the boot CD, which gets boring very quickly.  I heard about something called “kexec” a while back, and suddenly realized this morning (While hung over after a party and having been woken up at 9AM to help with heavy lifting…) that kexec could solve a number of these problems.

What I do is, the boot CD loads up PCMCIA stuff, mounts the PCMCIA drive, then finds a new kernel and initrd and uses kexec to then boot that newer kernel and initrd.  Therefore, all I need to do to update my kernel is copy the new kernel to /superduperbootcd on the root filesystem – dead easy.

There are a couple of drawbacks, mainly that going through two partial boot cycles takes a while, and any bugs in the kernel which appear during the first boot will need me to burn the boot CD again.  But it’s still quite a neat solution, very cool, and a reason I love linux.

Speaking of bugs which appear during booting, occasionally my kernel segfaults on boot, before it even executes INIT – the backtrace mentions sony_laptop_init, or something similar.  Has anybody heard of this bug, or know of a way to fix it?  It seems more common when my power cable is not connected, but that could just be me.

(Waiting for my pickups from rapid….)

Cheers

No comments yet

Leave a reply