From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH] wic: Allow custom kernel image names
Date: Thu, 14 Nov 2024 15:55:06 +0200 [thread overview]
Message-ID: <20241114135506.1467238-1-amikan@ilbers.de> (raw)
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.
next reply other threads:[~2024-11-14 13:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 13:55 Anton Mikanovich [this message]
2024-11-21 6:49 ` Uladzimir Bely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241114135506.1467238-1-amikan@ilbers.de \
--to=amikan@ilbers.de \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox