Sunday, February 28, 2010

Anatomy of an Embedded Linux System - Boot Loader

Boot loaders can be laden with features, but their primary responsibility is to get the processor initialized and ready to run the operating system. Later in the book, I go through the boot-up process from beginning to end; but for practical purposes, this is the software that’s first run on the system.

In most modern embedded Linux systems, the kernel is stored in a partition in flash memory. The boot loader copies that flash partition into a certain location in RAM, sets the instruction pointer to that memory location, and tells the processor to start executing at the instruction pointer’s current location. After that, the program that’s running unceremoniously writes over the boot loader. The important thing to note is that the boot loader is agnostic with respect to what is being loaded and run. It can be a Linux kernel or another operating system or a program written to run without an operating system. The boot loader doesn’t care; it performs the same basic actions in all these use scenarios.

As boot loaders have matured, they’ve become more like operating systems with network, video, and increasing support for flash storage devices. Later in this book, I look at the popular boot loaders you may encounter when working with Linux.

One more important note: boot loaders are now ubiquitous. Rarely as an embedded Linux developer do you need to port a boot loader for your board. You may want to recompile the boot loader (I’ll cover that, too) to remove functionality to conserve space and increase boot time, but the low-level engineering is done by the board vendor. Users of Intel-based systems that use the Phoenix BIOS boot loader have no opportunity to change this code, because it’s baked into the board design.


If you’re familiar with Linux systems running on PC-type hardware, you’re no doubt familiar with Grub and LILO. If you’re not, hit the reset button and wait. You see one or the other as the computer starts. Technically, these aren’t boot loaders, but loaders for Linux. Old-school Linux users remember running a similar program, loadlin, from the DOS prompt in order to begin running Linux after the PC first booted DOS or Windows; in this case, MS-DOS acted as the boot loader for Linux. The boot loader contained in the BIOS of the machine read these programs from a certain sector of a disk and begins running them.

Source of Information : Pro Linux Embedded Systems (December 2009)

No comments: