File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -91,11 +91,11 @@ main() {
9191 die " Cannot read ${INSTALLKERNEL_STAGING_AREA} /${out} "
9292 if [[ ${magic} == MZ ]]; then
9393 einfo " Combined UEFI kernel+initramfs executable found"
94- mv " ${INSTALLKERNEL_STAGING_AREA} /dracut-tmp " \
94+ mv " ${INSTALLKERNEL_STAGING_AREA} /${out} " \
9595 " ${INSTALLKERNEL_STAGING_AREA} /uki.efi" || die " Failed to rename UKI"
9696 else
9797 einfo " Plain initramfs image found"
98- mv " ${INSTALLKERNEL_STAGING_AREA} /dracut-tmp " \
98+ mv " ${INSTALLKERNEL_STAGING_AREA} /${out} " \
9999 " ${INSTALLKERNEL_STAGING_AREA} /initrd" || die " Failed to rename initramfs"
100100 fi
101101 fi
Original file line number Diff line number Diff line change @@ -62,3 +62,21 @@ INITRAMFS_GEN_ARGS+=(
6262)
6363
6464dracut " ${INITRAMFS_GEN_ARGS[@]} " || exit 1
65+
66+ # Fallback path for if we don't know if we generated an initramfs or
67+ # UKI. If dracut is used in uefi=yes mode, initrd will actually
68+ # be a combined kernel+initramfs UEFI executable. We can easily
69+ # recognize it by PE magic (vs cpio for a regular initramfs)
70+ if [[ ${IMAGE} == dracut-tmp ]]; then
71+ read -rn 2 magic < " ${KERNEL_INSTALL_STAGING_AREA} /${IMAGE} " ||
72+ die " Cannot read ${KERNEL_INSTALL_STAGING_AREA} /${IMAGE} "
73+ if [[ ${magic} == MZ ]]; then
74+ einfo " Combined UEFI kernel+initramfs executable found"
75+ mv " ${KERNEL_INSTALL_STAGING_AREA} /${IMAGE} " \
76+ " ${KERNEL_INSTALL_STAGING_AREA} /uki.efi" || die " Failed to rename UKI"
77+ else
78+ einfo " Plain initramfs image found"
79+ mv " ${KERNEL_INSTALL_STAGING_AREA} /${IMAGE} " \
80+ " ${KERNEL_INSTALL_STAGING_AREA} /initrd" || die " Failed to rename initramfs"
81+ fi
82+ fi
You can’t perform that action at this time.
0 commit comments