[v2] wic: bootimg-efi-isar: fix generating of grub.cfg for custom initrd

Message ID 20250110203041.662979-1-peter.czegledy@evosoft.com
State Under Review
Headers show
Series [v2] wic: bootimg-efi-isar: fix generating of grub.cfg for custom initrd | expand

Commit Message

peter.czegledy Jan. 10, 2025, 8:30 p.m. UTC
From: Peter Czegledy <peter.czegledy@evosoft.com>

Specifying the initrd location via WICs sourceparams initrd argument doesn't generate the initrd location properly in case of grub-efi loader.

This fixes that and unifies the custom initrd handling for grub-efi and systemd-boots.

Signed-off-by: Peter Czegledy <peter.czegledy@evosoft.com>
---
 .../lib/wic/plugins/source/bootimg-efi-isar.py       | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Patch

diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
index 50f4187d..78ae4fb2 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
@@ -108,9 +108,12 @@  class BootimgEFIPlugin(SourcePlugin):
             if label:
                 label_conf = "LABEL=%s" % label
 
-            kernel, initrd = isar_get_filenames(
+            kernel, default_initrd = isar_get_filenames(
                 get_bitbake_var("IMAGE_ROOTFS"), get_bitbake_var("KERNEL_FILE")
             )
+            if not initrd:
+                initrd = default_initrd
+
             grubefi_conf += "linux /%s %s rootwait %s\n" \
                 % (kernel, label_conf, bootloader.append)
 
@@ -187,12 +190,11 @@  class BootimgEFIPlugin(SourcePlugin):
 
             title = source_params.get('title')
 
-            temp_initrd = initrd
-            kernel, initrd = isar_get_filenames(
+            kernel, default_initrd = isar_get_filenames(
                 get_bitbake_var("IMAGE_ROOTFS"), get_bitbake_var("KERNEL_FILE")
             )
-            if temp_initrd:
-                initrd = temp_initrd
+            if not initrd:
+                initrd = default_initrd
 
             boot_conf = ""
             boot_conf += "title %s\n" % (title if title else "boot")