summaryrefslogtreecommitdiffstats
path: root/arch/mips/lib/bootm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/lib/bootm.c')
-rw-r--r--arch/mips/lib/bootm.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index b71b8d5c38..86573dec7f 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
#include <boot.h>
#include <bootm.h>
#include <common.h>
@@ -14,12 +16,21 @@
static int do_bootm_barebox(struct image_data *data)
{
- void (*barebox)(void);
+ void (*barebox)(int, void *);
+ void *fdt = NULL;
barebox = read_file(data->os_file, NULL);
if (!barebox)
return -EINVAL;
+ if (data->oftree_file) {
+ fdt = bootm_get_devicetree(data);
+ if (IS_ERR(fdt)) {
+ pr_err("Failed to load dtb\n");
+ return PTR_ERR(fdt);
+ }
+ }
+
if (data->dryrun) {
free(barebox);
return 0;
@@ -27,7 +38,7 @@ static int do_bootm_barebox(struct image_data *data)
shutdown_barebox();
- barebox();
+ barebox(-2, fdt);
restart_machine();
}
@@ -55,25 +66,25 @@ static int do_bootm_elf(struct image_data *data)
fdt = bootm_get_devicetree(data);
if (IS_ERR(fdt)) {
- ret = PTR_ERR(fdt);
- goto bootm_free_fdt;
+ pr_err("Failed to load dtb\n");
+ return PTR_ERR(fdt);
}
- pr_info("Starting application at 0x%08lx, dts 0x%08lx...\n",
- phys_to_virt(data->os_address), data->of_root_node);
+ pr_info("Starting application at 0x%08lx, dts 0x%p...\n",
+ data->os_address, data->of_root_node);
if (data->dryrun)
goto bootm_free_fdt;
ret = of_overlay_load_firmware();
if (ret)
- return ret;
+ goto bootm_free_fdt;
shutdown_barebox();
entry = (void *) (unsigned long) data->os_address;
- entry(-2, phys_to_virt((unsigned long)fdt));
+ entry(-2, fdt);
pr_err("ELF application terminated\n");
ret = -EINVAL;