From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Subject: [gentoo-dev] [PATCH 5/7] sys-kernel/linux-firmware: add USE=dist-kernel
Date: Tue, 14 May 2024 13:59:10 +0200 [thread overview]
Message-ID: <20240514115924.29167-5-andrewammerlaan@gentoo.org> (raw)
In-Reply-To: <20240514115924.29167-1-andrewammerlaan@gentoo.org>
The /boot/amd-ucode 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>
---
.../linux-firmware-20240220-r2.ebuild | 32 +++++++++++++++----
.../linux-firmware-20240312.ebuild | 32 +++++++++++++++----
.../linux-firmware-20240410.ebuild | 32 +++++++++++++++----
.../linux-firmware-99999999.ebuild | 32 +++++++++++++++----
4 files changed, 100 insertions(+), 28 deletions(-)
diff --git a/sys-kernel/linux-firmware/linux-firmware-20240220-r2.ebuild b/sys-kernel/linux-firmware/linux-firmware-20240220-r2.ebuild
index 8ea7565f00ce..0ecca9dae446 100644
--- a/sys-kernel/linux-firmware/linux-firmware-20240220-r2.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-20240220-r2.ebuild
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
EAPI=8
-inherit linux-info mount-boot savedconfig multiprocessing
+inherit dist-kernel-utils linux-info mount-boot savedconfig multiprocessing
# In case this is a real snapshot, fill in commit below.
# For normal, tagged releases, leave blank
@@ -29,7 +29,7 @@ LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
unknown-license? ( all-rights-reserved )"
SLOT="0"
-IUSE="bindist compress-xz compress-zstd deduplicate initramfs +redistributable savedconfig unknown-license"
+IUSE="bindist compress-xz compress-zstd deduplicate dist-kernel +initramfs +redistributable savedconfig unknown-license"
REQUIRED_USE="initramfs? ( redistributable )
?? ( compress-xz compress-zstd )
savedconfig? ( !deduplicate )"
@@ -62,7 +62,14 @@ RDEPEND="!savedconfig? (
!sys-firmware/alsa-firmware[alsa_cards_sb16]
!sys-firmware/alsa-firmware[alsa_cards_ymfpci]
)
- )"
+ )
+ dist-kernel? ( virtual/dist-kernel )
+"
+IDEPEND="
+ dist-kernel? (
+ initramfs? ( sys-kernel/installkernel )
+ )
+"
QA_PREBUILT="*"
PATCHES=( "${FILESDIR}"/${PN}-copy-firmware-r4.patch )
@@ -84,8 +91,8 @@ pkg_setup() {
eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
fi
fi
- linux-info_pkg_setup
fi
+ linux-info_pkg_setup
}
src_unpack() {
@@ -110,7 +117,7 @@ src_prepare() {
chmod +x copy-firmware.sh || die
- if use initramfs; then
+ if use initramfs && ! use dist-kernel; then
if [[ -d "${S}/amd-ucode" ]]; then
local UCODETMP="${T}/ucode_tmp"
local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
@@ -351,7 +358,13 @@ src_install() {
popd &>/dev/null || die
- if use initramfs ; then
+ # Instruct Dracut on whether or not we want the microcode in initramfs
+ (
+ insinto /usr/lib/dracut/dracut.conf.d
+ newins - 10-${PN}.conf <<<"early_microcode=$(usex initramfs)"
+ )
+
+ if use initramfs && ! use dist-kernel; then
insinto /boot
doins "${S}"/amd-uc.img
fi
@@ -391,7 +404,12 @@ pkg_postinst() {
done
# 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
}
pkg_prerm() {
diff --git a/sys-kernel/linux-firmware/linux-firmware-20240312.ebuild b/sys-kernel/linux-firmware/linux-firmware-20240312.ebuild
index 8795fc72fda3..2481f3a517f0 100644
--- a/sys-kernel/linux-firmware/linux-firmware-20240312.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-20240312.ebuild
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
EAPI=8
-inherit linux-info mount-boot savedconfig multiprocessing
+inherit dist-kernel-utils linux-info mount-boot savedconfig multiprocessing
# In case this is a real snapshot, fill in commit below.
# For normal, tagged releases, leave blank
@@ -29,7 +29,7 @@ LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
unknown-license? ( all-rights-reserved )"
SLOT="0"
-IUSE="bindist compress-xz compress-zstd deduplicate initramfs +redistributable savedconfig unknown-license"
+IUSE="bindist compress-xz compress-zstd deduplicate dist-kernel +initramfs +redistributable savedconfig unknown-license"
REQUIRED_USE="initramfs? ( redistributable )
?? ( compress-xz compress-zstd )
savedconfig? ( !deduplicate )"
@@ -62,7 +62,14 @@ RDEPEND="!savedconfig? (
!sys-firmware/alsa-firmware[alsa_cards_sb16]
!sys-firmware/alsa-firmware[alsa_cards_ymfpci]
)
- )"
+ )
+ dist-kernel? ( virtual/dist-kernel )
+"
+IDEPEND="
+ dist-kernel? (
+ initramfs? ( sys-kernel/installkernel )
+ )
+"
QA_PREBUILT="*"
PATCHES=( "${FILESDIR}"/${PN}-copy-firmware-r4.patch )
@@ -84,8 +91,8 @@ pkg_setup() {
eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
fi
fi
- linux-info_pkg_setup
fi
+ linux-info_pkg_setup
}
src_unpack() {
@@ -110,7 +117,7 @@ src_prepare() {
chmod +x copy-firmware.sh || die
- if use initramfs; then
+ if use initramfs && ! use dist-kernel; then
if [[ -d "${S}/amd-ucode" ]]; then
local UCODETMP="${T}/ucode_tmp"
local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
@@ -351,7 +358,13 @@ src_install() {
popd &>/dev/null || die
- if use initramfs ; then
+ # Instruct Dracut on whether or not we want the microcode in initramfs
+ (
+ insinto /usr/lib/dracut/dracut.conf.d
+ newins - 10-${PN}.conf <<<"early_microcode=$(usex initramfs)"
+ )
+
+ if use initramfs && ! use dist-kernel; then
insinto /boot
doins "${S}"/amd-uc.img
fi
@@ -391,7 +404,12 @@ pkg_postinst() {
done
# 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
}
pkg_prerm() {
diff --git a/sys-kernel/linux-firmware/linux-firmware-20240410.ebuild b/sys-kernel/linux-firmware/linux-firmware-20240410.ebuild
index 8795fc72fda3..2481f3a517f0 100644
--- a/sys-kernel/linux-firmware/linux-firmware-20240410.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-20240410.ebuild
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
EAPI=8
-inherit linux-info mount-boot savedconfig multiprocessing
+inherit dist-kernel-utils linux-info mount-boot savedconfig multiprocessing
# In case this is a real snapshot, fill in commit below.
# For normal, tagged releases, leave blank
@@ -29,7 +29,7 @@ LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
unknown-license? ( all-rights-reserved )"
SLOT="0"
-IUSE="bindist compress-xz compress-zstd deduplicate initramfs +redistributable savedconfig unknown-license"
+IUSE="bindist compress-xz compress-zstd deduplicate dist-kernel +initramfs +redistributable savedconfig unknown-license"
REQUIRED_USE="initramfs? ( redistributable )
?? ( compress-xz compress-zstd )
savedconfig? ( !deduplicate )"
@@ -62,7 +62,14 @@ RDEPEND="!savedconfig? (
!sys-firmware/alsa-firmware[alsa_cards_sb16]
!sys-firmware/alsa-firmware[alsa_cards_ymfpci]
)
- )"
+ )
+ dist-kernel? ( virtual/dist-kernel )
+"
+IDEPEND="
+ dist-kernel? (
+ initramfs? ( sys-kernel/installkernel )
+ )
+"
QA_PREBUILT="*"
PATCHES=( "${FILESDIR}"/${PN}-copy-firmware-r4.patch )
@@ -84,8 +91,8 @@ pkg_setup() {
eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
fi
fi
- linux-info_pkg_setup
fi
+ linux-info_pkg_setup
}
src_unpack() {
@@ -110,7 +117,7 @@ src_prepare() {
chmod +x copy-firmware.sh || die
- if use initramfs; then
+ if use initramfs && ! use dist-kernel; then
if [[ -d "${S}/amd-ucode" ]]; then
local UCODETMP="${T}/ucode_tmp"
local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
@@ -351,7 +358,13 @@ src_install() {
popd &>/dev/null || die
- if use initramfs ; then
+ # Instruct Dracut on whether or not we want the microcode in initramfs
+ (
+ insinto /usr/lib/dracut/dracut.conf.d
+ newins - 10-${PN}.conf <<<"early_microcode=$(usex initramfs)"
+ )
+
+ if use initramfs && ! use dist-kernel; then
insinto /boot
doins "${S}"/amd-uc.img
fi
@@ -391,7 +404,12 @@ pkg_postinst() {
done
# 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
}
pkg_prerm() {
diff --git a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
index e3f5246a89a3..01ae250624ed 100644
--- a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
EAPI=8
-inherit linux-info mount-boot savedconfig multiprocessing
+inherit dist-kernel-utils linux-info mount-boot savedconfig multiprocessing
# In case this is a real snapshot, fill in commit below.
# For normal, tagged releases, leave blank
@@ -29,7 +29,7 @@ LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
unknown-license? ( all-rights-reserved )"
SLOT="0"
-IUSE="compress-xz compress-zstd deduplicate initramfs +redistributable savedconfig unknown-license"
+IUSE="compress-xz compress-zstd deduplicate dist-kernel +initramfs +redistributable savedconfig unknown-license"
REQUIRED_USE="initramfs? ( redistributable )
?? ( compress-xz compress-zstd )
savedconfig? ( !deduplicate )"
@@ -61,7 +61,14 @@ RDEPEND="!savedconfig? (
!sys-firmware/alsa-firmware[alsa_cards_sb16]
!sys-firmware/alsa-firmware[alsa_cards_ymfpci]
)
- )"
+ )
+ dist-kernel? ( virtual/dist-kernel )
+"
+IDEPEND="
+ dist-kernel? (
+ initramfs? ( sys-kernel/installkernel )
+ )
+"
QA_PREBUILT="*"
@@ -78,8 +85,8 @@ pkg_setup() {
eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
fi
fi
- linux-info_pkg_setup
fi
+ linux-info_pkg_setup
}
pkg_pretend() {
@@ -107,7 +114,7 @@ src_prepare() {
chmod +x copy-firmware.sh || die
- if use initramfs; then
+ if use initramfs && ! use dist-kernel; then
if [[ -d "${S}/amd-ucode" ]]; then
local UCODETMP="${T}/ucode_tmp"
local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
@@ -355,7 +362,13 @@ src_install() {
popd &>/dev/null || die
- if use initramfs ; then
+ # Instruct Dracut on whether or not we want the microcode in initramfs
+ (
+ insinto /usr/lib/dracut/dracut.conf.d
+ newins - 10-${PN}.conf <<<"early_microcode=$(usex initramfs)"
+ )
+
+ if use initramfs && ! use dist-kernel; then
insinto /boot
doins "${S}"/amd-uc.img
fi
@@ -391,7 +404,12 @@ pkg_postinst() {
done
# 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
}
pkg_prerm() {
--
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 ` [gentoo-dev] [PATCH 4/7] sys-firmware/intel-microcode: add USE=dist-kernel Andrew Ammerlaan
2024-05-14 11:59 ` Andrew Ammerlaan [this message]
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-5-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