Transferred from: http://blog.csdn.net/blueoceanindream/article/details/6851787
Idle to have nothing to do, summarize the Linux bootrom startup process:
Environment: mips+linux+ Switch
Nor Flash and NAND flash
Nor flash: more pins, support on-chip execution;
NAND Flash: Pins are implemented serially via IO and do not support on-chip execution;
I. Basic CONCEPTS
The bootloader for Linux can be divided into four levels:
1.firmware+bootloader
Using the firmware and bootloader two parts of the Bootrom way, in the Marvell platform, the CPU is integrated with the Bootrom chip, essentially the NAND flash,cpu in the power-up process, first execute the program in the firmware, and then execute the boot code. Since the code in the firmware has already initialized the serial port, we do not need to take into account the initialization of the serial port in our development boot.
2.linux Kernel parameter passing
Not only Linux,vxworks, the image parameter is mainly passed through the bootloader, or the system default, in our system, is to use bootloader to set the parameters, to the image to pass the fixed data structure address, When the image is started, it can get the parameters and start as intended.
3. File system
Mainly based on flash and other memory devices, including the Linux runtime used by the application, library, such as to the development of the shell, dynamic Link program.
4. User applications
stored in the file system, for example, a graphical interface, such as Minigui, is always placed in the file system and the kernel.
Linux Common partitions:
bootloader + boot parameter + Linux kernel + boot filesystem
Two. Boot Common boot phase
In our product, we first set the CPU status register Kx,sx,ux, then read the core, decide to go to different branches, then read the different chip versions, decide to walk different branches, and distinguish between soft and hard reset, distinguish between different cores, initialize the corresponding TLB mappings, And based on the different cores, calculate the code snippets that each core needs to execute.
The function Board_init_f () is performed in Flash and is an important function.
Board_init_f () Call function in array of init_sequence[] function pointers defined in the LIB_MIPS/BOARD.C file
init_fnc_t *init_sequence[] = {
Octeon_boot_bus_init,----> Lib_mips/lib_octeon.c/octeon_boot_bus_init ()
Timer_init,----> Lib_mips/time.c/timer_init ()
Env_init,----> common/env_flash.c/env_init ()/*cfg_env_is_in_flash*/
Early_board_init,----> BOARD/OCTEON_EBT3000/OCTEON_EBT3000_BOARD.C
Init_baudrate,----> Lib_mips/board.c/init_baudrate ()
Serial_init,----> None
Console_init_f,----> Common/console.c/console_init_f ()
Display_banner,----> Lib_mips/board.c/display_banner ()
Init_dram,----> Lib_mips/board.c/init_dram ()
Checkboard,----> BOARD/OCTEON_EBT3000/OCTEON_EBT3000_BOARD.C
Init_func_ram,
Null
};
Bootrom START Process "Go"