From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0.herbolt.com (mx0.herbolt.com [5.59.97.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB0EE1643B for ; Thu, 12 Feb 2026 19:28:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.59.97.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770924535; cv=none; b=Bs4bW1aEQaSvwtVZ7T3+Jun7/OyNKLY7OqPzWM5aeFn6RtUlqYTNOeB2sKK1FUXq/mO1szBv25SfZaK9fxaf63RDHV/rjthzquWK6Xkiw8D0PFdS2K8T9zwOfuDoAiy98ur//sxIAnwqgpE1SpL5K3V7k1hF3mqvbDGJXTnJDXo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770924535; c=relaxed/simple; bh=C69yzeRKxrkv/0DLvNhrJAzYO2wiWbrv0dAg0DbtJZk=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type; b=Z9XDwXIsIJHU5vLJN0bm9e8ZBCtatqyo2Ld/DLLG0uUFX02ZNxT1HLivH8ytOFI+eXpzse0btDEVB4TW/3U54oQP5nmm4mc74LMc9UC1oGHkL7KFy3dlv3QCQb8fEKRqpwJGHw2LVmf/AS4nkOJf5wp7v8/02+ytQD6ZqcUV15I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=herbolt.com; spf=pass smtp.mailfrom=herbolt.com; arc=none smtp.client-ip=5.59.97.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=herbolt.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=herbolt.com Received: from mx0.herbolt.com (localhost [127.0.0.1]) by mx0.herbolt.com (Postfix) with ESMTP id 31F7C180F2D5; Thu, 12 Feb 2026 20:28:46 +0100 (CET) Received: from mail.herbolt.com ([172.168.31.10]) by mx0.herbolt.com with ESMTPSA id YsrZA+4pjmkkpQEAKEJqOA (envelope-from ); Thu, 12 Feb 2026 20:28:46 +0100 Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Thu, 12 Feb 2026 20:28:46 +0100 From: Lukas Herbolt To: Nathan Chancellor Cc: nsc@kernel.org, linux-kbuild@vger.kernel.org Subject: Re: [PATCH] kbuild: rpm-pkg: Fix generating debuginfo manually. In-Reply-To: <20260212162643.GB802926@ax162> References: <20260212135855.147906-2-lukas@herbolt.com> <20260212162643.GB802926@ax162> Message-ID: <8c9a0d167e463c4e6275a77cf7980e28@herbolt.com> X-Sender: lukas@herbolt.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit On 2026-02-12 17:26, Nathan Chancellor wrote: > Hi Lukas, > > Thanks for the patch! > > On Thu, Feb 12, 2026 at 02:58:56PM +0100, Lukas Herbolt wrote: >> The ${OBJCOPY} and ${READELF} are not expanded into path to readelf >> and objcopy binary so just use the binary name with the %{_bindir} >> makro. >> >> Signed-off-by: Lukas Herbolt >> --- >> scripts/package/kernel.spec | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec >> index 0f1c8de1bd95..d032f6aff91b 100644 >> --- a/scripts/package/kernel.spec >> +++ b/scripts/package/kernel.spec >> @@ -109,11 +109,11 @@ echo >> /usr/lib/debug/lib/modules/%{KERNELRELEASE}/vmlinux > >> %{buildroot}/debuginf >> while read -r mod; do >> mod="${mod%.o}.ko" >> >> dbg="%{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}/kernel/${mod}" >> - buildid=$("${READELF}" -n "${mod}" | sed -n 's@^.*Build ID: >> \(..\)\(.*\)@\1/\2@p') >> + buildid=$(%{_bindir}/eu-readelf -n "${mod}" | sed -n 's@^.*Build ID: >> \(..\)\(.*\)@\1/\2@p') > > When using the binrpm-pkg target within Kbuild, I do see these expanded > to their Kbuild value: > > ++ .../toolchains/gcc/15.2.0/bin/x86_64-linux-readelf -n > net/ipv6/netfilter/nf_reject_ipv6.ko > ++ sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p' > > but I guess use of the spec file is not limited to being within Kbuild? > How are you using it? I guess using the srcrpm-pkg and building it > manually? Yes exactly; make srcrpm-pkg and then mock --rebuild (which actually runs rpmbuild in chroot). Looking into it I guess the variables should be expanded after the make srcrpm-pkg, but if I check the spec file: I can see: buildid=$("${READELF}" .... So the mkspec is not expanding the variable. > > I would prefer to keep use of these variables so that the user's choice > of toolchain is properly respected. The proper way to fix this is > likely > using a fallback only when the variable is not defined. Does this work > for your usecase? > > diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec > index 0f1c8de1bd95..c23ff98f63ed 100644 > --- a/scripts/package/kernel.spec > +++ b/scripts/package/kernel.spec > @@ -109,11 +109,11 @@ echo > /usr/lib/debug/lib/modules/%{KERNELRELEASE}/vmlinux > > %{buildroot}/debuginf > while read -r mod; do > mod="${mod%.o}.ko" > > dbg="%{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}/kernel/${mod}" > - buildid=$("${READELF}" -n "${mod}" | sed -n 's@^.*Build ID: > \(..\)\(.*\)@\1/\2@p') > + buildid=$("${READELF:-readelf}" -n "${mod}" | sed -n 's@^.*Build ID: > \(..\)\(.*\)@\1/\2@p') > link="%{buildroot}/usr/lib/debug/.build-id/${buildid}.debug" > > mkdir -p "${dbg%/*}" "${link%/*}" > - "${OBJCOPY}" --only-keep-debug "${mod}" "${dbg}" > + "${OBJCOPY:-objcopy}" --only-keep-debug "${mod}" "${dbg}" > ln -sf --relative "${dbg}" "${link}" > > echo "${dbg#%{buildroot}}" >> %{buildroot}/debuginfo.list Yeah that works for me. -- -lhe