kbuild: rpm-pkg: Fix manual debuginfo generation when using .src.rpm
Subsystems (2)
Nathan Chancellor
maintainerPATCH 1/1 kbuild: rpm-pkg: Fix manual debuginfo generation when using .src.rpm
Commit 62089b804895 ("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.
--- scripts/package/kernel.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/package/kernel.spec +2 -2
@@ -148,11 +148,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
---
base-commit: d59d7292d8b2f3123450e0ba573da6072fd869ef
change-id: 20260213-fix-debuginfo-srcrpm-pkg-2536cc1c6047
Best regards,
Signature · 1 line
Nathan Chancellor <[email protected]>
Nathan Chancellor
maintainerQuoted 9 lines · Nathan Chancellor
Commit
62089b804895("kbuild: rpm-pkg: Generate debuginfo package manually") added uses of OBJCOPY and READELF, variables fromKbuild. These variables are defined and work properly when using the binrpm-pkg target because rpmbuild is run withinKbuild. 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.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-fixes
Thanks!
[1/1] kbuild: rpm-pkg: Fix manual debuginfo generation when using .src.rpm
https://git.kernel.org/kbuild/c/afdfb71c018e9
Please look out for regression or issue reports or other follow up comments, as they may result in the patch/series getting dropped or reverted. Patches applied to an "unstable" branch are accepted pending wider testing in -next and any post-commit review; they will generally be moved to the main branch in a week if no issues are found.
Best regards,
Signature · 1 line
Nathan Chancellor <[email protected]>