Saturday, September 23, 2006

How Linux Boots

  1. The BIOS loads and execute the first 512 bytes off the disk

    (/dev/hda), a.k.a. the Master Boot Record (MBR)

  2. The boot loader executes the first 512 bytes of the partition that

    you selected (if more than one is available).

    Advanced boot loaders like Grub or System Commander offer more features

    than the DOS boot loader. Some boot loaders save their configuration in

    the MBR (hence the need to remember to run the lilo command after

    editing it to save your changes to the master boot record on disk), while others

    save their data in a partition

  3. The partition loader now decompresses the kernel in RAM, and runs it

  4. The kernel initialises devices, loads the root partition,

    loads the /sbin/init process (PID=1) that reads its configuration

    information from /etc/inittab to know which boot scripts to run

    and at which run-level to start, and which processes to spawn.

    The actual scripts are in /etc/rc.d/init.d, and /etc/rc.d/rc#.d

    only contains links

  5. Init launches Getty to open consoles, and launches Login

    to present the user with a logon prompt

Note that once the Linux kernel has been loaded by lilo,

it looks in "all the usual places" for init and runs the first copy it finds.

More information: Inside the Linux boot process by Tim Jones


No comments: