public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: Quirin Gylstorff <Quirin.Gylstorff@siemens.com>,
	isar-users@googlegroups.com, felix.moessbauer@siemens.com,
	cedric.hombourger@siemens.com
Subject: Re: [RFC PATCH v2 3/5] rootfs: Allow to overwrite the initramfs generation cmds
Date: Fri, 5 Sep 2025 17:10:39 +0200	[thread overview]
Message-ID: <2ef4019d-6731-41be-b936-fc56ff75f9c7@siemens.com> (raw)
In-Reply-To: <20250905142913.3336245-4-Quirin.Gylstorff@siemens.com>

On 05.09.25 16:28, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> This is in preparation to support additional initramfs generators
> like dracut.
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  meta/classes/rootfs.bbclass | 20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
> index 7b7859b9..70758cce 100644
> --- a/meta/classes/rootfs.bbclass
> +++ b/meta/classes/rootfs.bbclass
> @@ -5,7 +5,20 @@ inherit deb-dl-dir
>  
>  ROOTFS_ARCH ?= "${DISTRO_ARCH}"
>  ROOTFS_DISTRO ?= "${DISTRO}"
> +
> +def initramfs_generator_cmd(d):
> +    cmdline =  d.getVar('ROOTFS_INITRAMFS_GENERATOR_CMDLINE') or ''
> +    cmd = cmdline.split()
> +    if len(cmd):
> +        return cmd[0]
> +    return ''

Not needed, see below.

> +
> +def initramfs_generator_cmdline(d):
> +    return "update-initramfs -u -v -k \"$kernel_version\""
> +
>  ROOTFS_PACKAGES ?= ""
> +ROOTFS_INITRAMFS_GENERATOR_CMD ?= "${@ initramfs_generator_cmd(d)}"

"${@ d.getVar('ROOTFS_INITRAMFS_GENERATOR_CMDLINE').split()[0]]" that
variable is always defined and always contains at least one word.

Jan

> +ROOTFS_INITRAMFS_GENERATOR_CMDLINE ?= "${@ initramfs_generator_cmdline(d)}"
>  ROOTFS_BASE_DISTRO ?= "${BASE_DISTRO}"
>  
>  # Features of the rootfs creation:
> @@ -183,7 +196,7 @@ rootfs_disable_initrd_generation[weight] = "1"
>  rootfs_disable_initrd_generation() {
>      # fully disable initrd generation
>      sudo mkdir -p "${ROOTFSDIR}${ROOTFS_STUBS_DIR}"
> -    sudo cp -a ${ROOTFSDIR}/usr/bin/true ${ROOTFSDIR}${ROOTFS_STUBS_DIR}/update-initramfs
> +    sudo cp -a ${ROOTFSDIR}/usr/bin/true ${ROOTFSDIR}${ROOTFS_STUBS_DIR}/${ROOTFS_INITRAMFS_GENERATOR_CMD}
>  }
>  
>  ROOTFS_INSTALL_COMMAND += "rootfs_install_pkgs_update"
> @@ -485,11 +498,12 @@ rootfs_generate_initramfs() {
>              export kernel_version=$(basename /boot/vmlinu[xz]-* | cut -d'-' -f2-); \
>              echo "Total number of modules: $mods_total"; \
>              echo "Generating initrd for kernel version: $kernel_version"; \
> -            update-initramfs -u -v -k "$kernel_version";'
> +            ${ROOTFS_INITRAMFS_GENERATOR_CMDLINE};'
>          if [ -n "${INITRD_DEPLOY_FILE}" ]; then
>              if [ -f "${ROOTFSDIR}/initrd.img" ]; then
>                  # debian (mkinitramfs)
> -                cp ${ROOTFSDIR}/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE}
> +                sudo cp ${ROOTFSDIR}/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE}
> +                sudo chown $(id -u):$(id -g) ${DEPLOYDIR}/${INITRD_DEPLOY_FILE}
>              else
>                  # ubuntu (dracut)
>                  cp ${ROOTFSDIR}/boot/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE}


-- 
Siemens AG, Foundational Technologies
Linux Expert Center

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/2ef4019d-6731-41be-b936-fc56ff75f9c7%40siemens.com.

  reply	other threads:[~2025-09-05 15:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-05 14:28 [RFC PATCH v2 0/5] Add support for dracut 'Quirin Gylstorff' via isar-users
2025-09-05 14:28 ` [RFC PATCH v2 1/5] enable-fsck: remove dependency to initramfs-tools 'Quirin Gylstorff' via isar-users
2025-09-05 14:52   ` 'Jan Kiszka' via isar-users
2025-09-05 14:28 ` [RFC PATCH v2 2/5] add dracut to custom kernel builds 'Quirin Gylstorff' via isar-users
2025-09-05 14:28 ` [RFC PATCH v2 3/5] rootfs: Allow to overwrite the initramfs generation cmds 'Quirin Gylstorff' via isar-users
2025-09-05 15:10   ` 'Jan Kiszka' via isar-users [this message]
2025-09-05 14:28 ` [RFC PATCH v2 4/5] rootfs Add dracut to initramfs generator 'Quirin Gylstorff' via isar-users
2025-09-05 14:28 ` [RFC PATCH v2 5/5] initramfs: allow to set the generator command 'Quirin Gylstorff' via isar-users

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=2ef4019d-6731-41be-b936-fc56ff75f9c7@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=Quirin.Gylstorff@siemens.com \
    --cc=cedric.hombourger@siemens.com \
    --cc=felix.moessbauer@siemens.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