mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-30 08:07:59 +00:00
cmd: bootm: add ELF file support
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>
This commit is contained in:
parent
6074f6e857
commit
2abf14df5d
5 changed files with 32 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include <bootstage.h>
|
#include <bootstage.h>
|
||||||
#include <cpu_func.h>
|
#include <cpu_func.h>
|
||||||
#include <efi_loader.h>
|
#include <efi_loader.h>
|
||||||
|
#include <elf.h>
|
||||||
#include <env.h>
|
#include <env.h>
|
||||||
#include <fdt_support.h>
|
#include <fdt_support.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
|
@ -394,6 +395,20 @@ static int do_bootm_qnxelf(int flag, struct bootm_info *bmi)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_BOOTM_ELF)
|
||||||
|
static int do_bootm_elf(int flag, struct bootm_info *bmi)
|
||||||
|
{
|
||||||
|
Bootelf_flags flags = { .autostart = 1 };
|
||||||
|
|
||||||
|
if (flag != BOOTM_STATE_OS_GO)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
bootelf(bmi->images->ep, flags, 0, NULL);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_INTEGRITY
|
#ifdef CONFIG_INTEGRITY
|
||||||
static int do_bootm_integrity(int flag, struct bootm_info *bmi)
|
static int do_bootm_integrity(int flag, struct bootm_info *bmi)
|
||||||
{
|
{
|
||||||
|
@ -535,6 +550,9 @@ static boot_os_fn *boot_os[] = {
|
||||||
#ifdef CONFIG_BOOTM_EFI
|
#ifdef CONFIG_BOOTM_EFI
|
||||||
[IH_OS_EFI] = do_bootm_efi,
|
[IH_OS_EFI] = do_bootm_efi,
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(CONFIG_BOOTM_ELF)
|
||||||
|
[IH_OS_ELF] = do_bootm_elf,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Allow for arch specific config before we boot */
|
/* Allow for arch specific config before we boot */
|
||||||
|
|
|
@ -2175,7 +2175,8 @@ int fit_image_load(struct bootm_headers *images, ulong addr,
|
||||||
fit_image_check_os(fit, noffset, IH_OS_TEE) ||
|
fit_image_check_os(fit, noffset, IH_OS_TEE) ||
|
||||||
fit_image_check_os(fit, noffset, IH_OS_OPENRTOS) ||
|
fit_image_check_os(fit, noffset, IH_OS_OPENRTOS) ||
|
||||||
fit_image_check_os(fit, noffset, IH_OS_EFI) ||
|
fit_image_check_os(fit, noffset, IH_OS_EFI) ||
|
||||||
fit_image_check_os(fit, noffset, IH_OS_VXWORKS);
|
fit_image_check_os(fit, noffset, IH_OS_VXWORKS) ||
|
||||||
|
fit_image_check_os(fit, noffset, IH_OS_ELF);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If either of the checks fail, we should report an error, but
|
* If either of the checks fail, we should report an error, but
|
||||||
|
|
|
@ -131,6 +131,9 @@ static const table_entry_t uimage_os[] = {
|
||||||
#endif
|
#endif
|
||||||
{ IH_OS_OPENSBI, "opensbi", "RISC-V OpenSBI", },
|
{ IH_OS_OPENSBI, "opensbi", "RISC-V OpenSBI", },
|
||||||
{ IH_OS_EFI, "efi", "EFI Firmware" },
|
{ IH_OS_EFI, "efi", "EFI Firmware" },
|
||||||
|
#ifdef CONFIG_BOOTM_ELF
|
||||||
|
{ IH_OS_ELF, "elf", "ELF Image" },
|
||||||
|
#endif
|
||||||
|
|
||||||
{ -1, "", "", },
|
{ -1, "", "", },
|
||||||
};
|
};
|
||||||
|
|
|
@ -321,6 +321,13 @@ config BOOTM_EFI
|
||||||
help
|
help
|
||||||
Support booting UEFI FIT images via the bootm command.
|
Support booting UEFI FIT images via the bootm command.
|
||||||
|
|
||||||
|
config BOOTM_ELF
|
||||||
|
bool "Support booting ELF images"
|
||||||
|
depends on CMD_BOOTM && LIB_ELF
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Support booting ELF images via the bootm command.
|
||||||
|
|
||||||
config CMD_BOOTZ
|
config CMD_BOOTZ
|
||||||
bool "bootz"
|
bool "bootz"
|
||||||
help
|
help
|
||||||
|
|
|
@ -100,6 +100,7 @@ enum {
|
||||||
IH_OS_TEE, /* Trusted Execution Environment */
|
IH_OS_TEE, /* Trusted Execution Environment */
|
||||||
IH_OS_OPENSBI, /* RISC-V OpenSBI */
|
IH_OS_OPENSBI, /* RISC-V OpenSBI */
|
||||||
IH_OS_EFI, /* EFI Firmware (e.g. GRUB2) */
|
IH_OS_EFI, /* EFI Firmware (e.g. GRUB2) */
|
||||||
|
IH_OS_ELF, /* ELF Image (e.g. seL4) */
|
||||||
|
|
||||||
IH_OS_COUNT,
|
IH_OS_COUNT,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue