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 (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 3384B15812D for ; Thu, 02 Jan 2025 17:08:57 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D5668E0856; Thu, 02 Jan 2025 17:08:54 +0000 (UTC) Received: from smtp.gentoo.org (dev.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)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0246DE084A for ; Thu, 02 Jan 2025 17:08:54 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 476FC33BE3B for ; Thu, 02 Jan 2025 17:08:53 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B73CB1999 for ; Thu, 02 Jan 2025 17:08:50 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1735837710.9af7e9d11ede9c823e2904a9cf387d5e1286a4d0.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/dist-kernel-utils.eclass eclass/kernel-install.eclass eclass/linux-mod-r1.eclass X-VCS-Directories: eclass/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 9af7e9d11ede9c823e2904a9cf387d5e1286a4d0 X-VCS-Branch: master Date: Thu, 02 Jan 2025 17:08:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 29806df2-77fd-400a-b28c-b8b765871caa X-Archives-Hash: 942db8cb377857439a5638eebb0182e1 commit: 9af7e9d11ede9c823e2904a9cf387d5e1286a4d0 Author: Nowa Ammerlaan gentoo org> AuthorDate: Sun Dec 29 20:46:40 2024 +0000 Commit: Michał Górny gentoo org> CommitDate: Thu Jan 2 17:08:30 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9af7e9d1 dist-kernel-utils.eclass: implement basic support for install with ROOT Before this change the kernel installation is silently skipped in all cases. Using sys-kernel/installkernel to generate an initramfs/uki will indeed be a huge mess so when an initramfs is requested we now print a helpful error message. If we do not want an initramfs, or the initramfs/uki was generated with portage using USE=generic-uki then we can safely try to install the kernel. Installkernel-50 is capable of dealing with this situation in most cases, but it will print a bunch of warnings since plugins are skipped. Bootloader configuration, for example, cannot be updated in this case. For kernel modules we can also safely make this change, all modules that can be in the initramfs have the initramfs flag and if it is enabled then we will also hit this error message. End result of this change is more verbosity when kernel installation is skipped and basic support for installing the kernel with --root set for simple configurations (no initramfs or generic-uki with compat layout or uki layout). Signed-off-by: Nowa Ammerlaan gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/38842 Signed-off-by: Michał Górny gentoo.org> eclass/dist-kernel-utils.eclass | 25 +++++++++++++++++++++++-- eclass/kernel-install.eclass | 8 ++------ eclass/linux-mod-r1.eclass | 4 ++-- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass index 210c586c8c29..3d7315e9e94e 100644 --- a/eclass/dist-kernel-utils.eclass +++ b/eclass/dist-kernel-utils.eclass @@ -1,4 +1,4 @@ -# Copyright 2020-2024 Gentoo Authors +# Copyright 2020-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: dist-kernel-utils.eclass @@ -82,12 +82,33 @@ dist-kernel_install_kernel() { local success= # not an actual loop but allows error handling with 'break' while true; do + if [[ -n ${ROOT} ]] && in_iuse initramfs && use initramfs; then + if ! in_iuse generic-uki || ! use generic-uki; then + eerror + eerror "ROOT is set, and (re-)generation of an initramfs is requested" + eerror "via the USE=initramfs flag. However, this is currently not" + eerror "supported via the sys-kernel/installkernel mechanism." + eerror + if in_iuse generic-uki && ! use generic-uki; then + eerror "Generation and installation of a generic initramfs and/or" + eerror "Unified Kernel Image is possible via portage by enabling the" + eerror "USE=generic-uki flag. Please enable the generic-uki flag, or" + eerror "chroot into: ROOT=${ROOT}" + else + eerror "Please chroot into: ROOT=${ROOT}" + fi + break + fi + fi + nonfatal mount-boot_check_status || break + mkdir -p "${EROOT}/boot" || break ebegin "Installing the kernel via installkernel" # note: .config is taken relatively to System.map; # initrd relatively to bzImage - ARCH=$(tc-arch-kernel) installkernel "${version}" "${image}" "${map}" || break + ARCH=$(tc-arch-kernel) installkernel "${version}" "${image}" "${map}" \ + "${EROOT}/boot" || break eend ${?} || die -n "Installing the kernel failed" success=1 diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass index 5b4f3b096c41..6ca39e551110 100644 --- a/eclass/kernel-install.eclass +++ b/eclass/kernel-install.eclass @@ -716,9 +716,7 @@ kernel-install_pkg_postinst() { dist-kernel_compressed_module_cleanup \ "${EROOT}/lib/modules/${KV_FULL}" - if [[ -z ${ROOT} ]]; then - kernel-install_install_all "${KV_FULL}" - fi + kernel-install_install_all "${KV_FULL}" if [[ ${KERNEL_IUSE_GENERIC_UKI} ]] && use generic-uki; then ewarn "The prebuilt initramfs and unified kernel image are highly experimental!" @@ -740,7 +738,7 @@ kernel-install_pkg_postinst() { kernel-install_pkg_postrm() { debug-print-function ${FUNCNAME} "$@" - if [[ -z ${ROOT} && ! ${KERNEL_IUSE_GENERIC_UKI} ]]; then + if [[ ! ${KERNEL_IUSE_GENERIC_UKI} ]]; then local kernel_dir=${EROOT}/usr/src/linux-${KV_FULL} local image_path=$(dist-kernel_get_image_path) ebegin "Removing initramfs" @@ -754,8 +752,6 @@ kernel-install_pkg_postrm() { # @DESCRIPTION: # Rebuild the initramfs and reinstall the kernel. kernel-install_pkg_config() { - [[ -z ${ROOT} ]] || die "ROOT!=/ not supported currently" - if [[ -z ${KV_FULL} ]]; then KV_FULL=${PV}${KV_LOCALVERSION} fi diff --git a/eclass/linux-mod-r1.eclass b/eclass/linux-mod-r1.eclass index 4e5b17548b04..f6a5d4f187d8 100644 --- a/eclass/linux-mod-r1.eclass +++ b/eclass/linux-mod-r1.eclass @@ -1,4 +1,4 @@ -# Copyright 2023-2024 Gentoo Authors +# Copyright 2023-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: linux-mod-r1.eclass @@ -508,7 +508,7 @@ linux-mod-r1_pkg_postinst() { dist-kernel_compressed_module_cleanup "${EROOT}/lib/modules/${KV_FULL}" _modules_update_depmod - if [[ -z ${ROOT} && ${MODULES_INITRAMFS_IUSE} ]] && + if [[ ${MODULES_INITRAMFS_IUSE} ]] && use dist-kernel && use ${MODULES_INITRAMFS_IUSE#+} then dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"