* [PATCH] Enable pcbios wic plugin to work with custom kernels
@ 2021-04-23 9:28 Florian Bezdeka
2021-04-27 9:27 ` Henning Schild
2021-05-07 11:10 ` Anton Mikanovich
0 siblings, 2 replies; 3+ messages in thread
From: Florian Bezdeka @ 2021-04-23 9:28 UTC (permalink / raw)
To: isar-users; +Cc: jan.kiszka, henning.schild, Florian Bezdeka
The plugin assumed that custom kernels always have a -${KERNEL_NAME}
suffix, but there is no guarantee for that. The suffix might be
something else or might not exist at all.
Instead of searching for and replacing KERNEL_NAME the information is
fetched from KERNEL_FILE by splitting at "-".
Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
meta/classes/wic-img.bbclass | 2 +-
.../wic/plugins/source/bootimg-pcbios-isar.py | 25 ++++++++++++-------
2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass
index 59dcd2b..5231c48 100644
--- a/meta/classes/wic-img.bbclass
+++ b/meta/classes/wic-img.bbclass
@@ -96,7 +96,7 @@ WICVARS += "\
BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD IMAGE_BASENAME IMAGE_BOOT_FILES \
IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR RECIPE_SYSROOT_NATIVE \
ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS TRANSLATED_TARGET_ARCH \
- KERNEL_NAME KERNEL_FILE"
+ KERNEL_FILE"
# Isar specific vars used in our plugins
WICVARS += "KERNEL_IMAGE INITRD_IMAGE DISTRO DISTRO_ARCH"
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 1ff8df1..2dc90bd 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
@@ -132,11 +132,14 @@ class BootimgPcbiosIsarPlugin(SourcePlugin):
syslinux_conf += "LABEL boot\n"
kernel_file = get_bitbake_var("KERNEL_FILE")
- kernel_name = get_bitbake_var("KERNEL_NAME")
rootfs_dir = get_bitbake_var("IMAGE_ROOTFS")
kernel = os.path.basename(os.path.realpath(os.path.join(rootfs_dir, kernel_file)))
- kernel_version = kernel[len(kernel_file)+1:-(len(kernel_name)+1)]
- initrd = "initrd.img-%s-%s" % (kernel_version, kernel_name)
+ kernel_parts = kernel.split("-")
+ kernel_suffix = "-".join(kernel_parts[1:])
+ initrd = "initrd.img"
+
+ if kernel_suffix:
+ initrd += "-%s" % kernel_suffix
syslinux_conf += "KERNEL " + kernel + "\n"
@@ -160,15 +163,19 @@ class BootimgPcbiosIsarPlugin(SourcePlugin):
"""
syslinux_dir = cls._get_syslinux_dir(bootimg_dir)
- staging_kernel_dir = kernel_dir
kernel_file = get_bitbake_var("KERNEL_FILE")
- kernel_name = get_bitbake_var("KERNEL_NAME")
rootfs_dir = rootfs_dir['ROOTFS_DIR']
kernel = os.path.basename(os.path.realpath(os.path.join(rootfs_dir, kernel_file)))
- kernel_version = kernel[len(kernel_file)+1:-(len(kernel_name)+1)]
- initrd = "initrd.img-%s-%s" % (kernel_version, kernel_name)
- config = "config-%s-%s" % (kernel_version, kernel_name)
- mapfile = "System.map-%s-%s" % (kernel_version, kernel_name)
+ kernel_parts = kernel.split("-")
+ kernel_suffix = "-".join(kernel_parts[1:])
+ initrd = "initrd.img"
+ config = "config"
+ mapfile = "System.map"
+
+ if kernel_suffix:
+ initrd += "-%s" % kernel_suffix
+ config += "-%s" % kernel_suffix
+ mapfile += "-%s" % kernel_suffix
hdddir = "%s/hdd/boot" % cr_workdir
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Enable pcbios wic plugin to work with custom kernels
2021-04-23 9:28 [PATCH] Enable pcbios wic plugin to work with custom kernels Florian Bezdeka
@ 2021-04-27 9:27 ` Henning Schild
2021-05-07 11:10 ` Anton Mikanovich
1 sibling, 0 replies; 3+ messages in thread
From: Henning Schild @ 2021-04-27 9:27 UTC (permalink / raw)
To: Florian Bezdeka; +Cc: isar-users, jan.kiszka
LGTM
Am Fri, 23 Apr 2021 11:28:46 +0200
schrieb Florian Bezdeka <florian.bezdeka@siemens.com>:
> The plugin assumed that custom kernels always have a -${KERNEL_NAME}
> suffix, but there is no guarantee for that. The suffix might be
> something else or might not exist at all.
>
> Instead of searching for and replacing KERNEL_NAME the information is
> fetched from KERNEL_FILE by splitting at "-".
>
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> ---
> meta/classes/wic-img.bbclass | 2 +-
> .../wic/plugins/source/bootimg-pcbios-isar.py | 25
> ++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/meta/classes/wic-img.bbclass
> b/meta/classes/wic-img.bbclass index 59dcd2b..5231c48 100644
> --- a/meta/classes/wic-img.bbclass
> +++ b/meta/classes/wic-img.bbclass
> @@ -96,7 +96,7 @@ WICVARS += "\
> BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD
> IMAGE_BASENAME IMAGE_BOOT_FILES \ IMAGE_LINK_NAME IMAGE_ROOTFS
> INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR RECIPE_SYSROOT_NATIVE \
> ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS
> TRANSLATED_TARGET_ARCH \
> - KERNEL_NAME KERNEL_FILE"
> + KERNEL_FILE"
>
> # Isar specific vars used in our plugins
> WICVARS += "KERNEL_IMAGE INITRD_IMAGE DISTRO DISTRO_ARCH"
> 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
> 1ff8df1..2dc90bd 100644 ---
> a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py +++
> b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py @@
> -132,11 +132,14 @@ class BootimgPcbiosIsarPlugin(SourcePlugin):
> syslinux_conf += "LABEL boot\n" kernel_file =
> get_bitbake_var("KERNEL_FILE")
> - kernel_name = get_bitbake_var("KERNEL_NAME")
> rootfs_dir = get_bitbake_var("IMAGE_ROOTFS")
> kernel =
> os.path.basename(os.path.realpath(os.path.join(rootfs_dir,
> kernel_file)))
> - kernel_version =
> kernel[len(kernel_file)+1:-(len(kernel_name)+1)]
> - initrd = "initrd.img-%s-%s" % (kernel_version,
> kernel_name)
> + kernel_parts = kernel.split("-")
> + kernel_suffix = "-".join(kernel_parts[1:])
> + initrd = "initrd.img"
> +
> + if kernel_suffix:
> + initrd += "-%s" % kernel_suffix
>
> syslinux_conf += "KERNEL " + kernel + "\n"
>
> @@ -160,15 +163,19 @@ class BootimgPcbiosIsarPlugin(SourcePlugin):
> """
> syslinux_dir = cls._get_syslinux_dir(bootimg_dir)
>
> - staging_kernel_dir = kernel_dir
> kernel_file = get_bitbake_var("KERNEL_FILE")
> - kernel_name = get_bitbake_var("KERNEL_NAME")
> rootfs_dir = rootfs_dir['ROOTFS_DIR']
> kernel =
> os.path.basename(os.path.realpath(os.path.join(rootfs_dir,
> kernel_file)))
> - kernel_version =
> kernel[len(kernel_file)+1:-(len(kernel_name)+1)]
> - initrd = "initrd.img-%s-%s" % (kernel_version, kernel_name)
> - config = "config-%s-%s" % (kernel_version, kernel_name)
> - mapfile = "System.map-%s-%s" % (kernel_version, kernel_name)
> + kernel_parts = kernel.split("-")
> + kernel_suffix = "-".join(kernel_parts[1:])
> + initrd = "initrd.img"
> + config = "config"
> + mapfile = "System.map"
> +
> + if kernel_suffix:
> + initrd += "-%s" % kernel_suffix
> + config += "-%s" % kernel_suffix
> + mapfile += "-%s" % kernel_suffix
>
> hdddir = "%s/hdd/boot" % cr_workdir
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Enable pcbios wic plugin to work with custom kernels
2021-04-23 9:28 [PATCH] Enable pcbios wic plugin to work with custom kernels Florian Bezdeka
2021-04-27 9:27 ` Henning Schild
@ 2021-05-07 11:10 ` Anton Mikanovich
1 sibling, 0 replies; 3+ messages in thread
From: Anton Mikanovich @ 2021-05-07 11:10 UTC (permalink / raw)
To: Florian Bezdeka, isar-users; +Cc: jan.kiszka, henning.schild
23.04.2021 12:28, Florian Bezdeka wrote:
> The plugin assumed that custom kernels always have a -${KERNEL_NAME}
> suffix, but there is no guarantee for that. The suffix might be
> something else or might not exist at all.
>
> Instead of searching for and replacing KERNEL_NAME the information is
> fetched from KERNEL_FILE by splitting at "-".
>
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
Applied to next, thanks.
--
Anton Mikanovich
Promwad Ltd.
External service provider of ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn, Germany
+49 (89) 122 67 24-0
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-07 11:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 9:28 [PATCH] Enable pcbios wic plugin to work with custom kernels Florian Bezdeka
2021-04-27 9:27 ` Henning Schild
2021-05-07 11:10 ` Anton Mikanovich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox