[PATCH 16/16] efi: use an EFI variable to save the environment

Michael Olbrich m.olbrich at pengutronix.de
Fri Jul 17 12:22:49 PDT 2015


Signed-off-by: Michael Olbrich <m.olbrich at pengutronix.de>
---
 arch/efi/efi/efi.c | 5 +++++
 common/efi-guid.c  | 1 +
 include/efi.h      | 1 +
 3 files changed, 7 insertions(+)

diff --git a/arch/efi/efi/efi.c b/arch/efi/efi/efi.c
index 07a4d9d0fc57..d3f520f60f14 100644
--- a/arch/efi/efi/efi.c
+++ b/arch/efi/efi/efi.c
@@ -326,8 +326,13 @@ static void fixup_tables(void)
 
 static int efi_init(void)
 {
+	char *env;
+
 	defaultenv_append_directory(env_efi);
 
+	env = xasprintf("/efivars/barebox-env-%pUl", &efi_barebox_vendor_guid);
+	default_environment_path_set(env);
+
 	return 0;
 }
 device_initcall(efi_init);
diff --git a/common/efi-guid.c b/common/efi-guid.c
index f4ff7feadfe4..64f3b1f65fd3 100644
--- a/common/efi-guid.c
+++ b/common/efi-guid.c
@@ -9,6 +9,7 @@ efi_guid_t efi_unknown_device_guid = EFI_UNKNOWN_DEVICE_GUID;
 efi_guid_t efi_null_guid = EFI_NULL_GUID;
 efi_guid_t efi_global_variable_guid = EFI_GLOBAL_VARIABLE_GUID;
 efi_guid_t efi_block_io_protocol_guid = EFI_BLOCK_IO_PROTOCOL_GUID;
+efi_guid_t efi_barebox_vendor_guid = EFI_BAREBOX_VENDOR_GUID;
 efi_guid_t efi_systemd_vendor_guid = EFI_SYSTEMD_VENDOR_GUID;
 
 #define EFI_GUID_STRING(guid, short, long) do {	\
diff --git a/include/efi.h b/include/efi.h
index 5b0de119fb74..b2e965bae1d4 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -485,6 +485,7 @@ extern efi_guid_t efi_unknown_device_guid;
 extern efi_guid_t efi_null_guid;
 extern efi_guid_t efi_global_variable_guid;
 extern efi_guid_t efi_block_io_protocol_guid;
+extern efi_guid_t efi_barebox_vendor_guid;
 extern efi_guid_t efi_systemd_vendor_guid;
 
 #define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
-- 
2.1.4




More information about the barebox mailing list