Skip to content

Commit

Permalink
Support --with-env-file-name
Browse files Browse the repository at this point in the history
Allow configuration to override the default ENV_FILE_NAME
and FAT_ENV_FILENAME to support scenarios with multiple
distributions or architectures.

For multiple distributions, https://wiki.debian.org/UEFI explains:

> Debian installs grub-efi for its EFI bootloader, as:
>
> Architecture Path
> amd64        \EFI\debian\grubx64.efi
> i386         \EFI\debian\grubia32.efi
> arm64        \EFI\debian\grubaa64.efi
> armhf        \EFI\debian\grubarm.efi

Other distributions use their own directories (eg \EFI\fedora, etc).

EFI Boot Guard (EBG) looks for a specific data file (normally BGENV.DAT)
which contains a single kernel configuration entry. Using the new
--with-env-file-name option, each distribution builds and configures
its own instance of EBG, which can find its corresponding
data file (eg BGENV-DEBIAN.DAT, or EFI\debian\BGENV.DAT, etc). This
also has the benefit of decoupling the distributions at boot so that
a breaking EBG change to one distribution will not affect another.

Signed-off-by: Earl Chew <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
  • Loading branch information
earlchew authored and jan-kiszka committed Apr 29, 2024
1 parent b9f2d03 commit 17c74ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 14 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@ AC_ARG_WITH([env-backend],

AC_SUBST([env_api_file], [${ENV_API_FILE}])

AC_ARG_WITH([env-file-name],
AS_HELP_STRING([--with-env-file-name=STRING],
[override the boot environment file name]),
[
ENV_FILE_NAME="$withval"
],
[ ENV_FILE_NAME="BGENV.DAT" ])

AC_DEFINE_UNQUOTED(
[ENV_FILE_NAME], [L"${ENV_FILE_NAME}"], [Boot environment file name])
AC_DEFINE_UNQUOTED(
[FAT_ENV_FILENAME], ["${ENV_FILE_NAME}"], [Boot environment FAT file name])

AC_ARG_WITH([boot-delay],
AS_HELP_STRING([--with-boot-delay=INT],
[specify the additional boot delay in seconds, defaults to 3]),
Expand Down Expand Up @@ -295,6 +308,7 @@ AC_MSG_RESULT([
efi libs: ${GNUEFI_LIB_DIR}
environment backend: ${ENV_API_FILE}.c
environment file name: ${ENV_FILE_NAME}
number of config parts: ${ENV_NUM_CONFIG_PARTS}
reserved for uservars: ${ENV_MEM_USERVARS} bytes
silent boot: ${silent_boot}
Expand Down
2 changes: 0 additions & 2 deletions include/envdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

#include <stdint.h>

#define ENV_FILE_NAME L"BGENV.DAT"
#define FAT_ENV_FILENAME "BGENV.DAT"
#define ENV_STRING_LENGTH 255

#define USTATE_OK 0
Expand Down

0 comments on commit 17c74ec

Please sign in to comment.