diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2018-06-06 08:07:27 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-06-15 08:33:20 +0200 |
commit | 9199e9cb082fff290cdac2d323458f17db2a9ad0 (patch) | |
tree | 7bba3f55d0699187abf169e4d4bd40c98518010b /arch/arm/lib64 | |
parent | ed13dd918d597afd5bcce30d4dce66174435af55 (diff) | |
download | barebox-9199e9cb082fff290cdac2d323458f17db2a9ad0.tar.gz barebox-9199e9cb082fff290cdac2d323458f17db2a9ad0.tar.xz |
bootm: Split bootm_load_devicetree into two functions
It is not always desired to get the devicetree from image data and load
it to a SDRAM region at the same time. Sometimes it's enough to just
load it to an allocated address (in case the user has no constraints
where the devicetree should be placed.
This patch splits bootm_load_devicetree into bootm_get_devicetree which
returns a pointer to the allocated devicetree and bootm_load_devicetree
which loads the devicetree to a specified region.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/lib64')
-rw-r--r-- | arch/arm/lib64/armlinux.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/arm/lib64/armlinux.c b/arch/arm/lib64/armlinux.c index 238e8b67a4..afa56792fb 100644 --- a/arch/arm/lib64/armlinux.c +++ b/arch/arm/lib64/armlinux.c @@ -38,6 +38,7 @@ static int do_bootm_linux(struct image_data *data) resource_size_t start, end; unsigned long text_offset, image_size, devicetree, kernel; int ret; + void *fdt; text_offset = le64_to_cpup(data->os_header + 8); image_size = le64_to_cpup(data->os_header + 16); @@ -54,7 +55,16 @@ static int do_bootm_linux(struct image_data *data) devicetree = ALIGN(kernel + image_size, PAGE_SIZE); - ret = bootm_load_devicetree(data, devicetree); + fdt = bootm_get_devicetree(data); + if (IS_ERR(fdt)) { + ret = PTR_ERR(fdt); + goto out; + } + + ret = bootm_load_devicetree(data, fdt, devicetree); + + free(fdt); + if (ret) goto out; |