On Wed, Apr 22, 2020 at 01:21:18PM +0200, Clement Leger wrote: > This will allows elf loader to directly have an elf file available. Thus > filetype_elf bootm handlers will be able to use this elf file directly. > > Signed-off-by: Clement Leger <cleger@xxxxxxxxx> > --- > common/bootm.c | 27 +++++++++++++++++++++++++++ > include/bootm.h | 3 +++ > 2 files changed, 30 insertions(+) > > diff --git a/common/bootm.c b/common/bootm.c > index 366f31455..015d90f3c 100644 > --- a/common/bootm.c > +++ b/common/bootm.c > @@ -455,6 +455,8 @@ int bootm_get_os_size(struct image_data *data) > { > int ret; > > + if (data->elf) > + return data->elf->high_addr - data->elf->low_addr; > if (data->os) > return uimage_get_size(data->os, uimage_part_num(data->os_part)); > if (data->os_fit) > @@ -502,6 +504,20 @@ static int bootm_open_os_uimage(struct image_data *data) > return 0; > } > > +static int bootm_open_elf(struct image_data *data) > +{ > + > + data->elf = elf_open(data->os_file); > + if (IS_ERR(data->elf)) > + return PTR_ERR(data->elf); > + > + printf("Entry Point: %08llx\n", data->elf->entry); > + > + data->os_address = data->elf->entry; > + > + return 0; > +} > + This will give you linker errors when elf support is not compiled in. if (!IS_ENABLED(CONFIG_ELF)) return -ENOSYS; might be enough already, plus maybe an bootm kconfig option which explicitly selects CONFIG_ELF when desired. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox