EFI
It is important to distinguish between the EFI system that starts when you power on the Joggler, and the boot loader that then goes on to load your chosen OS. It may be useful to read the EFI page on Wikipedia for a grounding.
When power is applied to a Joggler the firmware starts the EFI environment, which has been preprogrammed from the factory to look for devices to boot from. This includes USB-attached devices, which allows for recovery in case of damage to the native operating system.
Although USB devices appear to be booted in preference to the internal flash, it is often the case that the internal flash simply redirects to the external device should one be present (hence the two entries in startup.nsh, explained below). This allows us to start an alternative OS without altering the internal one. Happily, should the internal flash fail (which is a common fault) the EFI environment simply moves on to the next available storage device.
Contents |
Boot Components
In order to boot, the first partition of any storage device must be FAT formatted (officially FAT16 is preferred) and around 64MB in size. Smaller sizes work reliably, while larger partitions (eg. 128MB) have been reported to fail. The files startup.nsh and boot.nsh are then used to control what happens next. By convention, startup.nsh is executed first.
startup.nsh
By default, startup.nsh on the internal flash contains the following:
fs1:boot2 fs0:boot
The first line attempts to call boot2.nsh on an external device, which will normally fail. It then continues to execute boot.nsh on the primary device (itself).
When creating a system to be held on the internal flash, the following contents are recommended:
fs1:grub fs0:boot
This will attempt to call grub on an external device, before loading from the internal flash. It's a sensible precaution to take should the internal flash give up and will save you from having to mash <ESCAPE> on your keyboard to get an external device to boot.
boot.nsh
The boot.nsh file identifies which EFI application is to be loaded. This must be a binary compiled specifically for the EFI environment; most commonly the GRUB bootloader is executed, although there are alternatives such as rEFIt.
Commonly, boot.nsh contains:
fs1: grub
However, this can again by reduced to simply:
grub
This will execute grub.efi on the root of the boot partition. If necessary you can move into subdirectories as follows:
cd \efi\grub grub
In reality, the boot.nsh file is optional; startup.nsh is entirely capable of executing an EFI binary directly. However, using it allows for a predictable calling point, regardless of whether your Joggler has booted from internal or external storage. Any boot environment can call boot and be redirected to an appropriate binary.
grub.cfg
From this point your EFI-compiled bootloader takes over, loading an operating system on whichever partition you require. To illustrate, this is an example of the grub.cfg file from Jools Wills' Ubuntu 10.10 image:
set timeout=10
menuentry "Ubuntu 10.10 (Maverick) - 2.6.37.3joggler2" {
set root=(hd0,1)
linux /vmlinuz-2.6.37.3joggler2 root=/dev/sda3 ro quiet splash
initrd /initrd.img-2.6.37.3joggler2
}
As you can see, this is a perfectly standard grub.cfg file, referencing vmlinuz-2.6.37.3joggler2 and initrd.img-2.6.37.3joggler2 for the 2.6.37.3joggler2 kernel. A convenient way to ensure that these files are concurrent with your Linux operating system (as they must be, otherwise it will fail to boot) is to mount the FAT16 partition as /boot in your operating system's /etc/fstab file.
Boot Loaders
The boot loader page contains information on pre-made boot loaders that can be used to start alternative operating systems. You should be aware that your kernel versions will need to match in order for these to be of use.