
Hi Maxim,
On 4/10/24 23:21, Maxim Moskalets wrote:
From: Maxim Moskalets maximmosk4@gmail.com
Some operating systems (e.g. seL4) and embedded applications are ELF images. It is convenient to use FIT-images to implement trusted boot. Added "elf" image type for booting using bootm command.
Signed-off-by: Maxim Moskalets maximmosk4@gmail.com
boot/bootm_os.c | 24 ++++++++++++++++++++++++ boot/image-fit.c | 3 ++- boot/image.c | 3 +++ include/image.h | 1 + 4 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/boot/bootm_os.c b/boot/bootm_os.c index ccde72d22c..1c92b8149c 100644 --- a/boot/bootm_os.c +++ b/boot/bootm_os.c @@ -395,6 +395,27 @@ static int do_bootm_qnxelf(int flag, struct bootm_info *bmi) } #endif
+#if defined(CONFIG_CMD_ELF) +static int do_bootm_elf(int flag, struct bootm_info *bmi) +{
- struct bootm_headers *images = bmi->images;
- char *local_args[2] = {NULL};
- char str[19] = ""; /* "0x" + 16 digits + "\0" */
- if (flag != BOOTM_STATE_OS_GO)
return 0;
- sprintf(str, "0x%lx", images->ep); /* write entry-point into string */
- str[18] = '\0';
This does seem like snprintf would be useful here?
""" snprintf(str, 19, "0x%lx", images-ep); """
safest and also merges the two instructions in one.
Also, have another question, do we want to 0-left-pad the value so that it's always a 16 hex-digit number?
e.g. 0x%016lx
Cheers, Quentin