/* * arch/arm64/kernel/setup.c * By: start_kernel() */ void __init setup_arch(char **cmdline_p) { setup_processor(); setup_machine_fdt(__fdt_pointer); ...... } //arch/arm64/kernel/setup.c static void __init setup_machine_fdt(phys_addr_t dt_phys) { if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys))) { early_print("\n" "Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n" "The dtb must be 8-byte aligned and passed in the first 512MB of memory\n" "\nPlease check your bootloader.\n", dt_phys, phys_to_virt(dt_phys)); while (true) cpu_relax(); } machine_name = of_flat_dt_get_machine_name(); if (machine_name) { dump_stack_set_arch_desc("%s (DT)", machine_name); pr_info("Machine: %s\n", machine_name); } } //drivers/of/fdt.c bool __init early_init_dt_scan(void *params) { bool status; status = early_init_dt_verify(params); if (!status) return false; early_init_dt_scan_nodes(); return true; } //drivers/of/fdt.c void __init early_init_dt_scan_nodes(void) { /* Retrieve various information from the /chosen node */ of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); //获得command line,保存在全局变量boot_command_line中 /* Initialize {size,address}-cells info */ of_scan_flat_dt(early_init_dt_scan_root, NULL); /* Setup memory, calling early_init_dt_add_memory_arch */ of_scan_flat_dt(early_init_dt_scan_memory, NULL);
浙公网安备 33010602011771号