diff options
author | cvlc12 <cvlc12@outlook.fr> | 2023-06-19 20:45:20 +0200 |
---|---|---|
committer | cvlc12 <cvlc12@outlook.fr> | 2023-08-05 13:25:41 +0200 |
commit | 1ca565a06027c127eb9925e133aea3d642ee557d (patch) | |
tree | bd884cf24e9c142a8e05c6d91d1614157a28675f | |
parent | b0c109f1f3f936eeba395a7c9598a7d280df0323 (diff) |
Split micrcode detection to separate plugin.
Always copy microcode to the staging are as 'microcode*'.
indentation
-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..375ca42 --- /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" "intel-uc.img" "amd-uc.img" "early_ucode.cpio" "microcode.cpio"; 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" ) |