static int do_bootm_linux(struct image_data *data) { void (*kernel)(void *, void *, unsigned long, unsigned long, unsigned long); if (!data->os_res) return -EINVAL; data->oftree = of_get_fixed_tree(data->of_root_node); if (!data->oftree) { pr_err("bootm: No devicetree given.\n"); return -EINVAL; } fdt_add_reserve_map(data->oftree); kernel = (void *)(data->os_address + data->os_entry); /* * Linux Kernel Parameters (passing device tree): * r3: ptr to OF flat tree, followed by the board info data * r4: physical pointer to the kernel itself * r5: NULL * r6: NULL * r7: NULL */ kernel(data->oftree, kernel, 0, 0, 0); reset_cpu(0); /* not reached */ return -1; }
static int do_bootm_barebox(struct image_data *data) { void *barebox; barebox = read_file(data->os_file, NULL); if (!barebox) return -EINVAL; if (IS_ENABLED(CONFIG_OFTREE) && data->of_root_node) { data->oftree = of_get_fixed_tree(data->of_root_node); fdt_add_reserve_map(data->oftree); of_print_cmdline(data->of_root_node); if (bootm_verbose(data) > 1) of_print_nodes(data->of_root_node, 0); } if (bootm_verbose(data)) { printf("\nStarting barebox at 0x%p", barebox); if (data->oftree) printf(", oftree at 0x%p", data->oftree); printf("...\n"); } start_linux(barebox, 0, 0, 0, data->oftree); reset_cpu(0); }
static int do_bootm_linux(struct image_data *data) { void (*kernel)(void *, void *, unsigned long, unsigned long, unsigned long); int ret; ret = bootm_load_os(data, data->os_address); if (ret) return ret; data->oftree = of_get_fixed_tree(data->of_root_node); if (!data->oftree) { pr_err("bootm: No devicetree given.\n"); return -EINVAL; } /* Relocate the device tree if outside the initial * Linux mapped TLB. */ if (IS_ENABLED(CONFIG_MPC85xx)) { void *addr = data->oftree; if ((addr + data->oftree->totalsize) > LINUX_TLB1_MAX_ADDR) { addr = (void *)data->os_address; if (bootm_relocate_fdt(addr, data)) goto error; } } fdt_add_reserve_map(data->oftree); kernel = (void *)(data->os_address + data->os_entry); /* * Linux Kernel Parameters (passing device tree): * r3: ptr to OF flat tree, followed by the board info data * r4: physical pointer to the kernel itself * r5: NULL * r6: NULL * r7: NULL */ kernel(data->oftree, kernel, 0, 0, 0); restart_machine(); error: return -1; }
static int __do_bootm_linux(struct image_data *data, int swap) { unsigned long kernel; unsigned long initrd_start = 0, initrd_size = 0, initrd_end = 0; struct memory_bank *bank; unsigned long load_address; if (data->os_res) { load_address = data->os_res->start; } else if (data->os_address != UIMAGE_INVALID_ADDRESS) { load_address = data->os_address; } else { bank = list_first_entry(&memory_banks, struct memory_bank, list); load_address = bank->start + SZ_32K; if (bootm_verbose(data)) printf("no os load address, defaulting to 0x%08lx\n", load_address); } if (!data->os_res && data->os) { data->os_res = uimage_load_to_sdram(data->os, data->os_num, load_address); if (!data->os_res) return -ENOMEM; } if (!data->os_res) { data->os_res = file_to_sdram(data->os_file, load_address); if (!data->os_res) return -ENOMEM; } kernel = data->os_res->start + data->os_entry; initrd_start = data->initrd_address; if (data->initrd_file && initrd_start == UIMAGE_INVALID_ADDRESS) { initrd_start = data->os_res->start + SZ_8M; if (bootm_verbose(data)) { printf("no initrd load address, defaulting to 0x%08lx\n", initrd_start); } } if (data->initrd) { data->initrd_res = uimage_load_to_sdram(data->initrd, data->initrd_num, initrd_start); if (!data->initrd_res) return -ENOMEM; } else if (data->initrd_file) { data->initrd_res = file_to_sdram(data->initrd_file, initrd_start); if (!data->initrd_res) return -ENOMEM; } if (data->initrd_res) { initrd_start = data->initrd_res->start; initrd_end = data->initrd_res->end; initrd_size = resource_size(data->initrd_res); } if (IS_ENABLED(CONFIG_OFTREE) && data->of_root_node) { of_add_initrd(data->of_root_node, initrd_start, initrd_end); if (initrd_end) of_add_reserve_entry(initrd_start, initrd_end); data->oftree = of_get_fixed_tree(data->of_root_node); fdt_add_reserve_map(data->oftree); of_print_cmdline(data->of_root_node); if (bootm_verbose(data) > 1) of_print_nodes(data->of_root_node, 0); } if (bootm_verbose(data)) { printf("\nStarting kernel at 0x%08lx", kernel); if (initrd_size) printf(", initrd at 0x%08lx", initrd_start); if (data->oftree) printf(", oftree at 0x%p", data->oftree); printf("...\n"); } start_linux((void *)kernel, swap, initrd_start, initrd_size, data->oftree); reset_cpu(0); return -ERESTARTSYS; }