
kboot—A Boot Loader Based on Kexec Werner Almesberger [email protected] Abstract tools for hardware diagnosis and system soft- ware repair. On Linux, many boot loaders are much more limited than this. Compared to the “consoles” found on tradi- tional Unix workstations and mini-computers, Even boot loaders that provide several of these the Linux boot process is feature-poor, and the advanced features, like GRUB, suffer from the addition of new functionality to boot loaders of- problem that they need to replicate functional- ten results in massive code duplication. With ity or at least include code found elsewhere, the availability of kexec, this situation can be which creates an ever increasing maintenance improved. burden. Similarly, any drivers or protocols the boot loader incorporates, will have to be main- kboot is a proof-of-concept implementation of tained in the context of that boot loader, in par- a Linux boot loader based on kexec. kboot uses allel with the original source. a boot loader like LILO or GRUB to load a reg- ular Linux kernel as its first stage. Then, the full New boot loader functionality is not only re- capabilities of the kernel can be used to locate quired because administrators demand more and to access the kernel to be booted, perform powerful tools, but also because technologi- limited diagnostics and repair, etc. cal progress leads to more and more complex mechanisms for accessing storage and other de- vices, which a boot loader eventually should be able to support. 1 Oh no, not another boot loader ! It is easy to see that a regular Linux system hap- pens to support a superset of all the functional- There is already no shortage of boot loaders for ity described above. Linux, so why have another one ? The moti- vation for making kboot is simply that the boot With the addition of the kexec system call to process of Linux is still not as good as it could the 2.6.13 mainline Linux kernel, we now have be, and that recent technological advances have an instrument that allows us to build boot load- made it comparably easy to do better. ers with a fully featured Linux system, tailored according to the needs of the boot process and Looking at traditional Unix servers and work- the resources available for it. stations, one often finds very powerful boot en- vironments, offering a broad choice of possible Kboot is a proof-of-concept implementation of sources for the kernel and other system files to such a boot loader. It demonstrates that new load. It is also quite common to find various functionality can be merged from the vast code 28 • kboot—A Boot Loader Based on Kexec base available for Linux with great ease, and to the operating system it is booting, and trans- without incurring any significant maintenance fers control to the entry point of the code it has overhead. This way, it can also serve as a plat- loaded. form for the development of new boot concepts. The project’s home page is at http:// In the case of Linux, two items deserve special kboot.sourceforge.net/ mention: the boot parameter line and the initial RAM disk. The remainder of this section gives a high-level view of the role of a boot loader in general, The boot parameter line was at its inception in- and what kboot aims to accomplish. Additional tended primarily as a means for passing a “boot technical details about the boot process, includ- into single user mode” flag to the kernel, but ing tasks performed by the Linux kernel when this got a little out of hand, and it is nowadays bringing up user space, can be found in [1]. often used to pass dozens if not hundreds of bytes of essential configuration data to the ker- Section 2 briefly describes Eric Biederman’s nel, such as the location of the root file system, kexec [2], which plays a key role in the op- instructions for how certain drivers should ini- eration of kboot. Section 3 introduces kboot tialize themselves (e.g., whether it is safe for proper, explains its structure, and discusses its the IDE driver to try to use DMA or not), and application. Section 4 gives an outlook on fu- the selection and tuning of items included in a ture work, and we conclude with section 5. generic kernel (e.g., disabling ACPI support). 1.1 What a boot loader does Since a kernel would often not even boot with- out the correct set of boot parameters, a boot After being loaded by the system’s firmware, a loader must store them in its configuration, and boot loader spends a few moments making it- pass them to the kernel without requiring user self comfortable on the system. This includes action. At the same time, users should of course loading additional parts, moving itself to other be able to manually set and override such pa- memory regions, and establishing access to de- rameters. vices. The initial RAM disk (initrd), which at the time After that, it typically tries to interact with of writing is gradually being replaced by the the user. This interaction can range from initial RAM file system (initramfs), provides an checking whether the user is trying to get the early user space, which is put into memory by boot loader’s attention by pressing some key, the boot loader, and is thus available even be- through a command line or a simple full-screen fore the kernel is fully capable to interact with menu, to a lavish graphical user interface. its surroundings. This early user space is used Whatever the interface may be, in the end its for extended setup operations, such as the load- main purpose is to allow the user to select, per- ing of driver modules. haps along with some other options, which op- erating system or kernel will be booted. Once Given that the use of initrd is an integral part of this choice is made, the boot loader proceeds to many Linux distributions, any general-purpose load the corresponding data into memory, does Linux boot loader must support this functional- some additional setup, e.g., to pass parameters ity. 2006 Linux Symposium, Volume One • 29 Hard− and firmware New device drivers New protocols Boot process Administration User experience New file systems Convenience Combination of services Compatible "look and feel" Figure 1: The boot process exists in a world full of changes and faces requirements from many directions. All this leads to the need to continuously grow in functionality. 1.2 What a boot loader should be like formats, and gets particularly interesting when using networks. For example, there is noth- ing inherently wrong in wanting to boot kernels A boot loader has much in common with the that happen to be stored in RPM files on an NFS operating system it is loading: it shares the server, which is reached through an IPsec link. same hardware, exists in the same administra- tive context, and is seen by the same users. The hardware and protocol environment of the From all these directions originate require- boot process extends beyond storage. For ex- ments on the boot process, as illustrated in fig- ample, keyboard or display devices for users ure 1. with disabilities may require special drivers. With kboot, such devices can also be used to The boot loader has to be able to access at least interact with the boot loader. the hardware that leads to the locations from which data has to be loaded. This does not Last but not least, whenever users have to per- only include physical resources, but also any form non-trivial tasks with the boot loader, they protocols that are used to communicate with will prefer a context similar to what they are devices. Firmware sometimes provides a set used to from normal interaction with the sys- of functions to perform such accesses, but new tem. For instance, path names starting at the hardware or protocol extensions often require root of a file system hierarchy tend to be easier support that goes beyond this. For example, al- to remember than device-local names prefixed though many PCs have a Firewire port, BIOS with a disk and partition number. support for booting from storage attached via Firewire is not common. In addition to all this, it is often desirable if small repair work on an unbootable system can Above basic access mechanisms lies the do- be done from the boot loader, without having main of services the administrator can combine to find or prepare a system recovery medium, more or less freely. This begins with file system or similar. 30 • kboot—A Boot Loader Based on Kexec Kernel memory Kernel memory (before rebooting) (while and after rebooting) Copy file(s) through user space into kernel memory Order pages 1 2 3 Run kexec reboot Kernel Kernel code code 4 code kboot −f file Jump to kernel setup Figure 2: Simplified boot sequence of kexec. The bottom line is that a general-purpose boot it to absorb additional functionality more loader will always grow in functionality along quickly. For instance, GRUB can directly read the lines of what the full operating system can a large number of different file system formats, support. without having to rely on external help, such as the map file used by LILO. GRUB also offers limited networking support. 1.3 The story so far Unfortunately, GRUB still requires that any The two principal boot loaders for Linux on the new functionality, be it drivers, file systems, file i386 platform, LILO and GRUB, illustrate this formats, network protocols, or anything else, is trend nicely.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages14 Page
-
File Size-