2 Try to load an EFI-stubbed ARM Linux kernel from QEMU's fw_cfg.
4 This implementation differs from OvmfPkg/Library/LoadLinuxLib. An EFI
5 stub in the subject kernel is a hard requirement here.
7 Copyright (C) 2014-2016, Red Hat, Inc.
9 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #include <Library/QemuLoadImageLib.h>
13 #include <Library/ReportStatusCodeLib.h>
15 #include "PlatformBm.h"
18 // The entry point of the feature.
22 Download the kernel, the initial ramdisk, and the kernel command line from
23 QEMU's fw_cfg. Construct a minimal SimpleFileSystem that contains the two
24 image files, and load and start the kernel from it.
26 The kernel will be instructed via its command line to load the initrd from
27 the same Simple FileSystem.
29 @retval EFI_NOT_FOUND Kernel image was not found.
30 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
31 @retval EFI_PROTOCOL_ERROR Unterminated kernel command line.
33 @return Error codes from any of the underlying
34 functions. On success, the function doesn't
39 TryRunningQemuKernel (
44 EFI_HANDLE KernelImageHandle
;
46 Status
= QemuLoadKernelImage (&KernelImageHandle
);
47 if (EFI_ERROR (Status
)) {
52 // Signal the EFI_EVENT_GROUP_READY_TO_BOOT event.
54 EfiSignalEventReadyToBoot ();
58 (EFI_SOFTWARE_DXE_BS_DRIVER
| EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT
)
64 Status
= QemuStartKernelImage (&KernelImageHandle
);
65 if (EFI_ERROR (Status
)) {
68 "%a: QemuStartKernelImage(): %r\n",
74 QemuUnloadKernelImage (KernelImageHandle
);