summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Ammerlaan <andrewammerlaan@gentoo.org>2024-05-08 08:38:14 +0200
committerAndrew Ammerlaan <andrewammerlaan@gentoo.org>2024-05-17 14:06:44 +0200
commitf93d0ab96634750c940e9068324795b5efca20cc (patch)
tree4d3e99faf01d4723591298aa8a99431c0552c563 /sys-firmware
parentsys-fs/zfs-kmod: add USE=initramfs, and enable by default (diff)
downloadgentoo-f93d0ab96634750c940e9068324795b5efca20cc.tar.gz
gentoo-f93d0ab96634750c940e9068324795b5efca20cc.tar.bz2
gentoo-f93d0ab96634750c940e9068324795b5efca20cc.zip
sys-firmware/intel-microcode: add USE=dist-kernel
The /boot/intel-uc.img is useless when we use a dist-kernel since dracut is responsible for generating the initramfs, and it (by default) includes the microcode. Instead add USE=dist-kernel and enable USE=initramfs by default. The initramfs flag toggles the early_microcode setting of dracut, and if both flags are enabled we trigger initramfs re-installation. This ensures that when we update this package, we also get the latest microcode in our dist-kernel initramfs or UKI. Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Diffstat (limited to 'sys-firmware')
-rw-r--r--sys-firmware/intel-microcode/intel-microcode-20240312_p20240312.ebuild38
-rw-r--r--sys-firmware/intel-microcode/intel-microcode-20240514_p20240514.ebuild38
2 files changed, 62 insertions, 14 deletions
diff --git a/sys-firmware/intel-microcode/intel-microcode-20240312_p20240312.ebuild b/sys-firmware/intel-microcode/intel-microcode-20240312_p20240312.ebuild
index 5992eadefd5f..957da662f92e 100644
--- a/sys-firmware/intel-microcode/intel-microcode-20240312_p20240312.ebuild
+++ b/sys-firmware/intel-microcode/intel-microcode-20240312_p20240312.ebuild
@@ -3,7 +3,7 @@
EAPI=8
-inherit linux-info mount-boot
+inherit dist-kernel-utils linux-info mount-boot
# Find updates by searching and clicking the first link (hopefully it's the one):
# https://www.intel.com/content/www/us/en/search.html?keyword=Processor+Microcode+Data+File
@@ -44,13 +44,21 @@ S="${WORKDIR}"
LICENSE="intel-ucode"
SLOT="0"
KEYWORDS="-* amd64 x86"
-IUSE="hostonly initramfs +split-ucode vanilla"
-REQUIRED_USE="|| ( initramfs split-ucode )"
+IUSE="dist-kernel hostonly +initramfs +split-ucode vanilla"
+REQUIRED_USE="!dist-kernel? ( || ( initramfs split-ucode ) )"
RESTRICT="binchecks strip"
BDEPEND=">=sys-apps/iucode_tool-2.3"
# !<sys-apps/microcode-ctl-1.17-r2 due to bug #268586
-RDEPEND="hostonly? ( sys-apps/iucode_tool )"
+RDEPEND="
+ dist-kernel? ( virtual/dist-kernel )
+ hostonly? ( sys-apps/iucode_tool )
+"
+IDEPEND="
+ dist-kernel? (
+ initramfs? ( sys-kernel/installkernel )
+ )
+"
# Blacklist bad microcode here.
# 0x000406f1 aka 06-4f-01 aka CPUID 406F1 require newer microcode loader
@@ -138,9 +146,18 @@ src_install() {
--list
)
+ # Instruct Dracut on whether or not we want the microcode in initramfs
+ # Use here 15 instead of 10, intel-microcode overwrites linux-firmware
+ (
+ insinto /usr/lib/dracut/dracut.conf.d
+ newins - 15-${PN}.conf <<<"early_microcode=$(usex initramfs)"
+ )
+
# The earlyfw cpio needs to be in /boot because it must be loaded before
# rootfs is mounted.
- use initramfs && dodir /boot && opts+=( --write-earlyfw="${ED}/boot/intel-uc.img" )
+ if ! use dist-kernel && use initramfs; then
+ dodir /boot && opts+=( --write-earlyfw="${ED}/boot/intel-uc.img" )
+ fi
keepdir /lib/firmware/intel-ucode
opts+=( --write-firmware="${ED}/lib/firmware/intel-ucode" )
@@ -194,7 +211,9 @@ pkg_preinst() {
# The earlyfw cpio needs to be in /boot because it must be loaded before
# rootfs is mounted.
- use initramfs && opts+=( --write-earlyfw=${_initramfs_file} )
+ if ! use dist-kernel && use initramfs; then
+ opts+=( --write-earlyfw=${_initramfs_file} )
+ fi
if use split-ucode; then
opts+=( --write-firmware="${ED}/lib/firmware/intel-ucode" )
@@ -265,7 +284,12 @@ pkg_postrm() {
pkg_postinst() {
# Don't forget to umount /boot if it was previously mounted by us.
- use initramfs && mount-boot_pkg_postinst
+ if use initramfs; then
+ if [[ -z ${ROOT} ]] && use dist-kernel; then
+ dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+ fi
+ mount-boot_pkg_postinst
+ fi
# We cannot give detailed information if user is affected or not:
# If MICROCODE_BLACKLIST wasn't modified, user can still use MICROCODE_SIGNATURES
diff --git a/sys-firmware/intel-microcode/intel-microcode-20240514_p20240514.ebuild b/sys-firmware/intel-microcode/intel-microcode-20240514_p20240514.ebuild
index 418ab5cc22e2..c33321a94497 100644
--- a/sys-firmware/intel-microcode/intel-microcode-20240514_p20240514.ebuild
+++ b/sys-firmware/intel-microcode/intel-microcode-20240514_p20240514.ebuild
@@ -3,7 +3,7 @@
EAPI=8
-inherit linux-info mount-boot
+inherit dist-kernel-utils linux-info mount-boot
# Find updates by searching and clicking the first link (hopefully it's the one):
# https://www.intel.com/content/www/us/en/search.html?keyword=Processor+Microcode+Data+File
@@ -44,13 +44,21 @@ S="${WORKDIR}"
LICENSE="intel-ucode"
SLOT="0"
KEYWORDS="-* ~amd64 ~x86"
-IUSE="hostonly initramfs +split-ucode vanilla"
-REQUIRED_USE="|| ( initramfs split-ucode )"
+IUSE="dist-kernel hostonly +initramfs +split-ucode vanilla"
+REQUIRED_USE="!dist-kernel? ( || ( initramfs split-ucode ) )"
RESTRICT="binchecks strip"
BDEPEND=">=sys-apps/iucode_tool-2.3"
# !<sys-apps/microcode-ctl-1.17-r2 due to bug #268586
-RDEPEND="hostonly? ( sys-apps/iucode_tool )"
+RDEPEND="
+ dist-kernel? ( virtual/dist-kernel )
+ hostonly? ( sys-apps/iucode_tool )
+"
+IDEPEND="
+ dist-kernel? (
+ initramfs? ( sys-kernel/installkernel )
+ )
+"
# Blacklist bad microcode here.
# 0x000406f1 aka 06-4f-01 aka CPUID 406F1 require newer microcode loader
@@ -138,9 +146,18 @@ src_install() {
--list
)
+ # Instruct Dracut on whether or not we want the microcode in initramfs
+ # Use here 15 instead of 10, intel-microcode overwrites linux-firmware
+ (
+ insinto /usr/lib/dracut/dracut.conf.d
+ newins - 15-${PN}.conf <<<"early_microcode=$(usex initramfs)"
+ )
+
# The earlyfw cpio needs to be in /boot because it must be loaded before
# rootfs is mounted.
- use initramfs && dodir /boot && opts+=( --write-earlyfw="${ED}/boot/intel-uc.img" )
+ if ! use dist-kernel && use initramfs; then
+ dodir /boot && opts+=( --write-earlyfw="${ED}/boot/intel-uc.img" )
+ fi
keepdir /lib/firmware/intel-ucode
opts+=( --write-firmware="${ED}/lib/firmware/intel-ucode" )
@@ -194,7 +211,9 @@ pkg_preinst() {
# The earlyfw cpio needs to be in /boot because it must be loaded before
# rootfs is mounted.
- use initramfs && opts+=( --write-earlyfw=${_initramfs_file} )
+ if ! use dist-kernel && use initramfs; then
+ opts+=( --write-earlyfw=${_initramfs_file} )
+ fi
if use split-ucode; then
opts+=( --write-firmware="${ED}/lib/firmware/intel-ucode" )
@@ -265,7 +284,12 @@ pkg_postrm() {
pkg_postinst() {
# Don't forget to umount /boot if it was previously mounted by us.
- use initramfs && mount-boot_pkg_postinst
+ if use initramfs; then
+ if [[ -z ${ROOT} ]] && use dist-kernel; then
+ dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+ fi
+ mount-boot_pkg_postinst
+ fi
# We cannot give detailed information if user is affected or not:
# If MICROCODE_BLACKLIST wasn't modified, user can still use MICROCODE_SIGNATURES