sandbox: Report host default-filename in native mode
When the --native flag is given, pretend to be running the host architecture rather than sandbox. Allow the same control for PXE too. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:

committed by
Heinrich Schuchardt

parent
9fd84a3e1f
commit
7506c15669
@@ -678,6 +678,21 @@ void efi_show_tables(struct efi_system_table *systab);
|
|||||||
*/
|
*/
|
||||||
const char *efi_get_basename(void);
|
const char *efi_get_basename(void);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SANDBOX
|
||||||
|
#include <asm/state.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline bool efi_use_host_arch(void)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_SANDBOX
|
||||||
|
struct sandbox_state *state = state_get_current();
|
||||||
|
|
||||||
|
return state->native;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* efi_get_pxe_arch() - Get the architecture value for PXE
|
* efi_get_pxe_arch() - Get the architecture value for PXE
|
||||||
*
|
*
|
||||||
|
@@ -23,27 +23,31 @@
|
|||||||
|
|
||||||
#undef BOOTEFI_NAME
|
#undef BOOTEFI_NAME
|
||||||
|
|
||||||
#ifdef CONFIG_SANDBOX
|
|
||||||
|
|
||||||
#if HOST_ARCH == HOST_ARCH_X86_64
|
#if HOST_ARCH == HOST_ARCH_X86_64
|
||||||
#define BOOTEFI_NAME "BOOTX64.EFI"
|
#define HOST_BOOTEFI_NAME "BOOTX64.EFI"
|
||||||
|
#define HOST_PXE_ARCH 0x6
|
||||||
#elif HOST_ARCH == HOST_ARCH_X86
|
#elif HOST_ARCH == HOST_ARCH_X86
|
||||||
#define BOOTEFI_NAME "BOOTIA32.EFI"
|
#define HOST_BOOTEFI_NAME "BOOTIA32.EFI"
|
||||||
|
#define HOST_PXE_ARCH 0x7
|
||||||
#elif HOST_ARCH == HOST_ARCH_AARCH64
|
#elif HOST_ARCH == HOST_ARCH_AARCH64
|
||||||
#define BOOTEFI_NAME "BOOTAA64.EFI"
|
#define HOST_BOOTEFI_NAME "BOOTAA64.EFI"
|
||||||
|
#define HOST_PXE_ARCH 0xb
|
||||||
#elif HOST_ARCH == HOST_ARCH_ARM
|
#elif HOST_ARCH == HOST_ARCH_ARM
|
||||||
#define BOOTEFI_NAME "BOOTARM.EFI"
|
#define HOST_BOOTEFI_NAME "BOOTARM.EFI"
|
||||||
|
#define HOST_PXE_ARCH 0xa
|
||||||
#elif HOST_ARCH == HOST_ARCH_RISCV32
|
#elif HOST_ARCH == HOST_ARCH_RISCV32
|
||||||
#define BOOTEFI_NAME "BOOTRISCV32.EFI"
|
#define HOST_BOOTEFI_NAME "BOOTRISCV32.EFI"
|
||||||
|
#define HOST_PXE_ARCH 0x19
|
||||||
#elif HOST_ARCH == HOST_ARCH_RISCV64
|
#elif HOST_ARCH == HOST_ARCH_RISCV64
|
||||||
#define BOOTEFI_NAME "BOOTRISCV64.EFI"
|
#define HOST_BOOTEFI_NAME "BOOTRISCV64.EFI"
|
||||||
|
#define HOST_PXE_ARCH 0x1b
|
||||||
#else
|
#else
|
||||||
#error Unsupported UEFI architecture
|
#error Unsupported Host architecture
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#if defined(CONFIG_SANDBOX)
|
||||||
|
#define BOOTEFI_NAME "BOOTSBOX.EFI"
|
||||||
#if defined(CONFIG_ARM64)
|
#elif defined(CONFIG_ARM64)
|
||||||
#define BOOTEFI_NAME "BOOTAA64.EFI"
|
#define BOOTEFI_NAME "BOOTAA64.EFI"
|
||||||
#elif defined(CONFIG_ARM)
|
#elif defined(CONFIG_ARM)
|
||||||
#define BOOTEFI_NAME "BOOTARM.EFI"
|
#define BOOTEFI_NAME "BOOTARM.EFI"
|
||||||
@@ -59,8 +63,6 @@
|
|||||||
#error Unsupported UEFI architecture
|
#error Unsupported UEFI architecture
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI_LOAD_FILE2_INITRD)
|
#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI_LOAD_FILE2_INITRD)
|
||||||
/* GUID used by Linux to identify the LoadFile2 protocol with the initrd */
|
/* GUID used by Linux to identify the LoadFile2 protocol with the initrd */
|
||||||
const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID;
|
const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID;
|
||||||
@@ -68,11 +70,14 @@ const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID;
|
|||||||
|
|
||||||
const char *efi_get_basename(void)
|
const char *efi_get_basename(void)
|
||||||
{
|
{
|
||||||
return BOOTEFI_NAME;
|
return efi_use_host_arch() ? HOST_BOOTEFI_NAME : BOOTEFI_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
int efi_get_pxe_arch(void)
|
int efi_get_pxe_arch(void)
|
||||||
{
|
{
|
||||||
|
if (efi_use_host_arch())
|
||||||
|
return HOST_PXE_ARCH;
|
||||||
|
|
||||||
/* http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml */
|
/* http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml */
|
||||||
if (IS_ENABLED(CONFIG_ARM64))
|
if (IS_ENABLED(CONFIG_ARM64))
|
||||||
return 0xb;
|
return 0xb;
|
||||||
|
Reference in New Issue
Block a user