1, the role of bootloader
Simply put,BootLoader is a small program that runs before the operating system runs. With this applet, you can initialize the hardware device to bring the system's hardware and software environment to a suitable state to prepare for the final call to the operating system. The starting process for bootloader is divided into two stages stage1 and Stage2.
Stage1 are all compiled by the Assembly, and its main work is (1) Initializing hardware devices, (2) Prepare the stack segment for the Stager2 C locale for the stage2 of the Loaded Bootlodader (3) copy of the bootloader Stage2 to Ram space (4).
Stage2 is written all by C, and its main work is (1) Initialize the hardware device (2) to be used in this phase, the kernel image and the root file system image read from Flash to RAM (3) call the kernel
2, why need bootloader.
Each of these different CPU architectures has different bootloader. In addition to the CPU-dependent architecture, Bootloader also relies on the configuration of embedded board-level devices, such as the hardware address assignment of the Board card, the peripheral chip type, and so on. In other words, for two different development boards, even if they are built on the same CPU, but if their hardware resources or configuration is inconsistent, want to run the Bootloader program on a Development Board can also run on another board, or need to make changes.