1.wiki百科上的booting关于移动设备的描述
Some modern CPUs and microcontrollers (for example, TI OMAP) or sometimes even DSPs may have boot ROM with boot code integrated directly into their silicon, so such a processor could perform quite a sophisticated boot sequence on its own and load boot programs from various sources like NAND flash, SD or MMC card and so on. It is hard to hardwire all the required logic for handling such devices, so an integrated boot ROM is used instead in such scenarios. Boot ROM usage enables more flexible boot sequences than hardwired logic could provide. For example, the boot ROM could try to perform boot from multiple boot sources. Also, a boot ROM is often able to load a boot loader or diagnostic program via serial interfaces like UART, SPI, USB and so on. This feature is often used for system recovery purposes when for some reasons usual boot software in non-volatile memory got erased, and it could also be used for initial non-volatile memory programming when there is clean non-volatile memory installed and hence no software available in the system yet.
Some embedded system designs may also include an intermediary boot sequence step in form of additional code that gets loaded into system RAM by the integrated boot ROM. Additional code loaded that way usually serves as a way for overcoming platform limitations, such as small amounts of RAM, so a dedicated primary boot loader, such asDas U-Boot, can be loaded as the next step in system's boot sequence. The additional code and boot sequence step are usually referred to as secondary program loader(SPL).
再看一下MT6253的启动顺序(摘自6253 datasheet)
2.UBOOT在启动第一阶段把自己拷贝到RAM运行,跳转到start_armboot,进入启动的第二个阶段。
start_armboot是启动流程的核心。里面有个重要的初始化数组
init_fnc_t *init_sequence[] = { cpu_init, /* basic cpu dependent setup */ dram_init, /* configure available RAM banks */ /* change the original init order */ board_init, /* basic board dependent setup */ interrupt_init, /* set up exceptions */ env_init, /* initialize environment */ init_baudrate, /* initialze baudrate settings */ serial_init, /* serial communications setup */ console_init_f, /* stage 1 init of console */ display_banner, /* say that we are here */ #if defined(CONFIG_DISPLAY_CPUINFO) print_cpuinfo, /* display cpu info (and speed) */ #endif #if defined(CONFIG_DISPLAY_BOARDINFO) checkboard, /* display board info */ #endif display_dram_config, NULL, };
.......
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) { if ((*init_fnc_ptr)() != 0) { hang (); } }
在它们执行完之后。
3.调用env_relocate ();初始化UBOOT环境变量,这个非常关键。调用函数进行默认环境变量初始化set_default_env();利用数组:
uchar default_environment[] = { #ifdef CONFIG_BOOTARGS "bootargs=" CONFIG_BOOTARGS "