public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCHv3] wic/plugins: fix kernel version detection for bios
@ 2021-02-05 11:48 Henning Schild
  2021-02-05 14:45 ` Anton Mikanovich
  2021-02-10  9:19 ` Anton Mikanovich
  0 siblings, 2 replies; 6+ messages in thread
From: Henning Schild @ 2021-02-05 11:48 UTC (permalink / raw)
  To: isar-users; +Cc: Vijai Kumar K, Henning Schild

From: Henning Schild <henning.schild@siemens.com>

When building an image with legacy bios using wic, wic can fail to pick
up the initrd.

ERROR: _exec_cmd: install -m 0644 /build/tmp/work/debian-buster-amd64/bla-image-qemux86-64-wic-img/0.2-r0/rootfs/boot/initrd.img-4.19.0-1-amd64 /tmp/tmp.7x9N9Wo4wZ/bla-image-debian-buster-qemux86-64.wic/tmp.wic.r10macew/hdd/boot/initrd.img-4.19.0-1-amd64 returned '1' instead of 0
output: install: cannot stat '/build/tmp/work/debian-buster-amd64/bla-image-qemux86-64-wic-img/0.2-r0/rootfs/boot/initrd.img-4.19.0-1-amd64': No such file or directory

The mechanism used to "cut off the end" seems to cut off too much.

>>> "vmlinuz-4.19.0-14-amd64".strip('-' + 'amd64')
'vmlinuz-4.19.0-1'

But indeed we would hope for 'vmlinuz-4.19.0-14'. Seems that "even"
revision numbers trigger the problem, while "odd" works.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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 493615b481..ece08efa76 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
@@ -135,7 +135,7 @@ class BootimgPcbiosIsarPlugin(SourcePlugin):
             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.strip('-' + kernel_name).strip(kernel_file + '-')
+            kernel_version = kernel[len(kernel_file)+1:-(len(kernel_name)+1)]
             initrd = "initrd.img-%s-%s" % (kernel_version, kernel_name)
 
             syslinux_conf += "KERNEL " + kernel + "\n"
@@ -165,7 +165,7 @@ class BootimgPcbiosIsarPlugin(SourcePlugin):
         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.strip('-' + kernel_name).strip(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)
-- 
2.26.2


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

end of thread, other threads:[~2021-02-10  9:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05 11:48 [PATCHv3] wic/plugins: fix kernel version detection for bios Henning Schild
2021-02-05 14:45 ` Anton Mikanovich
2021-02-05 14:59   ` Baurzhan Ismagulov
2021-02-05 19:55     ` Henning Schild
2021-02-05 20:07       ` Henning Schild
2021-02-10  9:19 ` Anton Mikanovich

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