u-boot2011.09 u-boot.img 的流程跟蹤
阿新 • • 發佈:2018-02-01
sin command fde hat http tab offset main barrier
一、主要是start.S 裏面的 board_init_f 以及 board_init_r 函數分析,MLO與 u-boot.omg 的區別就在這裏
二、 MLO 加載完畢,他會重新回到 start.S 重新開始
三、 board_init_f 函數的實現在 arch/arm/lib/board.c 裏面
264 void board_init_f(ulong bootflag) 265 { 266 bd_t *bd; 267 init_fnc_t **init_fnc_ptr; 268 gd_t *id; 269 ulong addr, addr_sp; 270
接上函數指針數組 init_sequence
235 init_fnc_t *init_sequence[] = { 236 #if defined(CONFIG_ARCH_CPU_INIT) 237 arch_cpu_init, /* basic arch cpu dependent setup */ 238 #endif 239 #if defined(CONFIG_BOARD_EARLY_INIT_F) 240 board_early_init_f, 241 #endif 242 timer_init, /* initialize timer */ 243 #ifdef CONFIG_FSL_ESDHC 244 get_clocks, 245 #endif 246 env_init, /* initialize environment */ 247 init_baudrate, /* initialze baudrate settings */ 248 serial_init, /* serial communications setup */ 249 console_init_f, /* stage 1 init of console */ 250 display_banner, /* say that we are here */ 251 #if defined(CONFIG_DISPLAY_CPUINFO) 252 print_cpuinfo, /* display cpu info (and speed) */ 253 #endif 254 #if defined(CONFIG_DISPLAY_BOARDINFO) 255 checkboard, /* display board info */ 256 #endif 257 #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) 258 init_func_i2c, 259 #endif 260 dram_init, /* configure available RAM banks */ 261 NULL, 262 };
三、board_init_r 也在 arch/arm/lib/board.c
443 void board_init_r(gd_t *id, ulong dest_addr) 444 { 445 char *s; 446 bd_t *bd; 447 ulong malloc_start; 448 #if !defined(CONFIG_SYS_NO_FLASH) 449 ulong flash_size; 450 #endif 451 452 453 gd = id; 454 bd = gd->bd; 455 456 gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */ 457 458 monitor_flash_len = _end_ofs; 459 460 /* Enable caches */ 461 enable_caches(); 462 463 debug("monitor flash len: %08lX\n", monitor_flash_len); 464 board_init(); /* Setup chipselects */ 465 466 #ifdef CONFIG_SERIAL_MULTI 467 serial_initialize(); 468 469 #endif 81 /* The Malloc area is immediately below the monitor copy in DRAM */ 482 malloc_start = dest_addr - TOTAL_MALLOC_LEN; 483 mem_malloc_init (malloc_start, TOTAL_MALLOC_LEN); 484 485 stdio_init(); /* get the devices list going. */ 486 487 puts("zengjf :\n"); 523 #if defined(CONFIG_CMD_NAND) 524 puts("NAND : "); 525 nand_init(); /* go init the NAND */ 526 #endif // ... ... 531 532 #ifdef CONFIG_GENERIC_MMC 533 puts("MMC: "); 534 mmc_initialize(bd); 535 #endif // .. ... 559 560 console_init_r(); /* fully init console as a device */ 561 566 #if defined(CONFIG_MISC_INIT_R) 567 /* miscellaneous platform dependent initialisations */ 568 misc_init_r(); 569 #endif // ... ... 649 for (;;) { 650 main_loop(); 651 } 652 653 /* NOTREACHED - no way out of command loop except booting */ 654 }
u-boot 加載 kernel 參考:
http://www.cnblogs.com/chenfulin5/p/6937334.html
MLO 的流程參考:
http://www.cnblogs.com/chenfulin5/p/8398399.html
u-boot2011.09 u-boot.img 的流程跟蹤