summaryrefslogtreecommitdiff
path: root/eclass/kernel-install.eclass
diff options
context:
space:
mode:
authorAndrew Ammerlaan <andrewammerlaan@gentoo.org>2023-11-08 14:46:19 +0100
committerAndrew Ammerlaan <andrewammerlaan@gentoo.org>2023-12-05 11:27:41 +0100
commitdb0195c3d66fc9ca1ee966b2177b2174a7d7bd02 (patch)
treea83d017d04b65179cad3f6e2163c881411c41510 /eclass/kernel-install.eclass
parentce11e1fb15f13927a35a9cbe0c1056d465bc541a (diff)
downloadgentoo-db0195c3d66fc9ca1ee966b2177b2174a7d7bd02.tar.gz
gentoo-db0195c3d66fc9ca1ee966b2177b2174a7d7bd02.tar.bz2
gentoo-db0195c3d66fc9ca1ee966b2177b2174a7d7bd02.zip
eclass/(dist-)kernel{-utils,-install}: More flexible initrd generation
We only need to call dracut to generate an initrd/uki if we are using <=sys-kernel/installkernel-gentoo-7. sys-kernel/installkernel-systemd already calls dracut via its plugin system if it is installed. sys-kernel/installkernel-gentoo-8[dracut] now also contains the code required to generate an initrd or uki. This change makes it possible for users to use other/custom initrd generators with our dist kernels if they are using installkernel-systemd. Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Diffstat (limited to 'eclass/kernel-install.eclass')
-rw-r--r--eclass/kernel-install.eclass30
1 files changed, 22 insertions, 8 deletions
diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index a0eceae8280b..b4d84f3986c0 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -48,11 +48,21 @@ RESTRICT+="
# note: we need installkernel with initramfs support!
IDEPEND="
- || (
- sys-kernel/installkernel-gentoo
- sys-kernel/installkernel-systemd
+ !initramfs? (
+ || (
+ sys-kernel/installkernel-gentoo
+ sys-kernel/installkernel-systemd
+ )
)
- initramfs? ( >=sys-kernel/dracut-059-r4 )"
+ initramfs? (
+ >=sys-kernel/dracut-059-r4
+ || (
+ <=sys-kernel/installkernel-gentoo-7
+ >=sys-kernel/installkernel-gentoo-8[dracut(-)]
+ sys-kernel/installkernel-systemd
+ )
+ )
+"
# needed by objtool that is installed along with the kernel and used
# to build external modules
# NB: linux-mod.eclass also adds this dep but it's cleaner to have
@@ -429,9 +439,13 @@ kernel-install_pkg_preinst() {
# @FUNCTION: kernel-install_install_all
# @USAGE: <ver>
# @DESCRIPTION:
-# Build an initramfs for the kernel and install the kernel. This is
-# called from pkg_postinst() and pkg_config(). <ver> is the full
-# kernel version.
+# Build an initramfs for the kernel if required and install the kernel.
+# This is called from pkg_postinst() and pkg_config(). <ver> is the
+# full kernel version.
+#
+# With sys-kernel/installkernel-systemd, or version 8 or greater of
+# sys-kernel/installkernel-gentoo, the generation of the initrd via dracut
+# is handled by kernel-install instead.
kernel-install_install_all() {
debug-print-function ${FUNCNAME} "${@}"
@@ -448,7 +462,7 @@ kernel-install_install_all() {
nonfatal mount-boot_check_status || break
local image_path=$(dist-kernel_get_image_path)
- if use initramfs; then
+ if use initramfs && has_version "<=sys-kernel/installkernel-gentoo-7"; then
# putting it alongside kernel image as 'initrd' makes
# kernel-install happier
nonfatal dist-kernel_build_initramfs \