HCL Interview Question
Software Engineer / DevelopersCountry: India
Interview Type: In-Person
Booting a device may need several stages:
1. boot ROM (in processor)
2. first stage boot loader
3. second stage boot loader
4. kernel
After all, we want to run the kernel. Booting process starts from 'boot ROM' in a processor, if the 'boot ROM' can load and run kernel, we can remove all other boot loaders. But, most processor's 'boot ROM' cannot do this, they can only load simple boot loader code from special area. The simple boot loader can then load a complex boot loader or load kernel directly. Complex boot loader has more helpful functions for development, but it's not necessary for a shipped product.
X-Loader : Sets up the pin muxing, initializes clocks and memory, loads the U-boot into SDRAM and executes it.
U-boot : Performs some additional platform initialization, sets the boot arguments, passes control to the kernel image.
Why are there two bootloaders? The first bootloader, x-loader, is a stripped-down version of the u-boot, designed to run in OMAP's small on-chip SRAM. It initializes the main off-chip memory of the system and other necessary device drivers, and then loads the larger bootloader for Linux, u-boot.
For further reference : Google the term 'bootloader project '
X-loader is first level bootloader. This is usually smaller in size and loaded onto the internal RAM. It takes care of initializing the clocks and DDR initialization.
u-boot is a second level bootloader. This binary is bigger in size and cannot be executed from internal RAM. Hence this executed from external RAM (DDR).
Because the internal static ram is very small (64k), xloader is stripped down to the essentials and is used to initialize memory and enough of the peripheral devices to access and load the second stage loader (UBoot) into main memory.
- srdjan August 19, 2013