summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib/bootm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/lib/bootm.c')
-rw-r--r--arch/arm/lib/bootm.c52
1 files changed, 19 insertions, 33 deletions
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 7bb9b43656..1913d5f97a 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -86,9 +86,11 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, int
}
}
- ret = bootm_load_initrd(data, initrd_start);
- if (ret)
- return ret;
+ if (bootm_has_initrd(data)) {
+ ret = bootm_load_initrd(data, initrd_start);
+ if (ret)
+ return ret;
+ }
if (data->initrd_res) {
initrd_start = data->initrd_res->start;
@@ -110,6 +112,9 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, int
printf("...\n");
}
+ if (data->dryrun)
+ return 0;
+
start_linux((void *)kernel, swap, initrd_start, initrd_size, data->oftree);
restart_machine();
@@ -135,7 +140,7 @@ static int do_bootm_linux(struct image_data *data)
* relocate itself before decompression.
*/
load_address = mem_start + PAGE_ALIGN(
- uimage_get_size(data->os, data->os_num) * 4);
+ bootm_get_os_size(data) * 4);
if (bootm_verbose(data))
printf("no OS load address, defaulting to 0x%08lx\n",
load_address);
@@ -223,6 +228,7 @@ static int do_bootz_linux_fdt(int fd, struct image_data *data)
ret = -EINVAL;
goto err_free;
}
+ free(oftree);
} else {
data->oftree = oftree;
}
@@ -354,37 +360,9 @@ static struct image_handler zimage_handler = {
.filetype = filetype_arm_zimage,
};
-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);
-
- restart_machine();
-}
-
static struct image_handler barebox_handler = {
.name = "ARM barebox",
- .bootm = do_bootm_barebox,
+ .bootm = do_bootm_linux,
.filetype = filetype_arm_barebox,
};
@@ -553,6 +531,12 @@ BAREBOX_MAGICVAR(aimage_noverwrite_bootargs, "Disable overwrite of the bootargs
BAREBOX_MAGICVAR(aimage_noverwrite_tags, "Disable overwrite of the tags addr with the one present in aimage");
#endif
+static struct image_handler arm_fit_handler = {
+ .name = "FIT image",
+ .bootm = do_bootm_linux,
+ .filetype = filetype_oftree,
+};
+
static struct binfmt_hook binfmt_aimage_hook = {
.type = filetype_aimage,
.exec = "bootm",
@@ -578,6 +562,8 @@ static int armlinux_register_image_handler(void)
register_image_handler(&aimage_handler);
binfmt_register(&binfmt_aimage_hook);
}
+ if (IS_BUILTIN(CONFIG_CMD_BOOTM_FITIMAGE))
+ register_image_handler(&arm_fit_handler);
binfmt_register(&binfmt_arm_zimage_hook);
binfmt_register(&binfmt_barebox_hook);