diff options
author | Morten Linderud <morten@linderud.pw> | 2023-09-09 15:18:41 +0200 |
---|---|---|
committer | Morten Linderud <morten@linderud.pw> | 2023-09-09 15:18:41 +0200 |
commit | d587832935dad558a7542159ceb1cceead706450 (patch) | |
tree | a6a47f13d428853b6c6aaec62fad4a20fb0be3e9 | |
parent | e639b234aca8c116288d2ec22ff0c4b5df113694 (diff) | |
parent | f9c27f6add84b008c1ca38c99931c50337e86ca5 (diff) |
Merge remote-tracking branch 'origin/merge-requests/248'
* origin/merge-requests/248:
reduce list of microcode file names to necessary ones
Split micrcode detection to separate plugin.
-rwxr-xr-x | kernel-install/40-microcode.install | 26 | ||||
-rwxr-xr-x | kernel-install/50-mkinitcpio.install | 13 |
2 files changed, 29 insertions, 10 deletions
diff --git a/kernel-install/40-microcode.install b/kernel-install/40-microcode.install new file mode 100755 index 0000000..c140477 --- /dev/null +++ b/kernel-install/40-microcode.install @@ -0,0 +1,26 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0-only + +COMMAND="${1:?}" +# shellcheck disable=SC2034 +KERNEL_VERSION="${2:?}" +# shellcheck disable=SC2034 +ENTRY_DIR_ABS="$3" +# shellcheck disable=SC2034 +KERNEL_IMAGE="$4" + +set -e + +[[ "$COMMAND" = "add" ]] || exit 0 + +for dir in "${KERNEL_INSTALL_BOOT_ROOT}" "/boot"; do + for microcode in "intel-ucode.img" "amd-ucode.img"; do + if [[ -f "${dir}/${microcode}" ]]; then + install -m 0644 "${dir}/${microcode}" "${KERNEL_INSTALL_STAGING_AREA}/microcode-${microcode}" || { + echo "Error: could not copy '$microcode' to the staging area." >&2 + exit 1 + } + (( KERNEL_INSTALL_VERBOSE )) && printf "+ Found microcode image %s\n" "$microcode" + fi + done +done diff --git a/kernel-install/50-mkinitcpio.install b/kernel-install/50-mkinitcpio.install index 2d6a0dc..5fd8b40 100755 --- a/kernel-install/50-mkinitcpio.install +++ b/kernel-install/50-mkinitcpio.install @@ -22,16 +22,9 @@ case "$KERNEL_INSTALL_LAYOUT" in else GENERATOR_CMD+=(--kernelimage "$KERNEL_IMAGE") - # autodetecting microcode images by known location - # They're from GRUB_EARLY_INITRD_LINUX_STOCK in https://git.savannah.gnu.org/cgit/grub.git/tree/util/grub-mkconfig.in. - ucode_names=("intel-ucode.img" "amd-ucode.img" "intel-uc.img" "amd-uc.img" "early_ucode.cpio" "microcode.cpio") - for ucode_name in "${ucode_names[@]}"; do - for dir in "$KERNEL_INSTALL_BOOT_ROOT" "/boot"; do - if [[ -f "${dir}/${ucode_name}" ]]; then - (( KERNEL_INSTALL_VERBOSE )) && printf "+ Found microcode image %s\n" "$ucode_name" - GENERATOR_CMD+=(--microcode "${dir}/$ucode_name") - fi - done + # Add microcode if found in staging area + for microcode in "${KERNEL_INSTALL_STAGING_AREA}"/microcode*; do + [[ -f "$microcode" ]] && GENERATOR_CMD+=(--microcode "$microcode") done GENERATOR_CMD+=(-U "$KERNEL_INSTALL_STAGING_AREA/uki.efi" ) |