summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-01-07 18:53:56 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-01-07 18:53:56 +0000
commitc577a55e80fbc5ba7f9f0124a354335a98e4bf4a (patch)
tree247ea00560bad9c5ae6e4706d41222629f40db0f /eclass
parent02814fd00146251691678aa18d9937665c677086 (diff)
gentoo auto-resync : 07:01:2024 - 18:53:56
Diffstat (limited to 'eclass')
-rw-r--r--eclass/Manifest.gzbin38942 -> 38928 bytes
-rw-r--r--eclass/dist-kernel-utils.eclass78
-rw-r--r--eclass/kernel-build.eclass25
-rw-r--r--eclass/kernel-install.eclass39
4 files changed, 27 insertions, 115 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz
index 20842d2e014e..1c23b67b32ef 100644
--- a/eclass/Manifest.gz
+++ b/eclass/Manifest.gz
Binary files differ
diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass
index 8ccffd038474..13137f8c863c 100644
--- a/eclass/dist-kernel-utils.eclass
+++ b/eclass/dist-kernel-utils.eclass
@@ -12,13 +12,6 @@
# This eclass provides various utility functions related to Distribution
# Kernels.
-# @ECLASS_VARIABLE: KERNEL_IUSE_SECUREBOOT
-# @PRE_INHERIT
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# If set to a non-null value, inherits secureboot.eclass
-# and allows signing of generated kernel images.
-
# @ECLASS_VARIABLE: KERNEL_EFI_ZBOOT
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -35,43 +28,6 @@ esac
inherit toolchain-funcs
-if [[ ${KERNEL_IUSE_SECUREBOOT} ]]; then
- inherit secureboot
-fi
-
-# @FUNCTION: dist-kernel_build_initramfs
-# @USAGE: <output> <version>
-# @DESCRIPTION:
-# Build an initramfs for the kernel. <output> specifies the absolute
-# path where initramfs will be created, while <version> specifies
-# the kernel version, used to find modules.
-#
-# Note: while this function uses dracut at the moment, other initramfs
-# variants may be supported in the future.
-dist-kernel_build_initramfs() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments"
- local output=${1}
- local version=${2}
-
- local rel_image_path=$(dist-kernel_get_image_path)
- local image=${output%/*}/${rel_image_path##*/}
-
- local args=(
- --force
- # if uefi=yes is used, dracut needs to locate the kernel image
- --kernel-image "${image}"
-
- # positional arguments
- "${output}" "${version}"
- )
-
- ebegin "Building initramfs via dracut"
- dracut "${args[@]}"
- eend ${?} || die -n "Building initramfs failed"
-}
-
# @FUNCTION: dist-kernel_get_image_path
# @DESCRIPTION:
# Get relative kernel image path specific to the current ${ARCH}.
@@ -123,26 +79,6 @@ dist-kernel_install_kernel() {
local image=${2}
local map=${3}
- if has_version "<=sys-kernel/installkernel-gentoo-7"; then
- # if dracut is used in uefi=yes mode, initrd will actually
- # be a combined kernel+initramfs UEFI executable. we can easily
- # recognize it by PE magic (vs cpio for a regular initramfs)
- local initrd=${image%/*}/initrd
- local magic
- [[ -s ${initrd} ]] && read -n 2 magic < "${initrd}"
- if [[ ${magic} == MZ ]]; then
- einfo "Combined UEFI kernel+initramfs executable found"
- # install the combined executable in place of kernel
- image=${initrd%/*}/uki.efi
- mv "${initrd}" "${image}" || die
-
- if [[ ${KERNEL_IUSE_SECUREBOOT} ]]; then
- # Ensure the uki is signed if dracut hasn't already done so.
- secureboot_sign_efi_file "${image}"
- fi
- fi
- fi
-
ebegin "Installing the kernel via installkernel"
# note: .config is taken relatively to System.map;
# initrd relatively to bzImage
@@ -159,10 +95,6 @@ dist-kernel_install_kernel() {
# The function will determine whether <kernel-dir> is actually
# a dist-kernel, and whether initramfs was used.
#
-# 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.
-#
# This function is to be used in pkg_postinst() of ebuilds installing
# kernel modules that are included in the initramfs.
dist-kernel_reinstall_initramfs() {
@@ -180,16 +112,6 @@ dist-kernel_reinstall_initramfs() {
return
fi
- if has_version "<=sys-kernel/installkernel-gentoo-7"; then
- local initramfs_path=${image_path%/*}/initrd
- if [[ ! -f ${initramfs_path} && ! -f ${initramfs_path%/*}/uki.efi ]]; then
- einfo "No initramfs or uki found at ${image_path}"
- return
- fi
-
- dist-kernel_build_initramfs "${initramfs_path}" "${ver}"
- fi
-
dist-kernel_install_kernel "${ver}" "${image_path}" \
"${kernel_dir}/System.map"
}
diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index 28f111ec998b..391a99ceffce 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -1,4 +1,4 @@
-# Copyright 2020-2023 Gentoo Authors
+# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: kernel-build.eclass
@@ -30,9 +30,6 @@ _KERNEL_BUILD_ECLASS=1
PYTHON_COMPAT=( python3_{10..12} )
if [[ ${KERNEL_IUSE_MODULES_SIGN} ]]; then
- # If we have enabled module signing IUSE
- # then we can also enable secureboot IUSE
- KERNEL_IUSE_SECUREBOOT=1
inherit secureboot
fi
@@ -56,10 +53,10 @@ IUSE="+strip"
# @PRE_INHERIT
# @DEFAULT_UNSET
# @DESCRIPTION:
-# If set to a non-null value, adds IUSE=modules-sign and required
-# logic to manipulate the kernel config while respecting the
-# MODULES_SIGN_HASH, MODULES_SIGN_CERT, and MODULES_SIGN_KEY user
-# variables.
+# If set to a non-null value, inherits secureboot.eclass, adds
+# IUSE=modules-sign and required logic to manipulate the kernel
+# config while respecting the MODULES_SIGN_HASH, MODULES_SIGN_CERT,
+# and MODULES_SIGN_KEY user variables.
# @ECLASS_VARIABLE: MODULES_SIGN_HASH
# @USER_VARIABLE
@@ -99,6 +96,14 @@ IUSE="+strip"
# key in PEM format to use. Must be specified if MODULES_SIGN_KEY
# is set to a path of a file that only contains the private key.
+# @ECLASS_VARIABLE: KERNEL_GENERIC_UKI_CMDLINE
+# @USER_VARIABLE
+# @DESCRIPTION:
+# If KERNEL_IUSE_GENERIC_UKI is set, this variable allows setting the
+# built-in kernel command line for the UKI. If unset, the default is
+# root=/dev/gpt-auto-root ro
+: "${KERNEL_GENERIC_UKI_CMDLINE:="root=/dev/gpt-auto-root ro"}"
+
if [[ ${KERNEL_IUSE_MODULES_SIGN} ]]; then
IUSE+=" modules-sign"
REQUIRED_USE="secureboot? ( modules-sign )"
@@ -381,7 +386,7 @@ kernel-build_src_install() {
dosym "../../../${kernel_dir}" "/lib/modules/${module_ver}/build"
dosym "../../../${kernel_dir}" "/lib/modules/${module_ver}/source"
- if [[ ${KERNEL_IUSE_SECUREBOOT} ]]; then
+ if [[ ${KERNEL_IUSE_MODULES_SIGN} ]]; then
secureboot_sign_efi_file "${image}"
fi
@@ -435,7 +440,7 @@ kernel-build_src_install() {
local ukify_args=(
--linux="${image}"
--initrd="${image%/*}/initrd"
- --cmdline="root=/dev/gpt-auto-root ro"
+ --cmdline="${KERNEL_GENERIC_UKI_CMDLINE}"
--uname="${dir_ver}"
--output="${image%/*}/uki.efi"
)
diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index b4c3d5fe7b4d..5a5b833cdd7b 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -63,16 +63,15 @@ RESTRICT+="
_IDEPEND_BASE="
!initramfs? (
|| (
- sys-kernel/installkernel-gentoo
- sys-kernel/installkernel-systemd
+ >=sys-kernel/installkernel-gentoo-8
+ >=sys-kernel/installkernel-systemd-2-r5
)
)
initramfs? (
>=sys-kernel/dracut-059-r4
|| (
- <=sys-kernel/installkernel-gentoo-7
>=sys-kernel/installkernel-gentoo-8[dracut(-)]
- sys-kernel/installkernel-systemd
+ >=sys-kernel/installkernel-systemd-2-r5
)
)
"
@@ -543,14 +542,11 @@ kernel-install_pkg_pretend() {
ewarn "for your hardware to work. If in doubt, it is recommended"
ewarn "to pause or abort the build process and install it before"
ewarn "resuming."
-
- if use initramfs; then
- elog
- elog "If you decide to install linux-firmware later, you can rebuild"
- elog "the initramfs via issuing a command equivalent to:"
- elog
- elog " emerge --config ${CATEGORY}/${PN}:${SLOT}"
- fi
+ elog
+ elog "If you decide to install linux-firmware later, you can rebuild"
+ elog "the initramfs via issuing a command equivalent to:"
+ elog
+ elog " emerge --config ${CATEGORY}/${PN}:${SLOT}"
fi
if ! use initramfs && ! has_version "${CATEGORY}/${PN}[-initramfs]"; then
@@ -633,13 +629,9 @@ kernel-install_extract_from_uki() {
# @FUNCTION: kernel-install_install_all
# @USAGE: <ver>
# @DESCRIPTION:
-# 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.
+# Install the kernel, initramfs/uki generation is optionally handled by
+# installkernel. This is called from pkg_postinst() and pkg_config().
+# <ver> is the full kernel version.
kernel-install_install_all() {
debug-print-function ${FUNCNAME} "${@}"
@@ -673,13 +665,6 @@ kernel-install_install_all() {
while :; do
nonfatal mount-boot_check_status || break
- 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 \
- "${image_dir}/initrd" "${module_ver}" || break
- fi
-
nonfatal dist-kernel_install_kernel "${module_ver}" \
"${image_path}" "${kernel_dir}/System.map" || break
@@ -743,7 +728,7 @@ kernel-install_pkg_prerm() {
kernel-install_pkg_postrm() {
debug-print-function ${FUNCNAME} "${@}"
- if [[ -z ${ROOT} && ! ${KERNEL_IUSE_GENERIC_UKI} ]] && use initramfs; then
+ if [[ -z ${ROOT} && ! ${KERNEL_IUSE_GENERIC_UKI} ]]; then
local dir_ver=${PV}${KV_LOCALVERSION}
local kernel_dir=${EROOT}/usr/src/linux-${dir_ver}
local image_path=$(dist-kernel_get_image_path)