From aff0f38d5e702286cc2560c6b3f6a5fc24b7f557 Mon Sep 17 00:00:00 2001 From: Clement Leger Date: Fri, 12 Jun 2020 09:10:34 +0200 Subject: 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 Tested-by: Oleksij Rempel Signed-off-by: Sascha Hauer --- arch/mips/lib/bootm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'arch/mips') 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; -- cgit v1.2.3