It leads to some regressions in requires generation precision, though, as it is no longer possible to exclude requires that are satisfied by other kmods in the package. And calling a script on each file (instead of calling it on the whole file list at once) does not make things faster, either (so much for "sanity and benefit"). * find-provides.ksyms: Check for "$@" as well. * find-requires.ksyms: Likewise. * kernel-srpm-macros.spec (Source104, Source105, Source106): New attribute files. (%install): Install provided_ksyms.attr, required_ksyms.attr, and modalias.attr into "%{buildroot}%{_fileattrsdir}". (%files -n kernel-rpm-macros): Add provided_ksyms.attr, required_ksyms.attr, and modalias.attr. kmodtool: Remove "%global _use_internal_dependency_generator 0". macros.kmp: Remove %__find_provides and %__find_requires. * modalias.attr: New file. * provided_ksyms.attr: Likewise. * required_ksyms.attr: Likewise. Resolves: #1942072 Resolves: #1942563 Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
49 lines
1.5 KiB
Bash
Executable File
49 lines
1.5 KiB
Bash
Executable File
#! /bin/bash
|
|
|
|
IFS=$'\n'
|
|
|
|
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$') "$@"; do
|
|
tmpfile=""
|
|
if [ "x${module%.ko}" = "x${module}" ]; then
|
|
tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko)
|
|
proc_bin=
|
|
case "${module##*.}" in
|
|
xz)
|
|
proc_bin=xz
|
|
;;
|
|
bz2)
|
|
proc_bin=bzip2
|
|
;;
|
|
gz)
|
|
proc_bin=gzip
|
|
;;
|
|
esac
|
|
|
|
[ -n "$proc_bin" ] || continue
|
|
|
|
"$proc_bin" -d -c - < "$module" > "$tmpfile" || continue
|
|
module="$tmpfile"
|
|
fi
|
|
|
|
if [[ -n $(nm $module | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p') ]]; then
|
|
nm $module \
|
|
| sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p' \
|
|
| awk --non-decimal-data '{printf("ksym(%s) = 0x%08x\n", $2, $1)}' \
|
|
| LC_ALL=C sort -u
|
|
else
|
|
ELFRODATA=$(readelf -R .rodata $module | awk '/0x/{printf $2$3$4$5}')
|
|
if [[ -n $(readelf -h $module | grep "little endian") ]]; then
|
|
RODATA=$(echo $ELFRODATA | sed 's/\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/g')
|
|
else
|
|
RODATA=$ELFRODATA
|
|
fi
|
|
for sym in $(nm $module | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do
|
|
echo $sym $RODATA
|
|
done \
|
|
| awk --non-decimal-data '{printf("ksym(%s) = 0x%08s\n", $2, substr($3,($1*2)+1,8))}' \
|
|
| LC_ALL=C sort -u
|
|
fi
|
|
|
|
[ -z "$tmpfile" ] || rm -f -- "$tmpfile"
|
|
done
|