Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search

4. The Raw Loader

The sources for this loader can be found in directory arch/alpha/boot of the Linux kernel source distribution. It loads the Linux kernel by reading START_SIZE bytes starting at disk offset BOOT_SIZE+512 (also in bytes). The constants START_SIZE and BOOT_SIZE are defined in linux/include/asm-alpha/system.h. START_SIZE must be at least as big as the kernel image (i.e., the size of the .text, .data, and .bss segments). Similarly, BOOT_SIZE must be at least as big as the image of the raw bootstrap loader. Both constants should be an integer multiple of the sector size, which is 512 bytes. The default values are currently 2MB for START_SIZE and 16KB for BOOT_SIZE. Note that if you want to boot from a 1.44MB floppy disk, you have to reduce START_SIZE to 1400KB and make sure that the kernel you want to boot is no bigger than that.

To build a raw loader, simply type make rawboot in the top directory of your linux source tree (typically /usr/src/linux). This should produce the following files in arch/alpha/boot:

tools/lxboot:

The first sector on the disk. It contains the offset and size of the next file in the format described above.

tools/bootlx:

The raw boot loader that will load the file below.

vmlinux.nh:

The raw kernel image consisting of the .text, .data, and .bss segments of the object file in /usr/src/linux/vmlinux. The extension .nh indicates that this file has no object-file header.

The concatenation of these three files should be written to the disk from which you want to boot. For example, to boot from a floppy, insert an empty floppy disk in, say, /dev/fd0 and then type:

# cat tools/lxboot tools/bootlx vmlinux >/dev/fd0

You can then shutdown the system and boot from the floppy by issuing the command boot dva0.