Message ID | 20240817151147.156479-1-jose.fernandez@linux.dev (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [v2] kbuild: add debug package to pacman PKGBUILD | expand |
On Sat, Aug 17, 2024 at 09:11:47AM -0600, Jose Fernandez wrote: > Add a new debug package to the PKGBUILD for the pacman-pkg target. The > debug package includes the non-stripped vmlinux file, providing access > to debug symbols needed for kernel debugging and profiling. The vmlinux > file will be installed to /usr/src/debug/${pkgbase}. The debug package > will be built by default and can be excluded by overriding PACMAN_EXTRAPACKAGES. > > Signed-off-by: Jose Fernandez <jose.fernandez@linux.dev> > Reviewed-by: Peter Jung <ptr1337@cachyos.org> > --- > v1->v2: > - Use the new PACMAN_EXTRAPACKAGES [1] variable to allow users to disable the > debug package if desired, instead of always including it. > > [1] https://lore.kernel.org/lkml/20240813185900.GA140556@thelio-3990X/T/ > > scripts/package/PKGBUILD | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD > index fbd7eb10a52c..d40d282353de 100644 > --- a/scripts/package/PKGBUILD > +++ b/scripts/package/PKGBUILD > @@ -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 > @@ -106,6 +106,15 @@ _package-api-headers() { > ${MAKE} headers_install INSTALL_HDR_PATH="${pkgdir}/usr" > } > > +_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 > +} > + If you like to also include debug stuff for kernel modules, you might want to have a look at scripts/package/builddeb's install_linux_image_dbg. Kind regards, Nicolas
On 2024-08-17 09:11:47+0000, Jose Fernandez wrote: > Add a new debug package to the PKGBUILD for the pacman-pkg target. The > debug package includes the non-stripped vmlinux file, providing access > to debug symbols needed for kernel debugging and profiling. The vmlinux > file will be installed to /usr/src/debug/${pkgbase}. The debug package > will be built by default and can be excluded by overriding PACMAN_EXTRAPACKAGES. > > Signed-off-by: Jose Fernandez <jose.fernandez@linux.dev> > Reviewed-by: Peter Jung <ptr1337@cachyos.org> > --- > v1->v2: > - Use the new PACMAN_EXTRAPACKAGES [1] variable to allow users to disable the > debug package if desired, instead of always including it. > > [1] https://lore.kernel.org/lkml/20240813185900.GA140556@thelio-3990X/T/ > > scripts/package/PKGBUILD | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD > index fbd7eb10a52c..d40d282353de 100644 > --- a/scripts/package/PKGBUILD > +++ b/scripts/package/PKGBUILD > @@ -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 > @@ -106,6 +106,15 @@ _package-api-headers() { > ${MAKE} headers_install INSTALL_HDR_PATH="${pkgdir}/usr" > } > > +_package-debug(){ > + pkgdesc="Non-stripped vmlinux file for the ${pkgdesc} kernel" > + depends=(${pkgbase}-headers) > + > + cd "${objtree}" This should make use of _prologue() from "kbuild: pacman-pkg: move common commands to a separate function" https://lore.kernel.org/lkml/20240816141844.1217356-1-masahiroy@kernel.org/ It's not yet part of the kbuild tree, but I guess will be soon. > + mkdir -p "$pkgdir/usr/src/debug/${pkgbase}" The mkdir shouldn't be necessary, as install -D is used. > + install -Dt "$pkgdir/usr/src/debug/${pkgbase}" -m644 vmlinux Can you also add a symlink to /usr/lib/modules/$(uname -r)/build/vmlinux for compatibility with the vanilla package? > +} > + > for _p in "${pkgname[@]}"; do > eval "package_$_p() { > $(declare -f "_package${_p#$pkgbase}") > > base-commit: 869679673d3bbaaf1c2a43dba53930f5241e1d30 > -- > 2.46.0 >
On 24/08/17 07:15PM, Thomas Weißschuh wrote: > On 2024-08-17 09:11:47+0000, Jose Fernandez wrote: > > Add a new debug package to the PKGBUILD for the pacman-pkg target. The > > debug package includes the non-stripped vmlinux file, providing access > > to debug symbols needed for kernel debugging and profiling. The vmlinux > > file will be installed to /usr/src/debug/${pkgbase}. The debug package > > will be built by default and can be excluded by overriding PACMAN_EXTRAPACKAGES. > > > > Signed-off-by: Jose Fernandez <jose.fernandez@linux.dev> > > Reviewed-by: Peter Jung <ptr1337@cachyos.org> > > --- > > v1->v2: > > - Use the new PACMAN_EXTRAPACKAGES [1] variable to allow users to disable the > > debug package if desired, instead of always including it. > > > > [1] https://lore.kernel.org/lkml/20240813185900.GA140556@thelio-3990X/T/ > > > > scripts/package/PKGBUILD | 11 ++++++++++- > > 1 file changed, 10 insertions(+), 1 deletion(-) > > > > diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD > > index fbd7eb10a52c..d40d282353de 100644 > > --- a/scripts/package/PKGBUILD > > +++ b/scripts/package/PKGBUILD > > @@ -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 > > @@ -106,6 +106,15 @@ _package-api-headers() { > > ${MAKE} headers_install INSTALL_HDR_PATH="${pkgdir}/usr" > > } > > > > +_package-debug(){ > > + pkgdesc="Non-stripped vmlinux file for the ${pkgdesc} kernel" > > + depends=(${pkgbase}-headers) > > + > > + cd "${objtree}" > > This should make use of _prologue() from > "kbuild: pacman-pkg: move common commands to a separate function" > > https://lore.kernel.org/lkml/20240816141844.1217356-1-masahiroy@kernel.org/ > > It's not yet part of the kbuild tree, but I guess will be soon. Ack. I'll wait for that to be merged before I send out v3. > > + mkdir -p "$pkgdir/usr/src/debug/${pkgbase}" > > The mkdir shouldn't be necessary, as install -D is used. > > > + install -Dt "$pkgdir/usr/src/debug/${pkgbase}" -m644 vmlinux I'll remove the mkdir line in v3. > Can you also add a symlink to /usr/lib/modules/$(uname -r)/build/vmlinux > for compatibility with the vanilla package? Yes, will do. > > +} > > + > > for _p in "${pkgname[@]}"; do > > eval "package_$_p() { > > $(declare -f "_package${_p#$pkgbase}") > > > > base-commit: 869679673d3bbaaf1c2a43dba53930f5241e1d30 > > -- > > 2.46.0 > >
On Sun, Aug 18, 2024 at 12:12 AM Jose Fernandez <jose.fernandez@linux.dev> wrote: > > Add a new debug package to the PKGBUILD for the pacman-pkg target. The > debug package includes the non-stripped vmlinux file, providing access > to debug symbols needed for kernel debugging and profiling. The vmlinux > file will be installed to /usr/src/debug/${pkgbase}. The debug package > will be built by default and can be excluded by overriding PACMAN_EXTRAPACKAGES. > > Signed-off-by: Jose Fernandez <jose.fernandez@linux.dev> > Reviewed-by: Peter Jung <ptr1337@cachyos.org> > --- > v1->v2: > - Use the new PACMAN_EXTRAPACKAGES [1] variable to allow users to disable the > debug package if desired, instead of always including it. > > [1] https://lore.kernel.org/lkml/20240813185900.GA140556@thelio-3990X/T/ > > scripts/package/PKGBUILD | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD > index fbd7eb10a52c..d40d282353de 100644 > --- a/scripts/package/PKGBUILD > +++ b/scripts/package/PKGBUILD > @@ -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 > @@ -106,6 +106,15 @@ _package-api-headers() { > ${MAKE} headers_install INSTALL_HDR_PATH="${pkgdir}/usr" > } > > +_package-debug(){ > + pkgdesc="Non-stripped vmlinux file for the ${pkgdesc} kernel" > + depends=(${pkgbase}-headers) Why is this dependency necessary? > + > + cd "${objtree}" > + mkdir -p "$pkgdir/usr/src/debug/${pkgbase}" > + install -Dt "$pkgdir/usr/src/debug/${pkgbase}" -m644 vmlinux > +} > + > for _p in "${pkgname[@]}"; do > eval "package_$_p() { > $(declare -f "_package${_p#$pkgbase}") > > base-commit: 869679673d3bbaaf1c2a43dba53930f5241e1d30 > -- > 2.46.0 > >
On 24/08/18 09:35PM, Masahiro Yamada wrote: > On Sun, Aug 18, 2024 at 12:12 AM Jose Fernandez > <jose.fernandez@linux.dev> wrote: > > > > Add a new debug package to the PKGBUILD for the pacman-pkg target. The > > debug package includes the non-stripped vmlinux file, providing access > > to debug symbols needed for kernel debugging and profiling. The vmlinux > > file will be installed to /usr/src/debug/${pkgbase}. The debug package > > will be built by default and can be excluded by overriding PACMAN_EXTRAPACKAGES. > > > > Signed-off-by: Jose Fernandez <jose.fernandez@linux.dev> > > Reviewed-by: Peter Jung <ptr1337@cachyos.org> > > --- > > v1->v2: > > - Use the new PACMAN_EXTRAPACKAGES [1] variable to allow users to disable the > > debug package if desired, instead of always including it. > > > > [1] https://lore.kernel.org/lkml/20240813185900.GA140556@thelio-3990X/T/ > > > > scripts/package/PKGBUILD | 11 ++++++++++- > > 1 file changed, 10 insertions(+), 1 deletion(-) > > > > diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD > > index fbd7eb10a52c..d40d282353de 100644 > > --- a/scripts/package/PKGBUILD > > +++ b/scripts/package/PKGBUILD > > @@ -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 > > @@ -106,6 +106,15 @@ _package-api-headers() { > > ${MAKE} headers_install INSTALL_HDR_PATH="${pkgdir}/usr" > > } > > > > +_package-debug(){ > > + pkgdesc="Non-stripped vmlinux file for the ${pkgdesc} kernel" > > + depends=(${pkgbase}-headers) > > > Why is this dependency necessary? > Hi Masahiro, My thinking was that you may need System.map in combination with vmlinux for debugging with tools like crash. I don't have a strong opinions on this, so I'm I can remove it if you or others think it's not necessary. > > + > > + cd "${objtree}" > > + mkdir -p "$pkgdir/usr/src/debug/${pkgbase}" > > + install -Dt "$pkgdir/usr/src/debug/${pkgbase}" -m644 vmlinux > > +} > > + > > for _p in "${pkgname[@]}"; do > > eval "package_$_p() { > > $(declare -f "_package${_p#$pkgbase}") > > > > base-commit: 869679673d3bbaaf1c2a43dba53930f5241e1d30 > > -- > > 2.46.0 > > > > > > > -- > Best Regards > Masahiro Yamada
On Tue, Aug 20, 2024 at 11:29 PM Jose Fernandez <jose.fernandez@linux.dev> wrote: > > On 24/08/18 09:35PM, Masahiro Yamada wrote: > > On Sun, Aug 18, 2024 at 12:12 AM Jose Fernandez > > <jose.fernandez@linux.dev> wrote: > > > > > > Add a new debug package to the PKGBUILD for the pacman-pkg target. The > > > debug package includes the non-stripped vmlinux file, providing access > > > to debug symbols needed for kernel debugging and profiling. The vmlinux > > > file will be installed to /usr/src/debug/${pkgbase}. The debug package > > > will be built by default and can be excluded by overriding PACMAN_EXTRAPACKAGES. > > > > > > Signed-off-by: Jose Fernandez <jose.fernandez@linux.dev> > > > Reviewed-by: Peter Jung <ptr1337@cachyos.org> > > > --- > > > v1->v2: > > > - Use the new PACMAN_EXTRAPACKAGES [1] variable to allow users to disable the > > > debug package if desired, instead of always including it. > > > > > > [1] https://lore.kernel.org/lkml/20240813185900.GA140556@thelio-3990X/T/ > > > > > > scripts/package/PKGBUILD | 11 ++++++++++- > > > 1 file changed, 10 insertions(+), 1 deletion(-) > > > > > > diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD > > > index fbd7eb10a52c..d40d282353de 100644 > > > --- a/scripts/package/PKGBUILD > > > +++ b/scripts/package/PKGBUILD > > > @@ -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 > > > @@ -106,6 +106,15 @@ _package-api-headers() { > > > ${MAKE} headers_install INSTALL_HDR_PATH="${pkgdir}/usr" > > > } > > > > > > +_package-debug(){ > > > + pkgdesc="Non-stripped vmlinux file for the ${pkgdesc} kernel" > > > + depends=(${pkgbase}-headers) > > > > > > Why is this dependency necessary? > > > Hi Masahiro, > My thinking was that you may need System.map in combination with vmlinux for > debugging with tools like crash. I don't have a strong opinions on this, so I'm > I can remove it if you or others think it's not necessary. It is better to not add unnecessary code.
On 24/08/17 05:54PM, Nicolas Schier wrote: > On Sat, Aug 17, 2024 at 09:11:47AM -0600, Jose Fernandez wrote: > > Add a new debug package to the PKGBUILD for the pacman-pkg target. The > > debug package includes the non-stripped vmlinux file, providing access > > to debug symbols needed for kernel debugging and profiling. The vmlinux > > file will be installed to /usr/src/debug/${pkgbase}. The debug package > > will be built by default and can be excluded by overriding PACMAN_EXTRAPACKAGES. > > > > Signed-off-by: Jose Fernandez <jose.fernandez@linux.dev> > > Reviewed-by: Peter Jung <ptr1337@cachyos.org> > > --- > > v1->v2: > > - Use the new PACMAN_EXTRAPACKAGES [1] variable to allow users to disable the > > debug package if desired, instead of always including it. > > > > [1] https://lore.kernel.org/lkml/20240813185900.GA140556@thelio-3990X/T/ > > > > scripts/package/PKGBUILD | 11 ++++++++++- > > 1 file changed, 10 insertions(+), 1 deletion(-) > > > > diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD > > index fbd7eb10a52c..d40d282353de 100644 > > --- a/scripts/package/PKGBUILD > > +++ b/scripts/package/PKGBUILD > > @@ -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 > > @@ -106,6 +106,15 @@ _package-api-headers() { > > ${MAKE} headers_install INSTALL_HDR_PATH="${pkgdir}/usr" > > } > > > > +_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 > > +} > > + > > If you like to also include debug stuff for kernel modules, you might > want to have a look at scripts/package/builddeb's install_linux_image_dbg. Hi Nicolas, thank you for the suggestion. I'll iterate on the debug stuff for kernel modules in a follow-up patch to keep this one focused on vmlinux.
diff --git a/scripts/package/PKGBUILD b/scripts/package/PKGBUILD index fbd7eb10a52c..d40d282353de 100644 --- a/scripts/package/PKGBUILD +++ b/scripts/package/PKGBUILD @@ -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 @@ -106,6 +106,15 @@ _package-api-headers() { ${MAKE} headers_install INSTALL_HDR_PATH="${pkgdir}/usr" } +_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 +} + for _p in "${pkgname[@]}"; do eval "package_$_p() { $(declare -f "_package${_p#$pkgbase}")