[PATCH] kbuild: add debug package to pacman PKGBUILD
From: Jose Fernandez
Date: Thu Aug 01 2024 - 09:30:54 EST
Add a new -debug package to the pacman PKGBUILD that will contain the
vmlinux image for debugging purposes. This package depends on the
-headers package and will be installed in /usr/src/debug/${pkgbase}.
The vmlinux image is needed to debug core dumps with tools like crash.
Signed-off-by: Jose Fernandez <jose.fernandez@xxxxxxxxx>
Reviewed-by: Peter Jung <ptr1337@xxxxxxxxxxx>
---
scripts/package/PKGBUILD | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD
index 663ce300dd06..beda3db21863 100644
--- a/scripts/package/PKGBUILD
+++ b/scripts/package/PKGBUILD
@@ -6,6 +6,7 @@ pkgbase=${PACMAN_PKGBASE:-linux-upstream}
pkgname=("${pkgbase}" "${pkgbase}-api-headers")
if grep -q CONFIG_MODULES=y include/config/auto.conf; then
pkgname+=("${pkgbase}-headers")
+ pkgname+=("${pkgbase}-debug")
fi
pkgver="${KERNELRELEASE//-/_}"
# The PKGBUILD is evaluated multiple times.
@@ -89,6 +90,15 @@ _package-headers() {
ln -sr "${builddir}" "${pkgdir}/usr/src/${pkgbase}"
}
+_package-debug(){
+ pkgdesc="Non-stripped vmlinux file for the ${pkgdesc} kernel"
+ depends=(${pkgbase}-headers)
+
+ cd "${objtree}"
+ mkdir -p "$pkgdir/usr/src/debug/${pkgbase}"
+ install -Dt "$pkgdir/usr/src/debug/${pkgbase}" -m644 vmlinux
+}
+
_package-api-headers() {
pkgdesc="Kernel headers sanitized for use in userspace"
provides=(linux-api-headers)
--
2.46.0