First, take a look of setup_arch() -> setup_machine_fdt()
179 static void __init setup_machine_fdt(phys_addr_t dt_phys) 180 { 181 void *dt_virt = fixmap_remap_fdt(dt_phys); 182 183 if (!dt_virt || !early_init_dt_scan(dt_virt)) { 184 pr_crit("\n" 185 "Error: invalid device tree blob at physical address %pa (virtual address 0x%p)\n" 186 "The dtb must be 8-byte aligned and must not exceed 2 MB in size\n" 187 "\nPlease check your bootloader.", 188 &dt_phys, dt_virt); 189 190 while (true) 191 cpu_relax(); 192 } 193 194 dump_stack_set_arch_desc("%s (DT)", of_flat_dt_get_machine_name()); 195 }
2. early_init_dt_scan(dt_virt): 為之後的DTB scan 做準備, 並進行參數傳遞
3. dump_stack_set_arch_desc(): 印出hardware name, 並把stack dump出來
第一個of_scan_flat_dt: scan /chosen node, save bootargs to boot_command_line, 還處理initrd相關的property, 存到initrd_start, initrd_end這兩個global variables中
由 2 進一步從early_init_dt_scan -> early_init_dt_scan_nodes() 看
1212 void __init early_init_dt_scan_nodes(void) 1213 { 1214 /* Retrieve various information from the /chosen node */ 1215 of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); 1216 1217 /* Initialize {size,address}-cells info */ 1218 of_scan_flat_dt(early_init_dt_scan_root, NULL); 1219 1220 /* Setup memory, calling early_init_dt_add_memory_arch */ 1221 of_scan_flat_dt(early_init_dt_scan_memory, NULL); 1222 }
第二個of_scan_flat_dt: scan root node, 取得 {size, addr}-cells 的資訊, 並存到dt_root_size_cells 和 dt_root_addr_cells global variables中
第三個of_scan_flat_dt: scan DTB中的memory node, 並把相關的資訊存入meminfo, meminfo是global variable, 保存系統的memory相關的資訊
沒有留言:
張貼留言