| Message ID | 20251030094451.1303871-5-Quirin.Gylstorff@siemens.com |
|---|---|
| State | New |
| Headers | show |
| Series | Add support for dracut | expand |
On 10/30/25 10:44, 'Quirin Gylstorff' via isar-users wrote: > From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > > This allows to change the permissions of the initrd to 0644. And > all followup steps do not need sudo. > > This is necessary as dracut creates the initrd with 0600 permissions. > > Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > --- > meta/classes/rootfs.bbclass | 14 ++++---------- > 1 file changed, 4 insertions(+), 10 deletions(-) > > diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass > index 1f2ad80b..6b30744b 100644 > --- a/meta/classes/rootfs.bbclass > +++ b/meta/classes/rootfs.bbclass > @@ -594,17 +594,11 @@ rootfs_generate_initramfs() { > echo "Total number of modules: $mods_total" > echo "Generating initrd for kernel version: $kernel_version" > sudo -E chroot "${ROOTFSDIR}" sh -c ' \ > - ${ROOTFS_INITRAMFS_GENERATOR_CMDLINE};' > + ${ROOTFS_INITRAMFS_GENERATOR_CMDLINE}; \ > + find /boot -name "initrd.img-$kernel_version*" -exec install --mode 0644 {} /isar-work/initrd.img \; \ > + ' This patch does not change the behavior: - copy the last generated initrd to workdir The loop was added to support mulitple kernel installations with commit f6cd9f9ee. Quirin> done > - if [ -n "${INITRD_DEPLOY_FILE}" ]; then > - if [ -f "${ROOTFSDIR}/initrd.img" ]; then > - # debian (mkinitramfs) > - cp ${ROOTFSDIR}/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE} > - else > - # ubuntu (dracut) > - cp ${ROOTFSDIR}/boot/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE} > - fi > - fi > + install --owner $(id -u) --group $(id -g) ${WORKDIR}/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE} > else > echo "no kernel in this rootfs, do not generate initrd" > fi
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass index 1f2ad80b..6b30744b 100644 --- a/meta/classes/rootfs.bbclass +++ b/meta/classes/rootfs.bbclass @@ -594,17 +594,11 @@ rootfs_generate_initramfs() { echo "Total number of modules: $mods_total" echo "Generating initrd for kernel version: $kernel_version" sudo -E chroot "${ROOTFSDIR}" sh -c ' \ - ${ROOTFS_INITRAMFS_GENERATOR_CMDLINE};' + ${ROOTFS_INITRAMFS_GENERATOR_CMDLINE}; \ + find /boot -name "initrd.img-$kernel_version*" -exec install --mode 0644 {} /isar-work/initrd.img \; \ + ' done - if [ -n "${INITRD_DEPLOY_FILE}" ]; then - if [ -f "${ROOTFSDIR}/initrd.img" ]; then - # debian (mkinitramfs) - cp ${ROOTFSDIR}/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE} - else - # ubuntu (dracut) - cp ${ROOTFSDIR}/boot/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE} - fi - fi + install --owner $(id -u) --group $(id -g) ${WORKDIR}/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE} else echo "no kernel in this rootfs, do not generate initrd" fi