mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-01-05 14:07:27 -08:00
and: - rdep on iucode_tool for .install hook - USE=hostonly: iucode_tool is executed in pkg_preinst and should therefore be an idep instead of a rdep (not that it really makes a functional difference since it is bdep anyway) - rework REQUIRED_USE: the *.install hooks require the split-ucode to be present. Since with USE=dist-kernel, USE=initramfs does not install intel-uc.img (instead it is delegared to installkernel via the *.install hooks) we need always split-ucode with dist-kernel. - *.install: exit gracefully if no ucode installed this mirrors recent changes in sys-kernel/linux-firmware Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
53 lines
1.4 KiB
Bash
53 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright 2024 Gentoo Authors
|
|
# This script is installed by sys-firmware/intel-microcode, it is executed by
|
|
# systemd's kernel-install, NOT by the traditional installkernel. I.e. this
|
|
# plugin is run when the systemd USE flag is enabled or
|
|
# SYSTEMD_KERNEL_INSTALL=1 is set in the environment.
|
|
|
|
COMMAND="${1}"
|
|
|
|
if [[ ${COMMAND} != add ]]; then
|
|
exit 0
|
|
fi
|
|
|
|
if [[ ${KERNEL_INSTALL_INITRD_GENERATOR} == dracut ]]; then
|
|
# Dracut bundles microcode in its initramfs images
|
|
[[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo \
|
|
"initrd_generator=${KERNEL_INSTALL_INITRD_GENERATOR} bundles CPU microcode, nothing to do here."
|
|
exit 0
|
|
fi
|
|
|
|
# do nothing if somehow iucode_tool is not installed
|
|
if ! command -v iucode_tool >/dev/null; then
|
|
[[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo \
|
|
"iucode_tool command not available"
|
|
exit 1
|
|
fi
|
|
|
|
# use same opts as intel-microcode.ebuild
|
|
opts=(
|
|
--write-earlyfw="${KERNEL_INSTALL_STAGING_AREA}/microcode-intel"
|
|
--overwrite
|
|
--strict-checks
|
|
--no-ignore-broken
|
|
--no-downgrade
|
|
)
|
|
|
|
if [[ -d /lib/firmware/intel-ucode ]]; then
|
|
if [[ ${KERNEL_INSTALL_VERBOSE} == 1 ]]; then
|
|
echo "Generating Intel CPU Microcode early initramfs image..."
|
|
opts+=(
|
|
--list-all
|
|
--list
|
|
)
|
|
fi
|
|
|
|
iucode_tool /lib/firmware/intel-ucode "${opts[@]}" ||
|
|
{ echo "iucode_tool failed" && exit 1; }
|
|
else
|
|
[[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo \
|
|
"No Intel CPU Microcode installed, nothing to do here."
|
|
fi
|