kbuild: add debug package to pacman PKGBUILD
PATCH v3 1/1 kbuild: add debug package to pacman PKGBUILD
Add a new debug package to the PKGBUILD for the pacman-pkg target. The debug package includes the non-stripped vmlinux file with debug symbols for kernel debugging and profiling. The file is installed at /usr/src/debug/${pkgbase}, with a symbolic link at /usr/lib/modules/$(uname -r)/build/vmlinux. The debug package is built by default.
---v2->v3:
- Remove unnecessary mkdir -p "$pkgdir/usr/src/debug/${pkgbase}"
- Use the new _prologue() function [1]
- Add symbolic link to /usr/lib/modules/$(uname -r)/build/vmlinux
- Remove the dependency on the headers packagev1->v2:
- Use the new PACMAN_EXTRAPACKAGES [2] variable to allow users to disable the debug package if desired, instead of always including it.
[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/20240813185900.GA140556@thelio-3990X/T/
scripts/package/PKGBUILD | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
scripts/package/PKGBUILD +14 -1
@@ -5,7 +5,7 @@ pkgbase=${PACMAN_PKGBASE:-linux-upstream} pkgname=("${pkgbase}") -_extrapackages=${PACMAN_EXTRAPACKAGES-headers api-headers} +_extrapackages=${PACMAN_EXTRAPACKAGES-headers api-headers debug} for pkg in $_extrapackages; do pkgname+=("${pkgbase}-${pkg}") done
@@ -111,6 +111,19 @@ _package-api-headers() { ${MAKE} headers_install INSTALL_HDR_PATH="${pkgdir}/usr" } +_package-debug(){ + pkgdesc="Non-stripped vmlinux file for the ${pkgdesc} kernel" + + local debugdir="${pkgdir}/usr/src/debug/${pkgbase}" + local builddir="${pkgdir}/usr/${MODLIB}/build" + + _prologue + + install -Dt "${debugdir}" -m644 vmlinux + mkdir -p "${builddir}" + ln -sr "${debugdir}/vmlinux" "${builddir}/vmlinux" +} + for _p in "${pkgname[@]}"; do eval "package_$_p() { $(declare -f "_package${_p#$pkgbase}")
base-commit: df829331cf5cccb2a1fdd7560eabfcec49f9b990
Signature · 1 line
2.46.0
Quoted 9 lines · Jose Fernandez
Add a new debug package to the PKGBUILD for the pacman-pkg target. The debug package includes the non-stripped vmlinux file with debug symbols for kernel debugging and profiling. The file is installed at
/usr/src/debug/${pkgbase}, with a symbolic link at /usr/lib/modules/$(uname -r)/build/vmlinux. The debug package is built by default.Signed-off-by Jose Fernandez <[email protected]>Reviewed-by Peter Jung <[email protected]>
Thanks!
Quoted 54 lines
---
v2->v3:
- Remove unnecessary mkdir -p "$pkgdir/usr/src/debug/${pkgbase}"
- Use the new_prologue()function [1]
- Add symbolic link to /usr/lib/modules/$(uname -r)/build/vmlinux
- Remove the dependency on the headers packagev1->v2:
- Use the newPACMAN_EXTRAPACKAGES[2] variable to allow users to disable the debug package if desired, instead of always including it.[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/20240813185900.GA140556@thelio-3990X/T/scripts/package/PKGBUILD | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)scripts/package/PKGBUILD +14
-1@@ -5,7 +5,7 @@ pkgbase=${PACMAN_PKGBASE:-linux-upstream} pkgname=("${pkgbase}") -_extrapackages=${PACMAN_EXTRAPACKAGES-headers api-headers} +_extrapackages=${PACMAN_EXTRAPACKAGES-headers api-headers debug} for pkg in $_extrapackages; do pkgname+=("${pkgbase}-${pkg}") done@@ -111,6 +111,19 @@ _package-api-headers() { ${MAKE} headers_install INSTALL_HDR_PATH="${pkgdir}/usr" } +_package-debug(){ + pkgdesc="Non-stripped vmlinux file for the ${pkgdesc} kernel" + + local debugdir="${pkgdir}/usr/src/debug/${pkgbase}" + local builddir="${pkgdir}/usr/${MODLIB}/build" + + _prologue + + install -Dt "${debugdir}" -m644 vmlinux + mkdir -p "${builddir}" + ln -sr "${debugdir}/vmlinux" "${builddir}/vmlinux" +} + for _p in "${pkgname[@]}"; do eval "package_$_p() { $(declare -f "_package${_p#$pkgbase}")base-commit:
df829331cf5cccb2a1fdd7560eabfcec49f9b990Signature · 1 line
2.46.0
Quoted 10 lines · Jose Fernandez
Add a new debug package to the PKGBUILD for the pacman-pkg target. The debug package includes the non-stripped vmlinux file with debug symbols for kernel debugging and profiling. The file is installed at
/usr/src/debug/${pkgbase}, with a symbolic link at /usr/lib/modules/$(uname -r)/build/vmlinux. The debug package is built by default.Signed-off-by Jose Fernandez <[email protected]>Reviewed-by Peter Jung <[email protected]>
Applied to linux-kbuild.
Thanks!
Signature · 2 lines
Best Regards Masahiro Yamada