Knowledge about Linux Startup:
Start PC from hard diskLinuxThere are two phases:
1. BIOS checks the hardware and finds the Bootstrap in MBR. [This step is completed by the BIOS program solidified on the motherboard]
2. After the control is handed over to bootstrap, the MBR length in the hard disk is fixed to 512 bytes. MBR itself is divided into two parts: the first 446byte is the Bootstrap program, and the rest is the partition table. The purpose of the Bootstrap program is to find the boot parameters, obtain the kernel image in the disk, load it into the memory, input the boot parameters, and finally give the CPU control to the kernel.
Two common bootloaders: Lilo and grub
Two files used during startup: vmlinux and initrd
Vmlinux
Wikipedia explanation
On Linux systems, vmlinux is a statically linked executable file that contains the Linux kernel in one of the object file formats supported by Linux, which has des elf, coff and. out. the vmlinux file might be required for kernel debugging, symbol table
Generation or other operations, but must be made bootable before being used as an operating system kernel by adding a multiboot header, bootsector and setup routines.
Vmlinux is an executable file generated by compilation. Its format is supported by Linux, such as Elf, coff, and A. Out. It is usually used for kernel debugging and symbol table generation. If you want to put the file in the kernel as an executable file, you need to add the relevant boot part to serve as a boot file.
Initrd:
Like other UNIX systems, the Linux operating system first needs to boot the kernel into the memory. The kernel resides throughout the entire activity cycle of the operating system and applications. Applications (software) run in "user space" and are placed under kernel control.
To minimize the load memory, some core Linux programs can be converted into modules and dynamically loaded into the system.
Files in the initrd system can be accessed by the core during startup, and the content in the file will be mounted into a loop file. In the early stage, initrd was placed in a small soft disk. Initrd is usually compressed to gzip type. during startup, bootloader (Lilo, grub) informs the core initrd location.
Differences between vmlinux and Image
Vmlinux is an elf file. image is a file in vmlinux that only retains the content of the data and text segments after the objcopy operation. It is usually compressed and stored, such as zimage. uimage is based on zimage and a header with a length of 0x40 that can be provided by uboot. It can be used with uboot.