Extlinux is one of the many spinoffs of syslinux -- the bootloader used for live CDs and many other applications. It's not as commonly used as a bootloader for desktops and laptops, but it's perfectly capable of that. It's simple, well tested and has been around for years. And it supports the few things I want out of a bootloader: it has a simple configuration file that lives on the /boot partition; it can chain-load Windows, on machines with a Windows partition; it even offers pretty graphical menus with image backgrounds. Here's how to install it.
The first step is to install extlinux. On Deban or Ubuntu, that means:
apt-get install extlinux syslinux-common
On Debian, this automatically creates a directory /boot/extlinux with a few configuration files in it. Notably, you'll have extlinux.conf -- the main configuration file controlling your bootloader -- and linux.cfg, containing the stanzas needed to boot your current kernel.
Note: I always make /boot a separate partition, and if you're booting multiple OSes, I recommend you do too. You don't want all your boot files controlled by one Linux distro, and subject to being wiped out if anything happens to that particular install. If you have /boot on the same filesystem as /, you may need to adapt some of these instructions accordingly.
Installing the package gave you a configuration file and the programs you need, but of course it hasn't changed the way your system actually boots yet. That takes explicit action.
First, let extlinux install a few files on your /boot partition:
extlinux --install /boot/extlinuxThe man page is vague on what this actually does, but I suspect that it writes something into the first sector of your /boot partition as well as installing a few necessary files into /boot/extlinux.
Next, make sure your /boot partition is flagged as bootable. You can check that by running fdisk, as root:
# fdisk -l /dev/sdaBootable partitions will have a * in the Boot column. Make sure the partition where your /boot lives -- whether it's your / partition or a separate /boot partition -- is marked bootable. If it's not, you can make it bootable with a program like gparted or fdisk (if you're not sure, use gparted).
You may be ready to boot -- but probably not. If your system was previously set up to use grub, grub has probably overwritten the disk's master boot record (MBR). Even if you told it not to. If so, you'll need to replace the grub code with a more standard MBR. There's one that comes with extlinux, and you can install it like this:
# cat /usr/lib/extlinux/mbr.bin >/dev/sdaDon't worry -- this won't overwrite your whole disk, only the boot block portion.
Adrian Weiler suggests, probably correctly, that a better command is:
# dd if=/usr/lib/extlinux/mbr.bin of=/dev/sda bs=440 count=1You can also add conv=notrunc. This allows the command to be usable with disk images as output.
At this point, you should be ready to boot using extlinux. But you won't see a boot menu yet.
Extlinux needs a little extra code in order to display a menu. On Debian, that code comes from the syslinux-common package rather than the extlinux package, which is why I said earlier that you should install both. Copy the menu files into place:
# cp /usr/lib/syslinux/*menu* /boot/extlinux
If you'll be dual-booting Windows or another OS, you'll also need the chain-loader:
# cp /usr/lib/syslinux/chain.c32 /boot/extlinux
Now you can add a line to /boot/extlinux.conf to turn on the menu :
A basic Linux menu entry looks like this:
label squeeze menu label Debian Squeeze on sda5, kernel 2.6.32-5-686 kernel /vmlinuz-2.6.32-5-686 append initrd=/initrd.img-2.6.32-5-686 root=UUID=98f012537-7a7c-2213-819e-a69ddf9abc2b ro quiet
If you need to boot Windows, that will look something like this:
LABEL Windows KERNEL chain.c32 APPEND hd0 1
At this point you should be able to reboot and see a menu.
There are lots of configurations for the color and shading of your menus -- see menu.txt in the syslinux git repository.
You can put all those changes in extlinux.conf. But if you're on Debian or Ubuntu, you may not want to -- because your changes will be overwritten the next time you update your kernel. For an explanation of how that works, and how to turn it off (I've disabled it on all my systems), see my article Configuring extlinux's auto-update on Debian.
Extlinux's vesamenu.c32 can display pretty image backgrounds. To begin, start with a 640x480 image. (You can try a higher resolution later, which in theory is supported; but in practice I haven't gotten it to work, and why complicate things when you're first testing?)
Extlinux can handle JPG or PNG images, but not all JPG options are supported. For instance, jpegs with the "progressive" option, which makes an image load faster over the web, won't work with extlinux, so make sure progressive is disabled if you're saving JPGs from GIMP.
Once you have your image, copy it to /boot/extlinux/ and add a line like this in extlinux.conf:
menu background splash.png
If your saved JPGs don't work and you can't figure out why, you can always fall back on the convert program from ImageMagick to make a JPG with simpler options:
convert orig.jpg splash.jpg
Or use the PNG format, though it uses more disk space:
convert orig.jpg splash.png
Generally, for a good boot splash, you'll want an image with fairly even colors -- all fairly dark or all fairly light -- so the menu text will be visible against it. But it's easy to change images, so experiment and see what you like best.
The only other problem I've had with splash images is that once you
select an image, extlinux replaces the image with an ugly solid
off-white background, and the screen looks bad until the boot sequence
switches to a framebuffer. I haven't found a way around this.
menu clear option in the
documentation that looks like it should help, but it doesn't make
any difference I've been able to see.
The man pages for extlinux and syslinux contain several pointers to syslinux.zytor.com for more information -- but sadly, the Syslinux wiki had its database corrupted some time back, so it's not currently available.
In the meantime, the best documentation is the text files in the syslinux git repository -- menu.txt is especially helpful.