Linux Kernel Internals 12.Link together head o misc o piggy o into bymlinux (or vmlinux for zImage.don't mistake this for /usr/src/linux/vmlinux!).Note the difference between-Ttext 0x1000 used for vmlinux and-Ttext 0x100000 for bvmlinux,i.e.for bzImage compression loader is high-loaded 13.Convert bvmlinux to'raw binary'bvmlinux.out removing.note and.comment ELF sections 14.Go back to arch/i386/boot directory and using the program tools/build cat together bbootsect+ bsetup+compressed/bvmlinux out into bzImage(delete extra'b'above for zImage).This writes important variables like setup_sects and root_dev at the end of the bootsector. The size of the bootsector is always 512 bytes.The size of the setup must be greater than 4 sectors but is limited above by about 12K-the rule is: 0x4000 bytes>=512 +setup sects *512+room for stack while running bootsector/setup We will see later where this limitation comes from. The upper limi size of the boo keme ge and lo ower bound on the enAoise setup so it is easy to en kernel by a ding some large.spac 1.2 Booting:Overview The boot process details are architectu ecific so we shall foc our attention on the ibm pc/la32 architecture due to old de and backw d co patibility,the PC fin boots the operating system in an 1.BIOS selects the boot device 2.BIOS loads the bootsector from the boot device 3.Bootsector loads setup,decompression routines and compressed kernel image 4.The kernel is uncompressed in protected mode 5.Low-level initialisation performed by asm code 6.High-level C initialisation 1.3 Booting:BIOS POST 1.The power supply starts the clock generator and asserts #POWERGOOD signal on the bus 2.CPU #RESET line is asserted(CPU now in real 8086 mode) 3.% es=%fs=%gs=%ss=0, S.7o0 4.All the checks perfor 5.IVT initialised at address 0 1.2 Booting:Overview 312. Link together head.o misc.o piggy.o into bvmlinux (or vmlinux for zImage, don't mistake this for /usr/src/linux/vmlinux!). Note the difference between −Ttext 0x1000 used for vmlinux and −Ttext 0x100000 for bvmlinux, i.e. for bzImage compression loader is high−loaded 13. Convert bvmlinux to 'raw binary' bvmlinux.out removing .note and .comment ELF sections 14. Go back to arch/i386/boot directory and using the program tools/build cat together bbootsect + bsetup + compressed/bvmlinux.out into bzImage (delete extra 'b' above for zImage). This writes important variables like setup_sects and root_dev at the end of the bootsector. The size of the bootsector is always 512 bytes. The size of the setup must be greater than 4 sectors but is limited above by about 12K − the rule is: 0x4000 bytes >= 512 + setup_sects * 512 + room for stack while running bootsector/setup We will see later where this limitation comes from. The upper limit on the bzImage size produced at this step is about 2.5M for booting with LILO and 0xFFFF paragraphs (0xFFFF0 = 1048560 bytes) for booting raw image, e.g. from floppy disk or CD−ROM (El−Torito emulation mode). Note, that tools/build validates the size of the boot sector, of the kernel image and lower bound on the size of setup but not the upper bound of setup so it is easy to build a broken kernel by adding some large ".space" at the end of setup.S. 1.2 Booting: Overview The boot process details are architecture−specific so we shall focus our attention on the IBM PC/IA32 architecture. Due to old design and backward compatibility, the PC firmware boots the operating system in an old−fashioned manner. This process can be separated into the following six logical stages: 1. BIOS selects the boot device 2. BIOS loads the bootsector from the boot device 3. Bootsector loads setup, decompression routines and compressed kernel image 4. The kernel is uncompressed in protected mode 5. Low−level initialisation performed by asm code 6. High−level C initialisation 1.3 Booting: BIOS POST 1. The power supply starts the clock generator and asserts #POWERGOOD signal on the bus 2. CPU #RESET line is asserted (CPU now in real 8086 mode) 3. %ds=%es=%fs=%gs=%ss=0, %cs:%eip = 0xFFFF:0000 (ROM BIOS POST code) 4. All the checks performed by POST with interrupts disabled 5. IVT initialised at address 0 Linux Kernel Internals 1.2 Booting: Overview 3