aboutsummaryrefslogtreecommitdiff
path: root/src/config
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2023-06-09 14:03:48 +0100
committerMichael Brown <mcb30@ipxe.org>2023-06-09 14:37:44 +0100
commit4fa4052c7ebb59e4d4aa396f1563c89118623ec7 (patch)
treee7a8c6faf2b93dcb0679cf63e195dda6d2e7b6e2 /src/config
parent25a3d3acabeec97c4a4cb8ed8fb90853e8a195c3 (diff)
downloadipxe-4fa4052c7ebb59e4d4aa396f1563c89118623ec7.zip
ipxe-4fa4052c7ebb59e4d4aa396f1563c89118623ec7.tar.gz
ipxe-4fa4052c7ebb59e4d4aa396f1563c89118623ec7.tar.bz2
[efi] Provide read-only access to EFI variables via settings mechanism
EFI variables do not map neatly to the iPXE settings mechanism, since the EFI variable identifier includes a namespace GUID that cannot cleanly be supplied as part of a setting name. Creating a new EFI variable requires the variable's attributes to be specified, which does not fit within iPXE's settings concept. However, EFI variable names are generally unique even without the namespace GUID, and EFI does provide a mechanism to iterate over all existent variables. We can therefore provide read-only access to EFI variables by comparing only the names and ignoring the namespace GUIDs. Provide an "efi" settings block that implements this mechanism using a syntax such as: echo Platform language is ${efi/PlatformLang:string} show efi/SecureBoot:int8 Settings are returned as raw binary values by default since an EFI variable may contain boolean flags, integer values, ASCII strings, UCS-2 strings, EFI device paths, X.509 certificates, or any other arbitrary blob of data. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/config')
-rw-r--r--src/config/config.c3
-rw-r--r--src/config/defaults/efi.h2
-rw-r--r--src/config/settings.h2
3 files changed, 7 insertions, 0 deletions
diff --git a/src/config/config.c b/src/config/config.c
index 40f9c72..abb7d16 100644
--- a/src/config/config.c
+++ b/src/config/config.c
@@ -355,6 +355,9 @@ REQUIRE_OBJECT ( vram_settings );
#ifdef ACPI_SETTINGS
REQUIRE_OBJECT ( acpi_settings );
#endif
+#ifdef EFI_SETTINGS
+REQUIRE_OBJECT ( efi_settings );
+#endif
/*
* Drag in selected keyboard map
diff --git a/src/config/defaults/efi.h b/src/config/defaults/efi.h
index 8e53b9a..cb9e234 100644
--- a/src/config/defaults/efi.h
+++ b/src/config/defaults/efi.h
@@ -48,6 +48,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define REBOOT_CMD /* Reboot command */
+#define EFI_SETTINGS /* EFI variable settings */
+
#if defined ( __i386__ ) || defined ( __x86_64__ )
#define IOAPI_X86
#define NAP_EFIX86
diff --git a/src/config/settings.h b/src/config/settings.h
index d9c86a3..d7f787d 100644
--- a/src/config/settings.h
+++ b/src/config/settings.h
@@ -9,6 +9,8 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+#include <config/defaults.h>
+
#define PCI_SETTINGS /* PCI device settings */
//#define CPUID_SETTINGS /* CPUID settings */
//#define MEMMAP_SETTINGS /* Memory map settings */