summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/efi/efi/efi-image.c5
-rw-r--r--arch/efi/efi/efi.c16
-rw-r--r--common/efi-guid.c1
-rw-r--r--include/efi.h5
4 files changed, 27 insertions, 0 deletions
diff --git a/arch/efi/efi/efi-image.c b/arch/efi/efi/efi-image.c
index de9b277556..b6437f4078 100644
--- a/arch/efi/efi/efi-image.c
+++ b/arch/efi/efi/efi-image.c
@@ -17,6 +17,7 @@
*
*/
+#include <clock.h>
#include <common.h>
#include <linux/sizes.h>
#include <memory.h>
@@ -242,6 +243,10 @@ static int do_bootm_efi(struct image_data *data)
boot_header->ramdisk_image);
printf("...\n");
}
+
+ efi_set_variable_usec("LoaderTimeExecUSec", &efi_systemd_vendor_guid,
+ get_time_ns()/1000);
+
linux_efi_handover(handle, boot_header);
return 0;
diff --git a/arch/efi/efi/efi.c b/arch/efi/efi/efi.c
index b0e98f95b0..1f0deed577 100644
--- a/arch/efi/efi/efi.c
+++ b/arch/efi/efi/efi.c
@@ -340,6 +340,7 @@ efi_status_t efi_main(efi_handle_t image, efi_system_table_t *sys_table)
efi_physical_addr_t mem;
size_t memsize;
efi_status_t efiret;
+ char *uuid;
#ifdef DEBUG
sys_table->con_out->output_string(sys_table->con_out, L"barebox\n");
@@ -377,6 +378,21 @@ efi_status_t efi_main(efi_handle_t image, efi_system_table_t *sys_table)
mem_malloc_init((void *)mem, (void *)mem + memsize);
efi_clocksource_init();
+ efi_set_variable_usec("LoaderTimeInitUSec", &efi_systemd_vendor_guid,
+ get_time_ns()/1000);
+
+ uuid = device_path_to_partuuid(device_path_from_handle(
+ efi_loaded_image->device_handle));
+ if (uuid) {
+ wchar_t *uuid16 = xstrdup_char_to_wchar(uuid);
+ efi_set_variable("LoaderDevicePartUUID",
+ &efi_systemd_vendor_guid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS,
+ uuid16, (strlen(uuid)+1) * sizeof(wchar_t));
+ free(uuid);
+ free(uuid16);
+ }
start_barebox();
diff --git a/common/efi-guid.c b/common/efi-guid.c
index f6b0404105..f4ff7feadf 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_systemd_vendor_guid = EFI_SYSTEMD_VENDOR_GUID;
#define EFI_GUID_STRING(guid, short, long) do { \
if (!efi_guidcmp(guid, *g)) \
diff --git a/include/efi.h b/include/efi.h
index 830e0457dd..5b0de119fb 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -473,6 +473,10 @@ extern efi_runtime_services_t *RT;
#define EFI_BAREBOX_VENDOR_GUID \
EFI_GUID(0x5b91f69c, 0x8b88, 0x4a2b, 0x92, 0x69, 0x5f, 0x1d, 0x80, 0x2b, 0x51, 0x75)
+/* for systemd */
+#define EFI_SYSTEMD_VENDOR_GUID \
+ EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f)
+
extern efi_guid_t efi_file_info_id;
extern efi_guid_t efi_simple_file_system_protocol_guid;
extern efi_guid_t efi_device_path_protocol_guid;
@@ -481,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_systemd_vendor_guid;
#define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)