debuginfo: Do not save uncompressed modules into debuginfo package

Save some space.

`.ko.debug` is enough. crash(8) (mod -s) and gdb (lx-symbols or file)
only need .ko.debug to load the symbols, for an _already_ loaded modules.

We won't be able to load the module directly into gdb (with `file x.ko`)
but we can load `x.ko.debug` in that case, or just uncompress it for
rare remaining cases.

Fedora and OpenSUSE also do not keep uncompressed files in -debuginfo
package, having non-.debug `.build-id` symlinks pointing to the air at
would-be-uncompressed `.ko` filename. Are there better ideas?

For 6.12 this install 4908 broken symlinks for zstd compressed kmodules.
Thus, messages flood the build log:

  find-provides: broken symbolic link /usr/src/tmp/kernel-image-6.12-buildroot/usr/lib/debug/.build-id/00/00ab26023bd664d7d14e851448aafdc50c21e9 -> ../../../../../lib/modules/6.12.0-6.12-alt0.rc4/kernel/drivers/usb/usbip/usbip-core.ko is not going to provide anything

This helps:

  %add_findprov_skiplist /usr/lib/debug/.build-id/*

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
This commit is contained in:
Виталий Чикунов 2024-10-26 03:13:42 +03:00
parent 1eca72bad4
commit b881ebe360
2 changed files with 6 additions and 16 deletions

View File

@ -35,21 +35,13 @@ while read -r f; do
Warning "Expected $f not found."
fi
fi
fbin=$f # Actual binary for linking
case "$f" in
/lib/modules/*.ko.[gx]z | /lib/modules/*.ko.zst)
# For gzipped modules actual binary is kept in debug tree
# (placed by debuginfo.brp) and goes into -debuginfo package.
f=${f%.*}
fbin=/usr/lib/debug$f
if [ -e ".$fbin" ]; then
printf '%s\n' "$fbin" >> .tmp/files
else
Warning "Expected $fbin not found."
fi
# Intentionally non-existent "uncompressed" file.
;;
esac
fbin=$f # Actual binary for linking
if [ -f .debuginfo/src/"$f" ]; then
LC_ALL=C sort -m -u -o .tmp/src .tmp/src .debuginfo/src/"$f"

View File

@ -32,15 +32,15 @@ elif [ -z "${f##./lib/modules/*.ko.*}" ]; then
case "$ext" in
gz)
unzip='gzip --force --decompress'
rezip='gzip --force --keep'
rezip='gzip --force'
;;
xz)
unzip='xz --force --decompress'
rezip='xz --check=crc32 --lzma2=dict=1MiB --force --keep'
rezip='xz --check=crc32 --lzma2=dict=1MiB --force'
;;
zst)
unzip='zstd --quiet --force --rm --decompress'
rezip='zstd --quiet --force'
rezip='zstd --quiet --force --rm'
;;
esac
# Compressed module: uncompress it, and work with uncompressed one.
@ -135,7 +135,5 @@ done >.debuginfo/src/"$f"
rm .tmp/src.$$
if [ -n "$rezip" ]; then
# Compress module, move uncompressed into debug tree.
$rezip --keep --force "$f"
mv "$f" ./usr/lib/debug"${f#.}"
$rezip "$f"
fi