From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 257C4158451 for ; Sun, 7 Jan 2024 16:40:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 484922BC100; Sun, 7 Jan 2024 16:40:24 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CC5532BC0C0 for ; Sun, 7 Jan 2024 16:40:23 +0000 (UTC) Message-ID: <5a9fd463-84e8-4aee-9da9-7735986d54d3@gentoo.org> Date: Sun, 7 Jan 2024 17:40:19 +0100 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US, nl-NL To: gentoo-dev@lists.gentoo.org From: Andrew Ammerlaan Subject: [gentoo-dev] [PATCH] eclass/(dist-)kernel-*.eclass: drop installkernel-gentoo-7 Autocrypt: addr=andrewammerlaan@gentoo.org; keydata= xsBNBF3n3cUBCAC6uoDZ0XzaO29l8AzUblXQ5rxZI7nbGEnfFqjEQCK3oEXxsDa9Ez1myx3M ir53Vyx64Iz1Bq/TOS/PttgguPpiLggCpTTD2vavp5SwFmg272+P8bUJVJF2mMRm0OR/YPiA B5dNfcoLqKIj+ZMOtrZ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2CRAJY7la7TSv1lTD1cAEQEAAcLAfAQYAQgAJgIbDBYhBAb/U0G9gF2wvH0HpqGfY2zU7bzR BQJlNiHABQkJL3d7AAoJEKGfY2zU7bzRjDwH/1fp/87km2YYVgrfP1aWLjAA/TwcEVycRJQQ S9Q6xuzgD5AYhjzBSONoN46cwf+gla6xndY0lCawsZN7whtJ/DhqSZEfL0HgHkJ6T8FCXexf n1s6XmIAxqIrMmfsuOkAPLJIHzAAGzQX8DXcRSj1cIDUpa1Uy7ncVvI4EzJBRtJVJXIbl+53 NGauXU8ZuprPYkMSPuW3eHATFc0F5DhmlFUXh+HYYK+2QTO73TENMhngkrYcw63je5bRp/+f 72XFKlf1gXHK1ivg8nYueyUfrxZTBGKagusOiQeOao2I1uYcHoFhPYJrQWePMyZiYyB6PR0K DR4B/Ulo3v0eBXaaYzo= Organization: Gentoo Linux Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Archives-Salt: b0e5cde4-4ec9-4f25-8194-4938409a1724 X-Archives-Hash: 51d2f3e6c340515fa754cce20f941bd3 Part of https://github.com/gentoo/gentoo/pull/33727 From 0878f48e492b2c7bfd4b58c8f6dcfbfdbd642d8a Mon Sep 17 00:00:00 2001 From: Andrew Ammerlaan Date: Wed, 15 Nov 2023 19:59:06 +0100 Subject: [PATCH] eclass/(dist-)kernel-*.eclass: drop installkernel-gentoo-7 because we drop the generation of the initrd/uki here we can remove KERNEL_IUSE_SECUREBOOT since this is now exactly the same as KERNEL_IUSE_MODULES_SIGN Signed-off-by: Andrew Ammerlaan --- eclass/dist-kernel-utils.eclass | 78 --------------------------------- eclass/kernel-build.eclass | 13 +++--- eclass/kernel-install.eclass | 39 +++++------------ 3 files changed, 17 insertions(+), 113 deletions(-) diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass index 8ccffd0384742..13137f8c863c8 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: -# @DESCRIPTION: -# Build an initramfs for the kernel. specifies the absolute -# path where initramfs will be created, while 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 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 28f111ec998bb..f3a59559d1041 100644 --- a/eclass/kernel-build.eclass +++ b/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 @@ -381,7 +378,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 diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index b4c3d5fe7b4d9..5a5b833cdd7b6 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: # @DESCRIPTION: -# Build an initramfs for the kernel if required and install the kernel. -# This is called from pkg_postinst() and pkg_config(). 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(). +# 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)