Skip to content

Commit afdfb71

Browse files
committed
kbuild: rpm-pkg: Fix manual debuginfo generation when using .src.rpm
Commit 62089b8 ("kbuild: rpm-pkg: Generate debuginfo package manually") added uses of OBJCOPY and READELF, variables from Kbuild. These variables are defined and work properly when using the binrpm-pkg target because rpmbuild is run within Kbuild. However, these variables are not defined when building from a source RPM package generated with the srcrpm-pkg target, breaking the build when generating the debug info subpackage. Define a default value for these variables so that these commands respect the value from Kbuild but continue to work when built from a source RPM package. Cc: stable@vger.kernel.org Fixes: 62089b8 ("kbuild: rpm-pkg: Generate debuginfo package manually") Reported-by: Lukas Herbolt <lukas@herbolt.com> Closes: https://lore.kernel.org/20260212135855.147906-2-lukas@herbolt.com/ Tested-by: Lukas Herbolt <lukas@herbolt.com> Link: https://patch.msgid.link/20260213-fix-debuginfo-srcrpm-pkg-v1-1-45cd0c0501b9@kernel.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>
1 parent ffe9ac1 commit afdfb71

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

scripts/package/kernel.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,11 @@ echo /usr/lib/debug/lib/modules/%{KERNELRELEASE}/vmlinux > %{buildroot}/debuginf
148148
while read -r mod; do
149149
mod="${mod%.o}.ko"
150150
dbg="%{buildroot}/usr/lib/debug/lib/modules/%{KERNELRELEASE}/kernel/${mod}"
151-
buildid=$("${READELF}" -n "${mod}" | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p')
151+
buildid=$("${READELF:-readelf}" -n "${mod}" | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p')
152152
link="%{buildroot}/usr/lib/debug/.build-id/${buildid}.debug"
153153

154154
mkdir -p "${dbg%/*}" "${link%/*}"
155-
"${OBJCOPY}" --only-keep-debug "${mod}" "${dbg}"
155+
"${OBJCOPY:-objcopy}" --only-keep-debug "${mod}" "${dbg}"
156156
ln -sf --relative "${dbg}" "${link}"
157157

158158
echo "${dbg#%{buildroot}}" >> %{buildroot}/debuginfo.list

0 commit comments

Comments
 (0)