Friday, January 1, 2010

Linux and Debian simple boot

Today I've been researching on Linux and Debian booting.

There is an excellent article from IBM, which explains the procedure, and the involved parts:

  • BIOS checks CMOS and choose the booting device
  • Control is given to device's MBR (physically first 512 bytes)
  • MBR checks for partitions on the device (in a self contained table), and gives control to bootable partition.
  • Then, Grub, LILO or whatever takes control, to load the kernel, and the file system.
  • Usually a initrd filesystem is loaded before the "real" one. This way, the kernel can access this filesystem, while the modules for loading the one in the root partition are not yet loaded.
  • Finally, init program is called, to load all user-space applications.
To set this up in a USB drive (my idea), in a simple way, we need:

Make the drive bootable, using the syslinux tool, which is used for FAT filesystems:
syslinux /dev/sdb (or whatever device you want)

Then, mount the filesystem, and copy:
linux: the linux kernel binary
initrd.gz: compressed cpio file containing the initrd file tree


syslinux.cfg: syslinux settings, to let syslinux know where to find the kernel and the initrd. Basically:

default linux
append initrd=initrd.gz

Then, just restart, and your device will boot your kernel, and your filesystem.

Here, you can find a Linux kernel, and a initrd file, which will load a basic linux system, running the Debian installer:

Some more info on it at:

No comments:

Post a Comment