diff options
| author | AKASHI Takahiro <[email protected]> | 2022-04-28 17:09:39 +0900 |
|---|---|---|
| committer | Heinrich Schuchardt <[email protected]> | 2022-05-03 21:39:22 +0200 |
| commit | 4e65ca00f3a30791752529fe9ffe8c02da104c62 (patch) | |
| tree | a6b7a708e4b173cccef316f55c15fc73a2c24e67 /include | |
| parent | d8465ffc019a742ae6c8770179f359317c5f101a (diff) | |
efi_loader: bootmgr: add booting from removable media
Under the current implementation, booting from removable media using
a architecture-specific default image name, say BOOTAA64.EFI, is
supported only in distro_bootcmd script. See the commit 74522c898b35
("efi_loader: Add distro boot script for removable media").
This is, however, half-baked implementation because
1) UEFI specification requires this feature to be implemented as part
of Boot Manager's responsibility:
3 - Boot Manager
3.5.1 Boot via the Simple File Protocol
When booting via the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, the FilePath will
start with a device path that points to the device that implements the
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL or the EFI_BLOCK_IO_PROTOCOL. The next
part of the FilePath may point to the file name, including
subdirectories, which contain the bootable image. If the file name is
a null device path, the file name must be generated from the rules
defined below.
...
3.5.1.1 Removable Media Boot Behavior
To generate a file name when none is present in the FilePath, the
firmware must append a default file name in the form
\EFI\BOOT\BOOT{machine type short-name}.EFI ...
2) So (1) entails the hehavior that the user's preference of boot media
order should be determined by Boot#### and BootOrder variables.
With this patch, the semantics mentioned above is fully implemented.
For example, if you want to boot the system from USB and SCSI in this
order,
* define Boot0001 which contains only a device path to the USB device
(without any file path/name)
* define Boot0002 which contains only a device path to the SCSI device,
and
* set BootOrder to Boot0001:Boot0002
To avoid build error for sandbox, default file name "BOOTSANDBOX.efi"
is defined even if it is out of scope of UEFI specification.
Signed-off-by: AKASHI Takahiro <[email protected]>
Signed-off-by: Masahisa Kojima <[email protected]>
On sandbox use binary name corresponding to host architecture.
Reviewed-by: Heinrich Schuchardt <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/efi_default_filename.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/efi_default_filename.h b/include/efi_default_filename.h new file mode 100644 index 00000000000..13b9de8754a --- /dev/null +++ b/include/efi_default_filename.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * When a boot option does not provide a file path the EFI file to be + * booted is \EFI\BOOT\$(BOOTEFI_NAME).EFI. The architecture specific + * file name is defined in this include. + * + * Copyright (c) 2022, Heinrich Schuchardt <[email protected]> + */ + +#ifndef _EFI_DEFAULT_FILENAME_H +#define _EFI_DEFAULT_FILENAME_H + +#include <host_arch.h> + +#undef BOOTEFI_NAME + +#if HOST_ARCH == HOST_ARCH_X86_64 +#define BOOTEFI_NAME "BOOTX64.EFI" +#endif + +#if HOST_ARCH == HOST_ARCH_X86 +#define BOOTEFI_NAME "BOOTIA32.EFI" +#endif + +#if HOST_ARCH == HOST_ARCH_AARCH64 +#define BOOTEFI_NAME "BOOTAA64.EFI" +#endif + +#if HOST_ARCH == HOST_ARCH_ARM +#define BOOTEFI_NAME "BOOTARM.EFI" +#endif + +#if HOST_ARCH == HOST_ARCH_RISCV32 +#define BOOTEFI_NAME "BOOTRISCV32.EFI" +#endif + +#if HOST_ARCH == HOST_ARCH_RISCV64 +#define BOOTEFI_NAME "BOOTRISCV64.EFI" +#endif + +#ifndef BOOTEFI_NAME +#error Unsupported UEFI architecture +#endif + +#endif |
