From: Henning Schild <henning.schild@siemens.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: isar-users <isar-users@googlegroups.com>
Subject: Re: [PATCH] wic: bootimg-efi-isar: Add support for loading device tree files
Date: Mon, 11 Jul 2022 15:12:14 +0200 [thread overview]
Message-ID: <20220711151214.271e944a@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <b452326b-bbcc-514f-21e5-cdf99970b584@siemens.com>
Am Sun, 10 Jul 2022 22:51:44 +0200
schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> For device tree using systems, add support to set a custom devices
> tree during UEFI boot. This requires to copy the DTB file to the boot
> partition and to add the respective loader entries to the
> configuration files.
>
> Both grub and systemd-boot support only loading a specific device
> tree. Therefore refuse to work if DTB_FILES contains more than one
> entry.
>
> This has been tested with grub from bullseye and systemd from
> bullseye-backport. The latter is needed as only systemd 250 gained the
> required feature.
>
> Out of scope are overlays (only supported by systemd-boot) as well as
> unified kernel images (practically broken on non-x86 with current
> toolchains).
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> meta/classes/imagetypes_wic.bbclass | 2 +-
> .../wic/plugins/source/bootimg-efi-isar.py | 39
> +++++++++++++------ 2 files changed, 29 insertions(+), 12 deletions(-)
>
> diff --git a/meta/classes/imagetypes_wic.bbclass
> b/meta/classes/imagetypes_wic.bbclass index 61a74d4a..3a577f71 100644
> --- a/meta/classes/imagetypes_wic.bbclass
> +++ b/meta/classes/imagetypes_wic.bbclass
> @@ -106,7 +106,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 DTB_FILES"
>
> python do_rootfs_wicenv () {
> wicvars = d.getVar('WICVARS', True)
> 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
> a24e04f3..aff51e81 100644 ---
> a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py +++
> b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
This file is a fork from OE with very minimal non-functional changes to
make it into Isar. I am afraid that feature will have to make it via OE.
Henning
> @@ -58,13
> +58,12 @@ class BootimgEFIPlugin(SourcePlugin): raise
> WicError("configfile is specified but failed to " "get it from %s." %
> configfile)
> - initrd = source_params.get('initrd')
> + bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
> + if not bootimg_dir:
> + raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
>
> + initrd = source_params.get('initrd')
> if initrd:
> - bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
> - if not bootimg_dir:
> - raise WicError("Couldn't find DEPLOY_DIR_IMAGE,
> exiting") -
> initrds = initrd.split(';')
> for rd in initrds:
> cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir)
> @@ -72,6 +71,13 @@ class BootimgEFIPlugin(SourcePlugin):
> else:
> logger.debug("Ignoring missing initrd")
>
> + dtb_files = (get_bitbake_var("DTB_FILES") or '').split()
> + if dtb_files:
> + if len(dtb_files) > 1:
> + raise WicError("Only one DTB support in grub
> configuration, exiting")
> + cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb_files[0],
> hdddir)
> + exec_cmd(cp_cmd, True)
> +
> if not custom_cfg:
> # Create grub configuration using parameters from wks
> file bootloader = creator.ks.bootloader
> @@ -108,6 +114,9 @@ class BootimgEFIPlugin(SourcePlugin):
> grubefi_conf += " /%s" % rd
> grubefi_conf += "\n"
>
> + if dtb_files:
> + grubefi_conf += "devicetree /%s\n" % dtb_files[0]
> +
> grubefi_conf += "}\n"
>
> logger.debug("Writing grubefi config
> %s/hdd/boot/EFI/BOOT/grub.cfg", @@ -134,14 +143,12 @@ class
> BootimgEFIPlugin(SourcePlugin): loader_conf += "default boot\n"
> loader_conf += "timeout %d\n" % bootloader.timeout
>
> - initrd = source_params.get('initrd')
> + bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
> + if not bootimg_dir:
> + raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
>
> + initrd = source_params.get('initrd')
> if initrd and
> source_params.get('create-unified-kernel-image') != "true":
> - # obviously we need to have a common common deploy var
> - bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
> - if not bootimg_dir:
> - raise WicError("Couldn't find DEPLOY_DIR_IMAGE,
> exiting") -
> initrds = initrd.split(';')
> for rd in initrds:
> cp_cmd = "cp %s/%s %s" % (bootimg_dir, rd, hdddir)
> @@ -149,6 +156,13 @@ class BootimgEFIPlugin(SourcePlugin):
> else:
> logger.debug("Ignoring missing initrd")
>
> + dtb_files = (get_bitbake_var("DTB_FILES") or '').split()
> + if dtb_files:
> + if len(dtb_files) > 1:
> + raise WicError("Only one DTB support in grub
> configuration, exiting")
> + cp_cmd = "cp %s/%s %s" % (bootimg_dir, dtb_files[0],
> hdddir)
> + exec_cmd(cp_cmd, True)
> +
> logger.debug("Writing systemd-boot config "
> "%s/hdd/boot/loader/loader.conf", cr_workdir)
> cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir,
> "w") @@ -197,6 +211,9 @@ class BootimgEFIPlugin(SourcePlugin):
> for rd in initrds:
> boot_conf += "initrd /%s\n" % rd
>
> + if dtb_files:
> + boot_conf += "devicetree /%s\n" % dtb_files[0]
> +
> if source_params.get('create-unified-kernel-image') !=
> "true": logger.debug("Writing systemd-boot config "
> "%s/hdd/boot/loader/entries/boot.conf",
> cr_workdir)
next prev parent reply other threads:[~2022-07-11 13:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-10 20:51 Jan Kiszka
2022-07-11 13:12 ` Henning Schild [this message]
2022-07-11 15:14 ` Jan Kiszka
2022-07-11 16:12 ` Henning Schild
2022-07-11 16:31 ` Jan Kiszka
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=20220711151214.271e944a@md1za8fc.ad001.siemens.net \
--to=henning.schild@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