The kernel boot is required for the necessary startup parameters. No boot automatically starts completely from 0 and requires Uboot to help the kernel achieve relocation and provide parameters.
First, Uboo reads the BOOTCMD environment variable from the kernel partition, which can be started automatically depending on the environment variable.
Partition:
There is a partition table on each hard disk. Because there is no partition table in Flash, the partition of Flash can only be defined in the source code, so it cannot be changed.
Mtdparts=nandflash0:[email protected]0(bootloader), 128k (params), 2m (kernel),-(Root)
Note: @0 indicates starting from 0.
Before starting, the kernel is read from Nandflash and put into memory. and Uimage = head + True kernel.
Head (64 bytes):
Ih_load: The load address, which is where the kernel run should be located.
IH_EP: The entry address, which is the entry address of the kernel.
It's very similar to Uboot. The load address of the uboot is Text_base, and the entry address is start. The _start in S.
Work done by Bootm:
1. Read the head
2. Move the kernel based on the head information
2. Boot the kernel.
At boot time, Uboot needs to tell the kernel some boot parameters. The parameter is set.
Jumps to the first piece of code in the kernel.
When you start the kernel, use the header's entry address as the function pointer (Thekernel) to start.
Setup_start_tag ()
Setup_memory_tag ()
Setup_commandline_tag ()
Setup_end_tag ()
Sd
Linux Embedded Drive Learning path ⑥u-boot boot kernel