public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "Bezdeka, Florian" <florian.bezdeka@siemens.com>
To: "isar-users@googlegroups.com" <isar-users@googlegroups.com>,
	"henning.schild@siemens.com" <henning.schild@siemens.com>
Subject: Re: [PATCH 2/3] wic: apply the actual fork changes to our pcbios plugin fork
Date: Fri, 27 Aug 2021 07:35:24 +0000	[thread overview]
Message-ID: <10f3c8a58d43bd36f35c33755ea8c73b539f17c7.camel@siemens.com> (raw)
In-Reply-To: <20210826192827.2653-3-henning.schild@siemens.com>

On Thu, 2021-08-26 at 21:28 +0200, Henning Schild wrote:
> This aims to be a rather minimal one-commit fork to do isar specific
> changes to the forked class. It does things in a way that results in
> somehow strange code but pretty clean patching that aims to be easy to
> read and mostly about adding lines to get things done. The hope is that
> it will make maintaining the fork easier than before.
> 
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  .../wic/plugins/source/bootimg-pcbios-isar.py | 36 +++++++++++++++++--
>  1 file changed, 33 insertions(+), 3 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 f2639e700493..3a3a6f09392f 100644
> --- a/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
> +++ b/meta/scripts/lib/wic/plugins/source/bootimg-pcbios-isar.py
> @@ -4,7 +4,7 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>  #
>  # DESCRIPTION
> -# This implements the 'bootimg-pcbios' source plugin class for 'wic'
> +# This implements the 'bootimg-pcbios-isar' source plugin class for 'wic'
>  #
>  # AUTHORS
>  # Tom Zanussi <tom.zanussi (at] linux.intel.com>
> @@ -22,12 +22,12 @@ from wic.misc import (exec_cmd, exec_native_cmd,
>  
>  logger = logging.getLogger('wic')
>  
> -class BootimgPcbiosPlugin(SourcePlugin):
> +class BootimgPcbiosIsarPlugin(SourcePlugin):
>      """
>      Create MBR boot partition and install syslinux on it.
>      """
>  
> -    name = 'bootimg-pcbios'
> +    name = 'bootimg-pcbios-isar'
>  
>      @classmethod
>      def _get_bootimg_dir(cls, bootimg_dir, dirname):
> @@ -56,6 +56,10 @@ class BootimgPcbiosPlugin(SourcePlugin):
>          """
>          bootimg_dir = cls._get_bootimg_dir(bootimg_dir, 'syslinux')
>          mbrfile = "%s/syslinux/" % bootimg_dir
> +
> +        # files have different prefix in debian
> +        mbrfile += "mbr/"
> +
>          if creator.ptable_format == 'msdos':
>              mbrfile += "mbr.bin"
>          elif creator.ptable_format == 'gpt':
> @@ -123,11 +127,27 @@ class BootimgPcbiosPlugin(SourcePlugin):
>              syslinux_conf += "LABEL boot\n"
>  
>              kernel = "/vmlinuz"
> +
> +            # figure out the real filename in /boot/ by following debian symlinks
> +            kernel_file = get_bitbake_var("KERNEL_FILE")
> +            rootfs_dir = get_bitbake_var("IMAGE_ROOTFS")
> +            kernel = os.path.basename(os.path.realpath(os.path.join(rootfs_dir, kernel_file)))
> +
>              syslinux_conf += "KERNEL " + kernel + "\n"
>  
>              syslinux_conf += "APPEND label=boot root=%s %s\n" % \
>                               (creator.rootdev, bootloader.append)
>  
> +            # we are using an initrd, smuggle it in
> +            initrd = "initrd.img"
> +            kernel_parts = kernel.split("-")
> +            kernel_suffix = "-".join(kernel_parts[1:])
> +            if kernel_suffix:
> +                initrd += "-%s" % kernel_suffix

I guess I was the last one modifying this file... Just had a look at
upstream commit d3f1af4e2318a4420f4c7f23edd093f66891ca8b, which seems
partially reverted now.

I'm missing the part in do_prepare_partition, where the kernel_suffix
should be optional as well. Maybe I'm just missing / overlooking
something?

> +
> +            syslinux_conf = syslinux_conf.replace(" root=%s " % (creator.rootdev),
> +                                                  " root=%s initrd=%s " % (creator.rootdev, initrd))
> +
>          logger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg",
>                       cr_workdir)
>          cfg = open("%s/hdd/boot/syslinux.cfg" % cr_workdir, "w")
> @@ -166,7 +186,17 @@ class BootimgPcbiosPlugin(SourcePlugin):
>                  "install -m 444 %s/syslinux/libutil.c32 %s/libutil.c32" %
>                  (bootimg_dir, hdddir))
>  
> +        # install /boot from our debian rootfs completely
> +        cmds = cmds + ("cp -a %s/%s %s/.." % (rootfs_dir['ROOTFS_DIR'], "boot", hdddir),)
> +
>          for install_cmd in cmds:
> +            # skip the kernel install from OE parts, "cp -a" will bring our kernel
> +            if install_cmd == cmds[0]:
> +                continue
> +            # one file has a different suffix in debian
> +            install_cmd = install_cmd.replace("ldlinux.sys", "ldlinux.c32")
> +            # files have different prefix in debian
> +            install_cmd = install_cmd.replace("/syslinux/", "/syslinux/modules/bios/")
>              exec_cmd(install_cmd)
>  
>          du_cmd = "du -bks %s" % hdddir
> -- 
> 2.31.1
> 


  reply	other threads:[~2021-08-27  7:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26 19:28 [PATCH 0/3] re-fork wic pcbios plugin Henning Schild
2021-08-26 19:28 ` [PATCH 1/3] git: reset our fork to OE upstream for re-forking Henning Schild
2021-08-26 19:28 ` [PATCH 2/3] wic: apply the actual fork changes to our pcbios plugin fork Henning Schild
2021-08-27  7:35   ` Bezdeka, Florian [this message]
2021-08-27  9:32     ` Henning Schild
2021-08-26 19:28 ` [PATCH 3/3] wic: clean up wic class in terms of isar variables Henning Schild
2021-08-27  9:33   ` Henning Schild

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=10f3c8a58d43bd36f35c33755ea8c73b539f17c7.camel@siemens.com \
    --to=florian.bezdeka@siemens.com \
    --cc=henning.schild@siemens.com \
    --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