public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] Generate initrd for all installed kernels
@ 2025-08-28  6:17 Anton Mikanovich
  2025-08-29  7:29 ` 'MOESSBAUER, Felix' via isar-users
  0 siblings, 1 reply; 2+ messages in thread
From: Anton Mikanovich @ 2025-08-28  6:17 UTC (permalink / raw)
  To: isar-users; +Cc: Anton Mikanovich

Since commit 2f27a20f, we support multiple kernels on target.

Generate initrd for all of them instead of some random choice.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 meta/classes/rootfs.bbclass | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 7b7859b9..ebe3bf4a 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -481,11 +481,13 @@ rootfs_generate_initramfs[progress] = "custom:rootfs_progress.InitrdProgressHand
 rootfs_generate_initramfs() {
     if [ -n "$(sudo find '${ROOTFSDIR}/boot' -type f -name 'vmlinu[xz]*')" ]; then
         sudo -E chroot "${ROOTFSDIR}" sh -c '\
-            mods_total="$(find /usr/lib/modules -type f -name '*.ko*' | wc -l)"; \
-            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";'
+            for kernel in /boot/vmlinu[xz]-*; do \
+                export kernel_version=$(basename $kernel | cut -d'-' -f2-); \
+                mods_total="$(find /usr/lib/modules/$kernel_version -type f -name '*.ko*' | wc -l)"; \
+                echo "Total number of modules: $mods_total"; \
+                echo "Generating initrd for kernel version: $kernel_version"; \
+                update-initramfs -u -v -k "$kernel_version"; \
+            done;'
         if [ -n "${INITRD_DEPLOY_FILE}" ]; then
             if [ -f "${ROOTFSDIR}/initrd.img" ]; then
                 # debian (mkinitramfs)
-- 
2.34.1

-- 
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/20250828061733.3320270-1-amikan%40ilbers.de.

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

* Re: [PATCH] Generate initrd for all installed kernels
  2025-08-28  6:17 [PATCH] Generate initrd for all installed kernels Anton Mikanovich
@ 2025-08-29  7:29 ` 'MOESSBAUER, Felix' via isar-users
  0 siblings, 0 replies; 2+ messages in thread
From: 'MOESSBAUER, Felix' via isar-users @ 2025-08-29  7:29 UTC (permalink / raw)
  To: amikan, isar-users

On Thu, 2025-08-28 at 09:17 +0300, Anton Mikanovich wrote:
> Since commit 2f27a20f, we support multiple kernels on target.
> 
> Generate initrd for all of them instead of some random choice.

Reviewed-by: Felix Moessbauer <felix.moessbauer@siemens.com>

Felix

> 
> Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
> ---
>  meta/classes/rootfs.bbclass | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/meta/classes/rootfs.bbclass
> b/meta/classes/rootfs.bbclass
> index 7b7859b9..ebe3bf4a 100644
> --- a/meta/classes/rootfs.bbclass
> +++ b/meta/classes/rootfs.bbclass
> @@ -481,11 +481,13 @@ rootfs_generate_initramfs[progress] =
> "custom:rootfs_progress.InitrdProgressHand
>  rootfs_generate_initramfs() {
>      if [ -n "$(sudo find '${ROOTFSDIR}/boot' -type f -name
> 'vmlinu[xz]*')" ]; then
>          sudo -E chroot "${ROOTFSDIR}" sh -c '\
> -            mods_total="$(find /usr/lib/modules -type f -name
> '*.ko*' | wc -l)"; \
> -            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";'
> +            for kernel in /boot/vmlinu[xz]-*; do \
> +                export kernel_version=$(basename $kernel | cut -d'-'
> -f2-); \
> +                mods_total="$(find /usr/lib/modules/$kernel_version
> -type f -name '*.ko*' | wc -l)"; \
> +                echo "Total number of modules: $mods_total"; \
> +                echo "Generating initrd for kernel version:
> $kernel_version"; \
> +                update-initramfs -u -v -k "$kernel_version"; \
> +            done;'
>          if [ -n "${INITRD_DEPLOY_FILE}" ]; then
>              if [ -f "${ROOTFSDIR}/initrd.img" ]; then
>                  # debian (mkinitramfs)
> -- 
> 2.34.1

-- 
Siemens AG
Linux Expert Center
Friedrich-Ludwig-Bauer-Str. 3
85748 Garching, Germany

-- 
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/a6dcdbbdbc10c28f4e5413d21aff7f1a756e3e2b.camel%40siemens.com.

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

end of thread, other threads:[~2025-08-29  7:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-28  6:17 [PATCH] Generate initrd for all installed kernels Anton Mikanovich
2025-08-29  7:29 ` 'MOESSBAUER, Felix' via isar-users

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