Skip to content

Commit

Permalink
Do microcode after initramfs generation
Browse files Browse the repository at this point in the history
  • Loading branch information
NeroReflex committed Mar 12, 2024
1 parent add75df commit 15fb2f3
Showing 1 changed file with 31 additions and 30 deletions.
61 changes: 31 additions & 30 deletions __frzr-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -329,36 +329,6 @@ main() {
cp ${SUBVOL}/boot/vmlinuz-linux ${MOUNT_PATH}/boot/${NAME}
cp ${SUBVOL}/boot/initramfs-linux.img ${MOUNT_PATH}/boot/${NAME}

AMD_UCODE="# missing intel-ucode"
INTEL_UCODE="# missing intel-ucode"

if grep -q "microcode" "${MOUNT_PATH}/etc/mkinitcpio.conf"; then
echo "microcode hook present: will skip systemd-boot initrd."

AMD_UCODE="# intel-ucode in initramfs"
INTEL_UCODE="# intel-ucode in initramfs"
else
echo "microcode hook not found: will use systemd-bood initrd."

if [ -e ${SUBVOL}/boot/amd-ucode.img ] ; then
cp ${SUBVOL}/boot/amd-ucode.img ${MOUNT_PATH}/boot/${NAME}
AMD_UCODE="initrd /${NAME}/amd-ucode.img"
fi

if [ -e ${SUBVOL}/boot/intel-ucode.img ] ; then
cp ${SUBVOL}/boot/intel-ucode.img ${MOUNT_PATH}/boot/${NAME}
INTEL_UCODE="initrd /${NAME}/intel-ucode.img"
fi
fi

ADDITIONAL_ARGUMENTS=""
if [ -e ${SUBVOL}/usr/lib/frzr.d/bootconfig.conf ] ; then
ADDITIONAL_ARGUMENTS="$ADDITIONAL_ARGUMENTS $(cat ${SUBVOL}/usr/lib/frzr.d/bootconfig.conf)"
fi

get_boot_cfg "${NAME}" "${AMD_UCODE}" "${INTEL_UCODE}" "${ADDITIONAL_ARGUMENTS}" > ${BOOT_CFG}
echo "default frzr.conf" > ${MOUNT_PATH}/boot/loader/loader.conf

# Check if there are migrations available
if compgen -G "${SUBVOL}"/usr/lib/frzr.d/*.migration > /dev/null ; then
for m in "${SUBVOL}"/usr/lib/frzr.d/*.migration ;
Expand Down Expand Up @@ -388,6 +358,37 @@ main() {
# Run frzr-initramfs to create mkinicpio.conf and build an initramfs
frzr-initramfs

# now that the initramfs has been built determine if that includes microcode
AMD_UCODE="# missing intel-ucode"
INTEL_UCODE="# missing intel-ucode"
if grep -q "microcode" "/etc/mkinitcpio.conf"; then
echo "microcode hook present: will skip systemd-boot initrd."

AMD_UCODE="# intel-ucode in initramfs"
INTEL_UCODE="# intel-ucode in initramfs"
else
echo "microcode hook not found: will use systemd-bood initrd."

if [ -e ${SUBVOL}/boot/amd-ucode.img ] ; then
cp ${SUBVOL}/boot/amd-ucode.img ${MOUNT_PATH}/boot/${NAME}
AMD_UCODE="initrd /${NAME}/amd-ucode.img"
fi

if [ -e ${SUBVOL}/boot/intel-ucode.img ] ; then
cp ${SUBVOL}/boot/intel-ucode.img ${MOUNT_PATH}/boot/${NAME}
INTEL_UCODE="initrd /${NAME}/intel-ucode.img"
fi
fi

ADDITIONAL_ARGUMENTS=""
if [ -e ${SUBVOL}/usr/lib/frzr.d/bootconfig.conf ] ; then
ADDITIONAL_ARGUMENTS="$ADDITIONAL_ARGUMENTS $(cat ${SUBVOL}/usr/lib/frzr.d/bootconfig.conf)"
fi

# write down the kernel cmdline as the last step: shall a blackout happen the prevous deployment will get booted
get_boot_cfg "${NAME}" "${AMD_UCODE}" "${INTEL_UCODE}" "${ADDITIONAL_ARGUMENTS}" > ${BOOT_CFG}
echo "default frzr.conf" > ${MOUNT_PATH}/boot/loader/loader.conf

rm -f ${MOUNT_PATH}/*.img.*

rm -rf /var/lib/pacman # undo frzr-unlock
Expand Down

0 comments on commit 15fb2f3

Please sign in to comment.