public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: Florian Bezdeka <florian.bezdeka@siemens.com>
Cc: <isar-users@googlegroups.com>, <jan.kiszka@siemens.com>
Subject: Re: [PATCH] Enable pcbios wic plugin to work with custom kernels
Date: Tue, 27 Apr 2021 11:27:56 +0200	[thread overview]
Message-ID: <20210427112756.141aad68@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <20210423092846.274536-1-florian.bezdeka@siemens.com>

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
>  


  reply	other threads:[~2021-04-27  9:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23  9:28 Florian Bezdeka
2021-04-27  9:27 ` Henning Schild [this message]
2021-05-07 11:10 ` Anton Mikanovich

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=20210427112756.141aad68@md1za8fc.ad001.siemens.net \
    --to=henning.schild@siemens.com \
    --cc=florian.bezdeka@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.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