public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] wic: Allow custom kernel image names
@ 2024-11-14 13:55 Anton Mikanovich
  2024-11-21  6:49 ` Uladzimir Bely
  0 siblings, 1 reply; 2+ messages in thread
From: Anton Mikanovich @ 2024-11-14 13:55 UTC (permalink / raw)
  To: isar-users; +Cc: Anton Mikanovich

Some targets can have custom kernel file names specified with
KERNEL_FILE variable. Take this value into account when trying to
autodetect boot files inside WIC plugins.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 meta/classes/imagetypes_wic.bbclass                       | 2 +-
 meta/scripts/lib/wic/plugins/isarpluginbase.py            | 8 ++++++--
 meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py   | 8 ++++++--
 .../scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py | 4 +++-
 4 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass
index 3b697cdd..38b5f0e1 100644
--- a/meta/classes/imagetypes_wic.bbclass
+++ b/meta/classes/imagetypes_wic.bbclass
@@ -107,7 +107,7 @@ WICVARS += "\
            ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH"
 
 # Isar specific vars used in our plugins
-WICVARS += "DISTRO DISTRO_ARCH"
+WICVARS += "DISTRO DISTRO_ARCH KERNEL_FILE"
 
 python do_rootfs_wicenv () {
     wicvars = d.getVar('WICVARS')
diff --git a/meta/scripts/lib/wic/plugins/isarpluginbase.py b/meta/scripts/lib/wic/plugins/isarpluginbase.py
index 99e552e0..76df733d 100644
--- a/meta/scripts/lib/wic/plugins/isarpluginbase.py
+++ b/meta/scripts/lib/wic/plugins/isarpluginbase.py
@@ -15,9 +15,13 @@ def isar_populate_boot_cmd(rootfs_dir, hdddir):
     # no not copy symlinks (ubuntu places them here) because targetfs is fat
     return "find %s/boot -type f -exec cp -a {} %s ;" % (rootfs_dir, hdddir)
 
-def isar_get_filenames(rootfs_dir):
+
+def isar_get_filenames(rootfs_dir, kernel_file=None):
     # figure out the real filename in /boot by following debian symlinks
-    for kernel_symlink in ["vmlinuz", "vmlinux" ]:
+    possible_kernel_files = ["vmlinuz", "vmlinux"]
+    if kernel_file:
+        possible_kernel_files.insert(0, kernel_file)
+    for kernel_symlink in possible_kernel_files:
         kernel_file_abs = os.path.join(rootfs_dir, kernel_symlink)
         if os.path.isfile(kernel_file_abs):
             break
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 079b70d6..50f4187d 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
@@ -108,7 +108,9 @@ class BootimgEFIPlugin(SourcePlugin):
             if label:
                 label_conf = "LABEL=%s" % label
 
-            kernel, initrd = isar_get_filenames(get_bitbake_var("IMAGE_ROOTFS"))
+            kernel, initrd = isar_get_filenames(
+                get_bitbake_var("IMAGE_ROOTFS"), get_bitbake_var("KERNEL_FILE")
+            )
             grubefi_conf += "linux /%s %s rootwait %s\n" \
                 % (kernel, label_conf, bootloader.append)
 
@@ -186,7 +188,9 @@ class BootimgEFIPlugin(SourcePlugin):
             title = source_params.get('title')
 
             temp_initrd = initrd
-            kernel, initrd = isar_get_filenames(get_bitbake_var("IMAGE_ROOTFS"))
+            kernel, initrd = isar_get_filenames(
+                get_bitbake_var("IMAGE_ROOTFS"), get_bitbake_var("KERNEL_FILE")
+            )
             if temp_initrd:
                 initrd = temp_initrd
 
diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
index 43f4bec4..d5040b72 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
@@ -134,7 +134,9 @@ class BootimgPcbiosIsarPlugin(SourcePlugin):
 
             kernel = "/vmlinuz"
 
-            kernel, initrd = isar_get_filenames(get_bitbake_var("IMAGE_ROOTFS"))
+            kernel, initrd = isar_get_filenames(
+                get_bitbake_var("IMAGE_ROOTFS"), get_bitbake_var("KERNEL_FILE")
+            )
 
             syslinux_conf += "KERNEL " + kernel + "\n"
 
-- 
2.34.1

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20241114135506.1467238-1-amikan%40ilbers.de.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-21  6:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-14 13:55 [PATCH] wic: Allow custom kernel image names Anton Mikanovich
2024-11-21  6:49 ` Uladzimir Bely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox