summaryrefslogtreecommitdiffstats
path: root/arch/mips/lib
diff options
context:
space:
mode:
authorClement Leger <cleger@kalray.eu>2020-06-12 09:10:34 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-06-15 16:15:13 +0200
commitaff0f38d5e702286cc2560c6b3f6a5fc24b7f557 (patch)
tree3eac4080d1b7fa281c4e1f0feb3f6038893e2188 /arch/mips/lib
parent7a7cc824c7d748eb6b6821c2fcdb04074cede97b (diff)
downloadbarebox-aff0f38d5e702286cc2560c6b3f6a5fc24b7f557.tar.gz
barebox-aff0f38d5e702286cc2560c6b3f6a5fc24b7f557.tar.xz
common: elf: add elf_open, elf_close and elf_load
In order to integrate elf loading into bootm command, split elf opening from elf loading. Signed-off-by: Clement Leger <cleger@kalray.eu> Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/mips/lib')
-rw-r--r--arch/mips/lib/bootm.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index b07884ae02..8e16994b62 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -50,10 +50,14 @@ static int do_bootm_elf(struct image_data *data)
void *fdt;
int ret = 0;
- elf = elf_load_image(data->os_file);
+ elf = elf_open(data->os_file);
if (IS_ERR(elf))
return PTR_ERR(elf);
+ ret = elf_load(elf);
+ if (ret)
+ goto bootm_elf_done;
+
fdt = bootm_get_devicetree(data);
if (IS_ERR(fdt)) {
ret = PTR_ERR(fdt);
@@ -76,7 +80,7 @@ static int do_bootm_elf(struct image_data *data)
ret = -EINVAL;
bootm_elf_done:
- elf_release_image(elf);
+ elf_close(elf);
free(fdt);
return ret;