From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Subject: [gentoo-dev] [PATCH 4/7] sys-firmware/intel-microcode: add USE=dist-kernel
Date: Tue, 14 May 2024 13:59:09 +0200 [thread overview]
Message-ID: <20240514115924.29167-4-andrewammerlaan@gentoo.org> (raw)
In-Reply-To: <20240514115924.29167-1-andrewammerlaan@gentoo.org>
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>
---
.../intel-microcode-20221108_p20221102.ebuild | 43 ++++++++++++++-----
.../intel-microcode-20230214_p20230212.ebuild | 41 ++++++++++++++----
.../intel-microcode-20230512_p20230512.ebuild | 41 ++++++++++++++----
.../intel-microcode-20230613_p20230520.ebuild | 40 +++++++++++++----
.../intel-microcode-20230808_p20230804.ebuild | 40 +++++++++++++----
.../intel-microcode-20230808_p20231007.ebuild | 40 +++++++++++++----
.../intel-microcode-20231114_p20231114.ebuild | 40 +++++++++++++----
.../intel-microcode-20240312_p20240312.ebuild | 38 +++++++++++++---
8 files changed, 256 insertions(+), 67 deletions(-)
diff --git a/sys-firmware/intel-microcode/intel-microcode-20221108_p20221102.ebuild b/sys-firmware/intel-microcode/intel-microcode-20221108_p20221102.ebuild
index 006f4811618a..a8cf0d39ff33 100644
--- a/sys-firmware/intel-microcode/intel-microcode-20221108_p20221102.ebuild
+++ b/sys-firmware/intel-microcode/intel-microcode-20221108_p20221102.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="7"
-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
@@ -23,13 +23,20 @@ SRC_URI="https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/arc
LICENSE="intel-ucode"
SLOT="0"
KEYWORDS="-* amd64 x86"
-IUSE="hostonly initramfs +split-ucode vanilla"
-REQUIRED_USE="|| ( initramfs split-ucode )"
-
-BDEPEND=">=sys-apps/iucode_tool-2.3"
+IUSE="dist-kernel hostonly +initramfs +split-ucode vanilla"
+REQUIRED_USE="!dist-kernel? ( || ( initramfs split-ucode ) )"
+BDEPEND="
+ >=sys-apps/iucode_tool-2.3
+ dist-kernel? (
+ initramfs? ( sys-kernel/installkernel )
+ )
+"
# !<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 )
+"
RESTRICT="binchecks strip"
@@ -132,9 +139,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" )
@@ -188,7 +204,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" )
@@ -259,7 +277,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-20230214_p20230212.ebuild b/sys-firmware/intel-microcode/intel-microcode-20230214_p20230212.ebuild
index d0d809679e8d..2602f9f0e3ea 100644
--- a/sys-firmware/intel-microcode/intel-microcode-20230214_p20230212.ebuild
+++ b/sys-firmware/intel-microcode/intel-microcode-20230214_p20230212.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
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
@@ -23,13 +23,20 @@ SRC_URI="https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/arc
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 ) )"
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 )
+ )
+"
RESTRICT="binchecks strip"
@@ -132,9 +139,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" )
@@ -188,7 +204,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" )
@@ -259,7 +277,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-20230512_p20230512.ebuild b/sys-firmware/intel-microcode/intel-microcode-20230512_p20230512.ebuild
index d0d809679e8d..2602f9f0e3ea 100644
--- a/sys-firmware/intel-microcode/intel-microcode-20230512_p20230512.ebuild
+++ b/sys-firmware/intel-microcode/intel-microcode-20230512_p20230512.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
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
@@ -23,13 +23,20 @@ SRC_URI="https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/arc
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 ) )"
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 )
+ )
+"
RESTRICT="binchecks strip"
@@ -132,9 +139,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" )
@@ -188,7 +204,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" )
@@ -259,7 +277,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-20230613_p20230520.ebuild b/sys-firmware/intel-microcode/intel-microcode-20230613_p20230520.ebuild
index 5d1ff1e7f4be..957da662f92e 100644
--- a/sys-firmware/intel-microcode/intel-microcode-20230613_p20230520.ebuild
+++ b/sys-firmware/intel-microcode/intel-microcode-20230613_p20230520.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
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-20230808_p20230804.ebuild b/sys-firmware/intel-microcode/intel-microcode-20230808_p20230804.ebuild
index 5d1ff1e7f4be..957da662f92e 100644
--- a/sys-firmware/intel-microcode/intel-microcode-20230808_p20230804.ebuild
+++ b/sys-firmware/intel-microcode/intel-microcode-20230808_p20230804.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
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-20230808_p20231007.ebuild b/sys-firmware/intel-microcode/intel-microcode-20230808_p20231007.ebuild
index 5d1ff1e7f4be..957da662f92e 100644
--- a/sys-firmware/intel-microcode/intel-microcode-20230808_p20231007.ebuild
+++ b/sys-firmware/intel-microcode/intel-microcode-20230808_p20231007.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
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-20231114_p20231114.ebuild b/sys-firmware/intel-microcode/intel-microcode-20231114_p20231114.ebuild
index 5d1ff1e7f4be..957da662f92e 100644
--- a/sys-firmware/intel-microcode/intel-microcode-20231114_p20231114.ebuild
+++ b/sys-firmware/intel-microcode/intel-microcode-20231114_p20231114.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
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-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
--
2.45.0
next prev parent reply other threads:[~2024-05-14 12:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-14 11:59 [gentoo-dev] [PATCH 1/7] linux-mod-r1.eclass: add USE=initramfs Andrew Ammerlaan
2024-05-14 11:59 ` [gentoo-dev] [PATCH 2/7] profiles/use.desc: add new global flag "initramfs" Andrew Ammerlaan
2024-05-14 11:59 ` [gentoo-dev] [PATCH 3/7] sys-fs/zfs-kmod: add USE=initramfs, and enable by default Andrew Ammerlaan
2024-05-14 11:59 ` Andrew Ammerlaan [this message]
2024-05-14 11:59 ` [gentoo-dev] [PATCH 5/7] sys-kernel/linux-firmware: add USE=dist-kernel Andrew Ammerlaan
2024-05-14 11:59 ` [gentoo-dev] [PATCH 6/7] linux-info.eclass: respect eselect kernel setting in binpkgs Andrew Ammerlaan
2024-05-15 16:02 ` Mike Gilbert
2024-05-14 11:59 ` [gentoo-dev] [PATCH 7/7] linux-mod-r1.eclass: do not reset kernel env vars " Andrew Ammerlaan
2024-05-14 12:02 ` [gentoo-dev] [PATCH 0/7] Changes to dracut kernel module/microcode handling Andrew Nowa Ammerlaan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240514115924.29167-4-andrewammerlaan@gentoo.org \
--to=andrewammerlaan@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox