summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2025-01-24 14:36:32 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-01-24 18:26:37 +0000
commit1f19c3d6eecd1d2854073527720c78aae931fc77 (patch)
tree6cec62ed695e9d1bbd28c79e67df6af4d1f8e67e
parentb873e8b8e3717880578dd2894bc85a5035363027 (diff)
downloadedk2-1f19c3d6eecd1d2854073527720c78aae931fc77.tar.gz
OvmfPkg/GenericQemuLoadImageLib: fix cmdline + initrd handling
Commit 459f5ffa24ae ("OvmfPkg/QemuKernelLoaderFsDxe: rework direct kernel boot filesystem") has a small change in behavior: In case there is no data the file is not created and attempts to open file return EFI_NOT_FOUND. Old behavior was to add a zero-length file to the filesystem. Fix GenericQemuLoadImageLib to handle EFI_NOT_FOUND correctly for 'initrd' and 'cmdline'. Reported-by: Srikanth Aithal <sraithal@amd.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.c b/OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.c
index 9d0ba77755..4087093864 100644
--- a/OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.c
+++ b/OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.c
@@ -294,7 +294,11 @@ QemuLoadKernelImage (
Status = GetQemuKernelLoaderBlobSize (Root, L"cmdline", &CommandLineSize);
if (EFI_ERROR (Status)) {
- goto CloseRoot;
+ if (Status == EFI_NOT_FOUND) {
+ CommandLineSize = 0;
+ } else {
+ goto CloseRoot;
+ }
}
if (CommandLineSize == 0) {
@@ -337,7 +341,11 @@ QemuLoadKernelImage (
Status = GetQemuKernelLoaderBlobSize (Root, L"initrd", &InitrdSize);
if (EFI_ERROR (Status)) {
- goto FreeCommandLine;
+ if (Status == EFI_NOT_FOUND) {
+ InitrdSize = 0;
+ } else {
+ goto FreeCommandLine;
+ }
}
if (InitrdSize > 0) {