Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support microcode hook #57

Merged
merged 6 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 31 additions & 20 deletions __frzr-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -329,26 +329,6 @@ main() {
cp ${SUBVOL}/boot/vmlinuz-linux ${MOUNT_PATH}/boot/${NAME}
cp ${SUBVOL}/boot/initramfs-linux.img ${MOUNT_PATH}/boot/${NAME}

AMD_UCODE=""
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

INTEL_UCODE=""
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

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 @@ -378,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="# amd-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
2 changes: 0 additions & 2 deletions frzr-initramfs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ if [ -d /frzr_root ]; then
echo '
ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-linux"
ALL_microcode=(/boot/*-ucode.img)

PRESETS="default"

Expand All @@ -115,7 +114,6 @@ EOF
echo '
ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/'$BUILD'/vmlinuz-linux"
ALL_microcode=(/boot/'$BUILD'/*-ucode.img)

PRESETS="default"

Expand Down
Loading