From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (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 48FB41582EF for ; Mon, 03 Mar 2025 17:47:57 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (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) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 2F1CB3431B3 for ; Mon, 03 Mar 2025 17:47:57 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 2B3921102D0; Mon, 03 Mar 2025 17:47:56 +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 bobolink.gentoo.org (Postfix) with ESMTPS id 207271102D0 for ; Mon, 03 Mar 2025 17:47:56 +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 C18C93431AF for ; Mon, 03 Mar 2025 17:47:55 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 586A62729 for ; Mon, 03 Mar 2025 17:47:54 +0000 (UTC) From: "Nowa Ammerlaan" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Nowa Ammerlaan" Message-ID: <1741023954.bb7b3f56b8d85bb1c96d9d0b85a10769fb497005.nowa@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/dist-kernel-utils.eclass X-VCS-Directories: eclass/ X-VCS-Committer: nowa X-VCS-Committer-Name: Nowa Ammerlaan X-VCS-Revision: bb7b3f56b8d85bb1c96d9d0b85a10769fb497005 X-VCS-Branch: master Date: Mon, 03 Mar 2025 17:47:54 +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: c4b5fdf6-6eb4-47c7-a514-b134dff03300 X-Archives-Hash: d38d196e4f7e9e236de5611abf755eaf commit: bb7b3f56b8d85bb1c96d9d0b85a10769fb497005 Author: Nowa Ammerlaan gentoo org> AuthorDate: Sat Mar 1 12:09:25 2025 +0000 Commit: Nowa Ammerlaan gentoo org> CommitDate: Mon Mar 3 17:45:54 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bb7b3f56 dist-kernel-utils.eclass: pass on extra args to installkernel v56 Installkernel v56 has gained the capability of parsing optional arguments. Adjust the helper functions here so ebuilds can pass on these extra arguments directly to installkernel. Signed-off-by: Nowa Ammerlaan gentoo.org> eclass/dist-kernel-utils.eclass | 72 ++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 22 deletions(-) diff --git a/eclass/dist-kernel-utils.eclass b/eclass/dist-kernel-utils.eclass index 3d7315e9e94e..49977c18795a 100644 --- a/eclass/dist-kernel-utils.eclass +++ b/eclass/dist-kernel-utils.eclass @@ -66,18 +66,37 @@ dist-kernel_get_image_path() { } # @FUNCTION: dist-kernel_install_kernel -# @USAGE: +# @USAGE: [] [] [] [] [...] # @DESCRIPTION: -# Install kernel using installkernel tool. specifies -# the kernel version, full path to the image, -# full path to System.map. +# Install kernel using installkernel. Takes the following arguments: +# +# -- the target kernel version (default: ${KV_FULL}) +# +# -- the full path to the kernel image (default: the image +# as reported by dist-kernel_get_image_path() in the ${KV_DIR}) +# +# -- the full path to the System.map +# (default: ${KV_DIR}/System.map}) +# +# -- the target directory to install to (default: ${EROOT}/boot) +# +# -- extra optional arguments for installkernel +# see man kernel-install and man installkernel. Requires at +# least version 56 of sys-kernel/installkernel. dist-kernel_install_kernel() { debug-print-function ${FUNCNAME} "$@" - [[ ${#} -eq 3 ]] || die "${FUNCNAME}: invalid arguments" - local version=${1} - local image=${2} - local map=${3} + local version=${1:-${KV_FULL}} + local image=${2:-${KV_DIR}/$(dist-kernel_get_image_path)} + local map=${3:-${KV_DIR}/System.map} + local dir=${4:-${EROOT}/boot} + + local installkernel_args=( + "${version}" "${image}" "${map}" "${dir}" + ) + if has_version ">=sys-kernel/installkernel-56"; then + installkernel_args+=( "${@:5}" --verbose ) + fi local success= # not an actual loop but allows error handling with 'break' @@ -107,8 +126,7 @@ dist-kernel_install_kernel() { 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}" \ - "${EROOT}/boot" || break + ARCH=$(tc-arch-kernel) installkernel "${installkernel_args[@]}" || break eend ${?} || die -n "Installing the kernel failed" success=1 @@ -129,39 +147,49 @@ dist-kernel_install_kernel() { eerror "in the logs above and once you resolve the problems please" eerror "run the equivalent of the following command to try again:" eerror - eerror " emerge --config ${kernel}" + if has --all "${installkernel_args[@]}"; then + eerror " installkernel ${installkernel_args[*]}" + else + eerror " emerge --config ${kernel}" + fi die "Kernel install failed, please fix the problems and run emerge --config" fi } # @FUNCTION: dist-kernel_reinstall_initramfs -# @USAGE: +# @USAGE: [] [] [...] # @DESCRIPTION: # Rebuild and install initramfs for the specified dist-kernel. -# is the kernel source directory (${KV_DIR} from linux-info), -# while is the full kernel version (${KV_FULL}). -# The function will determine whether is actually -# a dist-kernel, and whether initramfs was used. +# Takes the following arguments: +# +# -- the full path to the target kernel (default: ${KV_DIR}) +# +# -- the target kernel version (default: ${KV_FULL}) +# +# -- extra optional arguments for installkernel +# see man kernel-install and man installkernel. Requires at +# least version 56 of sys-kernel/installkernel. # # This function is to be used in pkg_postinst() of ebuilds installing -# kernel modules that are included in the initramfs. +# kernel modules that are included in the initramfs. In order to +# reinstall *all* distribution kernels currently installed on the +# system add the --all argument (requires installkernel-56 or newer). dist-kernel_reinstall_initramfs() { debug-print-function ${FUNCNAME} "$@" - [[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments" - local kernel_dir=${1} - local ver=${2} + local kernel_dir=${1:-${KV_DIR}} + local ver=${2:-${KV_FULL}} local image_path=${kernel_dir}/$(dist-kernel_get_image_path) if [[ ! -f ${image_path} ]]; then eerror "Kernel install missing, image not found:" eerror " ${image_path}" - eerror "Initramfs will not be updated. Please reinstall your kernel." + eerror "Initramfs will not be updated. Please reinstall kernel ${ver}." return fi dist-kernel_install_kernel "${ver}" "${image_path}" \ - "${kernel_dir}/System.map" + "${kernel_dir}/System.map" "${EROOT}/boot" "${@:3}" } # @FUNCTION: dist-kernel_PV_to_KV