This document is intended as a general overview for the booting of Linux 2.6

Linux boot process
When the system first boots, or the system is reset, the processor will executea known location in the code.In the personal computer (PC), this position in the basic input / output system (BIOS), it saved in flash memory on the motherboard. Embedded System central processing unit (CPU) will call the reset vector to start one in flash / ROM in the procedure known address. Because the PC provides a lot of flexibility, BIOS must determine which device to use to boot the system.
When finding a boot device, the first phase of the boot loader is loaded into the RAM and executed. The boot loader is less than 512 bytes in size (one sector), whose role is to load the second stage boot loader.
When the second stage boot loader is loaded into RAM and executed, usually displays a splash screen, and Linux, and an optional initial RAM disk (temporary root file system) is loaded into memory. The image is loaded, the second phase of the boot loader will control to the kernel image, and then the kernel can be decompressed andinitialized. At this stage, the second stage of boot loader detects the system hardware, system link enumerate hardware devices, mounts the root device, then load the necessary kernel modules. After completion of these operations the first user-spaceprogram started (init), and perform advanced system initialization.
What is the initrd
The English meaning of initrd boot loader initialized RAM disk, that is initialized by the boot loader memory disk, is mounted in the boot process a temporary root file system to support the two-stage boot process. initrd image contains the Linux kernel to support the required two-stage process necessary to start the executable and system files. Kernel boot process, the initial RAM disk (initrd) is a stage 2 boot loader is loaded into memory, it will be copied into RAM, and mounted to the system.The initrd will be used as temporary RAM root file system in use, and allows the kernel does not mount in the case of any physical disk to achieve a complete guide. Interact with the peripheral devices as needed module may be part of initrd, so the kernel can be very small, but still need to support a large number of possible hardwareconfigurations. In the kernel boot, you can root file system equipped with a formal (through pivot_root): initrd root file system will now uninstall it, and mount the real root file system. initrd.img is mainly used in the core kernel module loaded at boot time, this need to understand the process of booting the system. A simple example: your root file system is ext3, when the kernel when you compile ext3 file system plug-in modules compiled into the kernel. Linux system at boot, load the kernel first, then load the init process. When you load the init process, you need to read the ext3 file system (root file system), ext3 file system at a time when support for the plug-in module is loaded the way, to the root file system must also be read. The question becomes: At this point how to make the kernel load the ext3 file system kernel module? This we can be ext3 file into the initrd.img in the module, the image from the boot loader loaded into memory. This is the main role initrd.img.
If you want to use the initrd.img, you can read the file system will be able to use prior to the use of functions which can be compiled into the kernel.
The advantages of two-stage launch
The purpose of the first stage is to start the second phase of the start clearing all the obstacles, the most important is to load the root file system storage media drive module. We know that can be stored in the root file system, including IDE, SCSI, USB, including a variety of media, if these device drivers are compiled into the kernel, the kernel can imagine will be very large and bloated.
When the kernel booted and initialized, the kernel can start your first user-space application. This is the first call using the standard C library compiled programs. Prior to this, there is no implementation of any standard C applications. Linux on the desktop system, the first start of the program is usually /sbin/init.

Advertisements