public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] classes/initramfs: Print messages in case of a build error
@ 2023-05-12 12:33 Quirin Gylstorff
  2023-05-12 13:03 ` Jan Kiszka
  0 siblings, 1 reply; 2+ messages in thread
From: Quirin Gylstorff @ 2023-05-12 12:33 UTC (permalink / raw)
  To: isar-users, felix.moessbauer

From: kas <kas@example.com>

This patch eases the fault analysis in case of a broken
initramfs generation.

This prints the messages from 'update-initramfs' instead of:

```
Available versions:
Nothing to do, exiting.
ERROR: No initramfs was found after generation!
```

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/classes/initramfs.bbclass | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/meta/classes/initramfs.bbclass b/meta/classes/initramfs.bbclass
index b4c7d15e..817e97a3 100644
--- a/meta/classes/initramfs.bbclass
+++ b/meta/classes/initramfs.bbclass
@@ -43,11 +43,16 @@ do_generate_initramfs() {
         export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH}"
     fi
 
-    sudo -E chroot "${INITRAMFS_ROOTFS}" \
-        update-initramfs -u -v
+    sudo -E chroot "${INITRAMFS_ROOTFS}" sh -c '\
+        export kernel_version=$(basename /boot/vmlinux* | cut -d'-' -f2-); \
+        if [ -n "$kernel_version" ]; then \
+          update-initramfs -u -v -k "$kernel_version"; \
+        else \
+          update-initramfs -u -v ;  \
+        fi'
 
     if [ ! -e "${INITRAMFS_ROOTFS}/initrd.img" ]; then
-        die "No initramfs was found after generation!"
+        bberror "No initramfs was found after generation!"
     fi
     cp ${INITRAMFS_ROOTFS}/initrd.img ${DEPLOYDIR}/${INITRAMFS_IMAGE_NAME}
 }
-- 
2.39.2


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

* Re: [PATCH] classes/initramfs: Print messages in case of a build error
  2023-05-12 12:33 [PATCH] classes/initramfs: Print messages in case of a build error Quirin Gylstorff
@ 2023-05-12 13:03 ` Jan Kiszka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2023-05-12 13:03 UTC (permalink / raw)
  To: Quirin Gylstorff, isar-users, felix.moessbauer

On 12.05.23 14:33, 'Quirin Gylstorff' via isar-users wrote:
> From: kas <kas@example.com>
        ^^^^^^^^^^^^^^^^^^^^^

Jan

> 
> This patch eases the fault analysis in case of a broken
> initramfs generation.
> 
> This prints the messages from 'update-initramfs' instead of:
> 
> ```
> Available versions:
> Nothing to do, exiting.
> ERROR: No initramfs was found after generation!
> ```
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  meta/classes/initramfs.bbclass | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/classes/initramfs.bbclass b/meta/classes/initramfs.bbclass
> index b4c7d15e..817e97a3 100644
> --- a/meta/classes/initramfs.bbclass
> +++ b/meta/classes/initramfs.bbclass
> @@ -43,11 +43,16 @@ do_generate_initramfs() {
>          export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH}"
>      fi
>  
> -    sudo -E chroot "${INITRAMFS_ROOTFS}" \
> -        update-initramfs -u -v
> +    sudo -E chroot "${INITRAMFS_ROOTFS}" sh -c '\
> +        export kernel_version=$(basename /boot/vmlinux* | cut -d'-' -f2-); \
> +        if [ -n "$kernel_version" ]; then \
> +          update-initramfs -u -v -k "$kernel_version"; \
> +        else \
> +          update-initramfs -u -v ;  \
> +        fi'
>  
>      if [ ! -e "${INITRAMFS_ROOTFS}/initrd.img" ]; then
> -        die "No initramfs was found after generation!"
> +        bberror "No initramfs was found after generation!"
>      fi
>      cp ${INITRAMFS_ROOTFS}/initrd.img ${DEPLOYDIR}/${INITRAMFS_IMAGE_NAME}
>  }

-- 
Siemens AG, Technology
Competence Center Embedded Linux


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

end of thread, other threads:[~2023-05-12 13:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-12 12:33 [PATCH] classes/initramfs: Print messages in case of a build error Quirin Gylstorff
2023-05-12 13:03 ` Jan Kiszka

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