summaryrefslogtreecommitdiffstats
path: root/src/boot/efi/boot.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-11-16 14:53:42 +0100
committerGitHub <noreply@github.com>2022-11-16 14:53:42 +0100
commit45e99be3fb2af4b62eb5153a5f7c80fda90e41f3 (patch)
tree2854e54cb2ff2e417a2519f0dfe8d8022b7b8b76 /src/boot/efi/boot.c
parentMerge pull request #25393 from poettering/tpm2-override (diff)
parentsystemd-boot man page: add section for virtual machines (diff)
downloadsystemd-45e99be3fb2af4b62eb5153a5f7c80fda90e41f3.tar.xz
systemd-45e99be3fb2af4b62eb5153a5f7c80fda90e41f3.zip
Merge pull request #24855 from kraxel/qemu
better qemu support (handle direct kernel boot etc).
Diffstat (limited to 'src/boot/efi/boot.c')
-rw-r--r--src/boot/efi/boot.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c
index 84f4cc11a3..76023b14ca 100644
--- a/src/boot/efi/boot.c
+++ b/src/boot/efi/boot.c
@@ -16,6 +16,7 @@
#include "linux.h"
#include "measure.h"
#include "pe.h"
+#include "vmm.h"
#include "random-seed.h"
#include "secure-boot.h"
#include "shim.h"
@@ -2646,6 +2647,13 @@ static void config_load_all_entries(
config_default_entry_select(config);
}
+static EFI_STATUS discover_root_dir(EFI_LOADED_IMAGE_PROTOCOL *loaded_image, EFI_FILE **ret_dir) {
+ if (is_direct_boot(loaded_image->DeviceHandle))
+ return vmm_open(&loaded_image->DeviceHandle, ret_dir);
+ else
+ return open_volume(loaded_image->DeviceHandle, ret_dir);
+}
+
EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
EFI_LOADED_IMAGE_PROTOCOL *loaded_image;
_cleanup_(file_closep) EFI_FILE *root_dir = NULL;
@@ -2682,7 +2690,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
export_variables(loaded_image, loaded_image_path, init_usec);
- err = open_volume(loaded_image->DeviceHandle, &root_dir);
+ err = discover_root_dir(loaded_image, &root_dir);
if (err != EFI_SUCCESS)
return log_error_status_stall(err, L"Unable to open root directory: %r", err);