Compare commits

..

No commits in common. "c9-beta" and "imports/c9-beta/kernel-srpm-macros-1.0-8.el9" have entirely different histories.

17 changed files with 180 additions and 637 deletions

View File

View File

@ -1,28 +0,0 @@
#! /bin/bash -efu
## A counterpart of brp-kmod-set-exec-bits that restores original kmod
## file permissions
# If using normal root, avoid changing anything.
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] || exit 0
# Checking for required programs
which chmod >/dev/null || exit 0
[ -r "$RPM_BUILD_ROOT/kmod-permissions.list" ] || exit 0
while read perm path; do
[ -n "$perm" ] || continue
# Account for possible kernel module compression
[ -e "$RPM_BUILD_ROOT/$path" ] || {
[ \! -e "$RPM_BUILD_ROOT/$path.gz" ] || path="$path.gz"
[ \! -e "$RPM_BUILD_ROOT/$path.bz2" ] || path="$path.bz2"
[ \! -e "$RPM_BUILD_ROOT/$path.xz" ] || path="$path.xz"
[ \! -e "$RPM_BUILD_ROOT/$path.zst" ] || path="$path.zst"
}
chmod "$perm" "$RPM_BUILD_ROOT/$path"
done < "$RPM_BUILD_ROOT/kmod-permissions.list"
rm -f "$RPM_BUILD_ROOT/kmod-permissions.list"

View File

@ -1,14 +0,0 @@
#! /bin/bash -efux
## A hack for making brp-strip taking into account kmod files
# If using normal root, avoid changing anything.
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] || exit 0
# Checking for required programs
which find chmod >/dev/null || exit 0
find "$RPM_BUILD_ROOT" \
-name '*.ko' \
-printf '%#m %P\n' \
-exec chmod u+x '{}' \; > "$RPM_BUILD_ROOT/kmod-permissions.list"

View File

@ -1,91 +1,24 @@
#! /bin/bash #! /bin/bash
IFS=$'\n' IFS=$'\n'
export LC_ALL=C
# Prevent elfutils from trying to download debuginfos for module in $(grep -E '/lib/modules/.+\.ko$'); do
unset DEBUGINFOD_URLS 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' \
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do | awk --non-decimal-data '{printf("ksym(%s) = 0x%08x\n", $2, $1)}' \
dep_pfx="ksym" | LC_ALL=C sort -u
# For built-in kmods, "kernel()" syntax is used instead of "ksym()" else
printf "%s" "$module" | grep -v "^${RPM_BUILD_ROOT}/\?lib/modules/[1-9][^/]*/kernel" > /dev/null \ ELFRODATA=$(readelf -R .rodata $module | awk '/0x/{printf $2$3$4$5}')
|| dep_pfx="kernel" if [[ -n $(readelf -h $module | grep "little endian") ]]; then
RODATA=$(echo $ELFRODATA | sed 's/\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/g')
tmpfile="" else
if [ "x${module%.ko}" = "x${module}" ]; then RODATA=$ELFRODATA
tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko) fi
proc_bin= for sym in $(nm $module | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do
case "${module##*.}" in echo $sym $RODATA
zst) done \
proc_bin=zstd | awk --non-decimal-data '{printf("ksym(%s) = 0x%08s\n", $2, substr($3,($1*2)+1,8))}' \
;; | LC_ALL=C sort -u
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 fi
done
# awk script return code:
# 0 - absolute __crc_* symbols have been found, output has been
# generated;
# 23 - a non-absolute __crc_* symbold has been found;
# 42 - no __crc_* symbols have been found.
nm "$module" \
| awk \
-v 'dep_pfx='"$dep_pfx" \
--non-decimal-data \
'BEGIN { exit_code = 42 }
match($0, /^([0-9a-f]+) (.) __crc_(.+)/, a) {
if (a[2] == "A") {
printf("%s(%s) = 0x%08x\n", dep_pfx, a[3], strtonum("0x" a[1]));
exit_code = 0;
} else {
exit_code = 23;
exit;
}
}
END { exit exit_code }'
[ 23 = "$?" ] && {
kmod_elf_hdr="$(readelf -h "$module")"
[ "x$kmod_elf_hdr" = "x${kmod_elf_hdr%Data:*little endian*}" ]
revbytes="$?"
objdump -t "$module" \
| awk \
-v 'dep_pfx='"$dep_pfx" \
-v 'module='"$module" \
-v 'revbytes='"$revbytes" \
--non-decimal-data \
'function readsect(name, a, t) {
a = "";
while (("readelf -R \"" name "\" \"" module "\"" | getline t) > 0) {
if (match(t, /^ 0x[0-9a-f]{8}/))
a = a substr(t, 14, 8) substr(t, 23, 8) substr(t, 32, 8) substr(t, 41, 8);
}
if (revbytes) { a = gensub(/(..)(..)(..)(..)/, "\\4\\3\\2\\1", "g", a); }
sectdata[name] = a;
}
match($0, /^([0-9a-f]+) [gl]...... (.*) [0-9a-f]+ __crc_(.*)$/, a) {
if (!(a[2] in sectdata)) { readsect(a[2]) }
printf("%s(%s) = 0x%08s\n", dep_pfx, a[3], substr(sectdata[a[2]], (strtonum("0x" a[1]) * 2) + 1, 8))
}'
}
[ -z "$tmpfile" ] || rm -f -- "$tmpfile"
done \
| sort -k1,1 -u

176
SOURCES/find-requires.ksyms Normal file → Executable file
View File

@ -1,96 +1,27 @@
#! /bin/bash #! /bin/bash
#
# This script is called during external module building to create dependencies
# both upon the RHEL kernel, and on additional external modules. Symbols that
# cannot be reconciled against those provided by the kernel are assumed to be
# provided by an external module and "ksym" replaces th regular "kernel" dep.
IFS=$'\n' IFS=$'\n'
export LC_ALL=C
# Prevent elfutils from trying to download debuginfos
unset DEBUGINFOD_URLS
# Extract all of the symbols provided by this module. # Extract all of the symbols provided by this module.
all_provides() { all_provides() {
for module in "$@"; do if [[ -n $(nm "$@" | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p') ]]; then
tmpfile="" nm "$@" \
if [ "x${module%.ko}" = "x${module}" ]; then | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p' \
tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko) | awk --non-decimal-data '{printf("0x%08x\t%s\n", $1, $2)}' \
proc_bin= | LC_ALL=C sort -k2,2 -u
case "${module##*.}" in else
zst) ELFRODATA=$(readelf -R .rodata "$@" | awk '/0x/{printf $2$3$4$5}')
proc_bin=zstd if [[ -n $(readelf -h "$@" | grep "little endian") ]]; then
;; RODATA=$(echo $ELFRODATA | sed 's/\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/g')
xz) else
proc_bin=xz RODATA=$ELFRODATA
;;
bz2)
proc_bin=bzip2
;;
gz)
proc_bin=gzip
;;
esac
[ -n "$proc_bin" ] || continue
"$proc_bin" -d -c - < "$module" > "$tmpfile" || continue
module="$tmpfile"
fi fi
for sym in $(nm "$@" | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do
# awk script return code: echo $sym $RODATA
# 0 - absolute __crc_* symbols have been found, output has been done \
# generated; | awk --non-decimal-data '{printf("0x%08s\t%s\n", substr($3,($1*2)+1,8), $2)}' \
# 23 - a non-absolute __crc_* symbold has been found; | LC_ALL=C sort -k2,2 -u
# 42 - no __crc_* symbols have been found. fi
nm "$module" \
| awk \
-v 'dep_pfx='"$dep_pfx" \
--non-decimal-data \
'BEGIN { exit_code = 42 }
match($0, /^([0-9a-f]+) (.) __crc_(.+)/, a) {
if (a[2] == "A") {
printf("%s(%s) = 0x%08x\n", dep_pfx, a[3], strtonum("0x" a[1]));
exit_code = 0;
} else {
exit_code = 23;
exit;
}
}
END { exit exit_code }'
[ 23 = "$?" ] && {
kmod_elf_hdr="$(readelf -h "$module")"
[ "x$kmod_elf_hdr" = "x${kmod_elf_hdr%Data:*little endian*}" ]
revbytes="$?"
objdump -t "$module" \
| awk \
-v 'dep_pfx='"$dep_pfx" \
-v 'module='"$module" \
-v 'revbytes='"$revbytes" \
--non-decimal-data \
'function readsect(name, a, t) {
a = "";
while (("readelf -R \"" name "\" \"" module "\"" | getline t) > 0) {
if (match(t, /^ 0x[0-9a-f]{8}/))
a = a substr(t, 14, 8) substr(t, 23, 8) substr(t, 32, 8) substr(t, 41, 8);
}
if (revbytes) { a = gensub(/(..)(..)(..)(..)/, "\\4\\3\\2\\1", "g", a); }
sectdata[name] = a;
}
match($0, /^([0-9a-f]+) [gl]...... (.*) [0-9a-f]+ __crc_(.*)$/, a) {
if (!(a[2] in sectdata)) { readsect(a[2]) }
printf("%s(%s) = 0x%08s\n", dep_pfx, a[3], substr(sectdata[a[2]], (strtonum("0x" a[1]) * 2) + 1, 8))
}'
}
[ -z "$tmpfile" ] || rm -f -- "$tmpfile"
done \
| sort -k1,1 -u
} }
# Extract all of the requirements of this module. # Extract all of the requirements of this module.
@ -100,18 +31,18 @@ all_requires() {
/sbin/modprobe --dump-modversions "$module" \ /sbin/modprobe --dump-modversions "$module" \
| awk --non-decimal-data ' | awk --non-decimal-data '
BEGIN { FS = "\t" ; OFS = "\t" } BEGIN { FS = "\t" ; OFS = "\t" }
{printf("%s:0x%08x\n", $2, $1)}' \ {printf("0x%08x\t%s\n", $1, $2)}' \
| sed -r -e 's:$:\t'"$1"':' | sed -r -e 's:$:\t'"$1"':'
done \ done \
| sort -k1,1 -u | LC_ALL=C sort -k2,2 -u
} }
# Filter out requirements fulfilled by the module itself. # Filter out requirements fulfilled by the module itself.
mod_requires() { mod_requires() {
join -t $'\t' -j 1 -v 1 \ LC_ALL=C join -t $'\t' -j 2 -v 1 \
<(all_requires "$@") \ <(all_requires "$@") \
<(all_provides "$@") \ <(all_provides "$@") \
| sort -k1,1 -u | LC_ALL=C sort -k1,1 -u
} }
if ! [ -e /sbin/modinfo -a -e /sbin/modprobe ]; then if ! [ -e /sbin/modinfo -a -e /sbin/modprobe ]; then
@ -119,50 +50,7 @@ if ! [ -e /sbin/modinfo -a -e /sbin/modprobe ]; then
exit 0 exit 0
fi fi
check_kabi() { modules=($(grep -E '/lib/modules/.+\.ko$'))
arch=$(uname -m)
kabi_file="/lib/modules/kabi-current/kabi_stablelist_$arch"
# If not installed, output a warning and return (continue)
if [ ! -f "$kabi_file" ]; then
echo "" >&2
echo "********************************************************************************" >&2
echo "*********************** KERNEL ABI COMPATIBILITY WARNING ***********************" >&2
echo "********************************************************************************" >&2
echo "The kernel ABI reference files (provided by "kabi-stablelists") were not found." >&2
echo "No compatibility check was performed. Please install the kABI reference files" >&2
echo "and rebuild if you would like to verify compatibility with kernel ABI." >&2
echo "" >&2
return
fi
unset non_kabi
for symbol in "$@"; do
if ! egrep "^[[:space:]]$symbol\$" $kabi_file >/dev/null; then
non_kabi=("${non_kabi[@]}" "$symbol")
fi
done
if [ ${#non_kabi[@]} -gt 0 ]; then
echo "" >&2
echo "********************************************************************************" >&2
echo "*********************** KERNEL ABI COMPATIBILITY WARNING ***********************" >&2
echo "********************************************************************************" >&2
echo "The following kernel symbols are not guaranteed to remain compatible with" >&2
echo "future kernel updates to this RHEL release:" >&2
echo "" >&2
for symbol in "${non_kabi[@]}"; do
printf "\t$symbol\n" >&2
done
echo "" >&2
echo "Red Hat recommends that you consider using only official kernel ABI symbols" >&2
echo "where possible. Requests for additions to the kernel ABI can be filed with" >&2
echo "your partner or customer representative (component: driver-update-program)." >&2
echo "" >&2
fi
}
modules=($(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@")
if [ ${#modules[@]} -gt 0 ]; then if [ ${#modules[@]} -gt 0 ]; then
kernel=$(/sbin/modinfo -F vermagic "${modules[0]}" | sed -e 's: .*::' -e q) kernel=$(/sbin/modinfo -F vermagic "${modules[0]}" | sed -e 's: .*::' -e q)
@ -171,24 +59,16 @@ if [ ${#modules[@]} -gt 0 ]; then
cat /usr/src/kernels/$kernel/Module.symvers | awk ' cat /usr/src/kernels/$kernel/Module.symvers | awk '
BEGIN { FS = "\t" ; OFS = "\t" } BEGIN { FS = "\t" ; OFS = "\t" }
{ print $2 ":" $1 } { print $2 "\t" $1 }
' \ ' \
| sed -r -e 's:$:\t'"$kernel"':' \ | sed -r -e 's:$:\t'"$kernel"':' \
| sort -k1,1 -u > $symvers | LC_ALL=C sort -k1,1 -u > $symvers
# Symbols matching with the kernel get a "kernel" dependency # Symbols matching with the kernel get a "kernel" dependency
mod_req=$(mktemp -t mod_req.XXXXX) LC_ALL=C join -t $'\t' -j 1 $symvers <(mod_requires "${modules[@]}") | LC_ALL=C sort -u \
mod_requires "${modules[@]}" > "$mod_req" | awk '{ FS = "\t" ; OFS = "\t" } { print "kernel(" $1 ") = " $2 }'
join -t $'\t' -j 1 $symvers "$mod_req" | sort -u \
| awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print "kernel(" $1 ") = " $2 }'
# Symbols from elsewhere get a "ksym" dependency # Symbols from elsewhere get a "ksym" dependency
join -t $'\t' -j 1 -v 2 $symvers "$mod_req" | sort -u \ LC_ALL=C join -t $'\t' -j 1 -v 2 $symvers <(mod_requires "${modules[@]}") | LC_ALL=C sort -u \
| awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print "ksym(" $1 ") = " $2 }' | awk '{ FS = "\t" ; OFS = "\t" } { print "ksym(" $1 ") = " $2 }'
# Check kABI if the kabi-stablelists package is installed
# Do this last so we can try to output this error at the end
kabi_check_symbols=($(join -t $'\t' -j 1 $symvers "$mod_req" | sort -u \
| awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print $1 }'))
check_kabi "${kabi_check_symbols[@]}"
fi fi

View File

@ -5,7 +5,7 @@
IFS=$'\n' IFS=$'\n'
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') $*; for module in $(grep -E '/lib/modules/.+\.ko$') $*;
do do
for firmware in `/sbin/modinfo -F firmware $module`; for firmware in `/sbin/modinfo -F firmware $module`;
do do

View File

@ -1,2 +0,0 @@
%__kabi_provides %{_rpmconfigdir}/kabi.sh
%__kabi_path ^(/boot/symvers-.*|/lib/modules/[1-9].*/symvers)\.(gz|xz)$

View File

@ -1,22 +0,0 @@
#!/bin/bash +x
#
# kabi.sh - Automatically extract any kernel symbol checksum from the
# symvers file and add to RPM deps. This is used to move the
# checksum checking from modprobe to rpm install for 3rd party
# modules (so they can fail during install and not at load).
IFS=$'\n'
for symvers in $(grep -E '(/boot/symvers-.*|/lib/modules/[1-9].*/symvers)\.(gz|xz)') "$@";
do
cat_prog="cat"
case "$symvers" in
*.gz) cat_prog="zcat" ;;
*.xz) cat_prog="xzcat" ;;
esac
# We generate dependencies only for symbols exported by vmlinux itself
# and not for kmods here as they are spread across subpackages,
# so Provides: generation for kmods is handled by find-provides.ksyms.
"$cat_prog" "$symvers" | awk '/[^ ]* [^ ]* vmlinux .*/ { print "kernel(" $2 ") = " $1 }'
done

View File

@ -1,31 +1,21 @@
%__kmod_path ^/lib/modules/.*/(modules.builtin|.*\.ko|.*\.ko\.gz|.*\.ko\.bz2|.*\.ko\.xz|.*\.ko\.zst)$ %__kmod_path ^/lib/modules/.*/(modules.builtin|.*ko)
%__kmod_provides() %{lua: %__kmod_provides() %{lua:
function basename(fn) function basename(fn)
return string.gsub(fn, "(.*/)(.*)", "%2") return string.gsub(fn, "(.*/)(.*)", "%2")
end end
function strip_compress_sfx(fn)
return string.gsub(fn, "(.*)(\.gz|\.bz2|\.xz|\.zst)?$", "%1")
end
function printdep(mod) function printdep(mod)
print("kmod("..mod..") ") print("kmod("..mod..")")
end end
local fn = rpm.expand("%{1}") local fn = rpm.expand("%{1}")
local bn = basename(fn) local bn = basename(fn)
if bn == "modules.builtin" then if bn == "modules.builtin" then
for l in io.lines(fn) do for l in io.lines(fn) do
local builtin_mod = basename(l) printdep(basename(l))
printdep(builtin_mod)
if strip_compress_sfx(builtin_mod) ~= builtin_mod then
printdep(strip_compress_sfx(builtin_mod))
end
end end
else else
local mod = string.match(bn, "%g+.ko") local mod = string.match(bn, "%g+.ko")
if mod then if mod then
printdep(mod) printdep(mod)
if strip_compress_sfx(mod) ~= mod then
printdep(strip_compress_sfx(mod))
end
end end
end end
} }

View File

@ -1,12 +1,7 @@
#!/bin/bash #!/bin/bash
# kmodtool - Helper script for building kernel module RPMs # kmodtool - Helper script for building kernel module RPMs
# An original version appeared in Fedora. This version is # Copyright (c) 2003-2006 Ville Skyttä <ville.skytta@iki.fi>,
# generally called only by the %kernel_module_package RPM macro
# during the process of building Driver Update Packages (which
# are also known as "kmods" in the Fedora community).
#
# Copyright (c) 2003-2010 Ville Skyttä <ville.skytta@iki.fi>,
# Thorsten Leemhuis <fedora@leemhuis.info> # Thorsten Leemhuis <fedora@leemhuis.info>
# Jon Masters <jcm@redhat.com> # Jon Masters <jcm@redhat.com>
# #
@ -29,43 +24,34 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Changelog:
#
# 2010/07/28 - Add fixes for filelists in line with LF standard
# - Remove now defunct "framepointer" kernel variant
# - Change version to "rhel6-rh2" as a consequence.
#
# 2010/01/10 - Simplified for RHEL6. We are working on upstream
# moving to a newer format and in any case do not
# need to retain support for really old systems.
shopt -s extglob shopt -s extglob
myprog="kmodtool" myprog="kmodtool"
myver="0.10.10_rhel9" myver="0.10.10_kmp2"
knownvariants=@(debug|kdump|zfcpdump) knownvariants=@(BOOT|PAE|@(big|huge)mem|debug|enterprise|kdump|?(large)smp|uml|xen[0U]?(-PAE)|xen)
kmod_name= kmod_name=
kver= kver=
verrel= verrel=
variant= variant=
kmp=
get_verrel () get_verrel ()
{ {
verrel=${1:-$(uname -r)} verrel=${1:-$(uname -r)}
verrel=${verrel/%[.+]$knownvariants/} verrel=${verrel%%$knownvariants}
} }
print_verrel () print_verrel ()
{ {
get_verrel "$@" get_verrel $@
echo "${verrel}" echo "${verrel}"
} }
get_variant () get_variant ()
{ {
get_verrel "$@" get_verrel $@
variant=${1:-$(uname -r)} variant=${1:-$(uname -r)}
variant=${variant/#$verrel?(.+)/} variant=${variant##$verrel}
variant=${variant:-'""'} variant=${variant:-'""'}
} }
@ -75,176 +61,117 @@ print_variant ()
echo "${variant}" echo "${variant}"
} }
# Detect flavor separator character. We have to do that due to
# a systemd-tailored patch for kernel spec[1][2] introduced in Fedora and then
# imported in RHEL 8 that broke all OOT kmod infrastructure for the flavored
# kernels.
#
# [1] https://lists.fedoraproject.org/pipermail/kernel/2013-June/004262.html
# [2] https://src.fedoraproject.org/rpms/kernel/c/faf25207dc86666a611c45ae3ffaf385c170bd2a
#
# $1 - kver
# $2 - variant
get_variant_char ()
{
variant="$2"
[ "$variant" != "default" ] || variant=""
get_verrel "$1"
variant_char=""
[ -n "$variant" ] || return 0
# We expect that the flavored kernel is already installed in the buildroot
variant_char="+"
[ -e "/usr/src/kernels/${verrel}+${variant}" ] && return 0
variant_char="."
}
print_variant_char ()
{
get_variant_char "$@"
echo "${variant_char}"
}
print_kernel_source ()
{
get_variant_char "$@"
echo "/usr/src/kernels/${verrel}${variant_char}${variant}"
}
get_filelist() {
local IFS=$'\n'
filelist=($(cat))
if [ ${#filelist[@]} -gt 0 ];
then
for ((n = 0; n < ${#filelist[@]}; n++));
do
line="${filelist[n]}"
line=$(echo "$line" \
| sed -e "s/%verrel/$verrel/g" \
| sed -e "s/%variant/$variant/g" \
| sed -e "s/%dashvariant/$dashvariant/g" \
| sed -e "s/%dotvariant/$dotvariant/g" \
| sed -e "s/\+%1/$dotvariant/g" \
| sed -e "s/\.%1/$dotvariant/g" \
| sed -e "s/\-%1/$dotvariant/g" \
| sed -e "s/%2/$verrel/g")
echo "$line"
done
else
echo "%defattr(644,root,root,755)"
echo "/lib/modules/${verrel}${dotvariant}"
fi
}
get_rpmtemplate () get_rpmtemplate ()
{ {
local variant="${1}" local variant="${1}"
get_variant_char "${verrel}" "${variant}"
local dashvariant="${variant:+-${variant}}" local dashvariant="${variant:+-${variant}}"
local dotvariant="${variant:+${variant_char}${variant}}" case "$verrel" in
*.el*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;;
*.EL*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;;
*) kdep="kernel-%{_target_cpu} = ${verrel}${variant}" ;;
esac
echo "%package -n kmod-${kmod_name}${dashvariant}" echo "%package -n kmod-${kmod_name}${dashvariant}"
if [ -z "$kmod_provides_summary" ]; then if [ -z "$kmp_provides_summary" ]; then
echo "Summary: ${kmod_name} kernel module(s)" echo "Summary: ${kmod_name} kernel module(s)"
fi fi
if [ -z "$kmod_provides_group" ]; then if [ -z "$kmp_provides_group" ]; then
echo "Group: System Environment/Kernel" echo "Group: System Environment/Kernel"
fi fi
if [ ! -z "$kmod_version" ]; then if [ ! -z "$kmp_version" ]; then
echo "Version: %{kmod_version}" echo "Version: %{kmp_version}"
fi fi
if [ ! -z "$kmod_release" ]; then if [ ! -z "$kmp_release" ]; then
echo "Release: %{kmod_release}" echo "Release: %{kmp_release}"
fi
if [ ! -z "$kmp" ]; then
echo "%global _use_internal_dependency_generator 0"
fi fi
cat <<EOF cat <<EOF
Provides: kernel-modules >= ${verrel}${dotvariant} Provides: kernel-modules = ${verrel}${variant}
Provides: kernel${dashvariant}-modules >= ${verrel}
Provides: ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} Provides: ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
Requires(post): /usr/sbin/depmod
Requires(postun): /usr/sbin/depmod
Requires(post): /usr/sbin/weak-modules
Requires(postun): /usr/sbin/weak-modules
EOF EOF
if [ "yes" != "$nobuildreqs" ] if [ -z "$kmp" ]; then
then echo "Requires: ${kdep}"
cat <<EOF
BuildRequires: kernel${dashvariant}-devel
BuildRequires: kernel-abi-stablelists
BuildRequires: redhat-rpm-config kernel-rpm-macros
BuildRequires: elfutils-libelf-devel kmod
EOF
fi fi
if [ "" != "$override_preamble" ] #
then # RHEL5 - Remove common package requirement on general kmod packages.
cat "$override_preamble" # Requires: ${kmod_name}-kmod-common >= %{?epoch:%{epoch}:}%{version}
fi #
cat <<EOF
Requires(post): /sbin/depmod
Requires(postun): /sbin/depmod
EOF
if [ "no" != "$kmp_nobuildreqs" ]
then
echo "BuildRequires: kernel${dashvariant}-devel-%{_target_cpu} = ${verrel}"
fi
if [ "" != "$kmp_override_preamble" ]
then
cat "$kmp_override_preamble"
fi
cat <<EOF cat <<EOF
%description -n kmod-${kmod_name}${dashvariant} %description -n kmod-${kmod_name}${dashvariant}
This package provides the ${kmod_name} kernel modules built for This package provides the ${kmod_name} kernel modules built for the Linux
the Linux kernel ${verrel}${dotvariant} for the %{_target_cpu} kernel ${verrel}${variant} for the %{_target_cpu} family of processors.
family of processors.
EOF
##############################################################################
## The following are not part of this script directly, they are scripts ##
## that will be executed by RPM during various stages of package processing ##
##############################################################################
cat <<EOF
%post -n kmod-${kmod_name}${dashvariant} %post -n kmod-${kmod_name}${dashvariant}
if [ -e "/boot/System.map-${verrel}${dotvariant}" ]; then if [ -e "/boot/System.map-${verrel}${variant}" ]; then
/usr/sbin/depmod -aeF "/boot/System.map-${verrel}${dotvariant}" "${verrel}${dotvariant}" > /dev/null || : /sbin/depmod -aeF "/boot/System.map-${verrel}${variant}" "${verrel}${variant}" > /dev/null || :
fi
modules=( \$(find /lib/modules/${verrel}${dotvariant}/extra/${kmod_name} | grep -E '\.ko(\.gz|\.bz2|\.xz|\.zst)?$') )
if [ -x "/usr/sbin/weak-modules" ]; then
printf '%s\n' "\${modules[@]}" \
| /usr/sbin/weak-modules --add-modules
fi fi
EOF EOF
cat <<EOF if [ ! -z "$kmp" ]; then
cat <<EOF
modules=( \$(find /lib/modules/${verrel}${variant}/extra/${kmod_name}) )
if [ -x "/sbin/weak-modules" ]; then
printf '%s\n' "\${modules[@]}" \
| /sbin/weak-modules --add-modules
fi
%preun -n kmod-${kmod_name}${dashvariant} %preun -n kmod-${kmod_name}${dashvariant}
rpm -ql kmod-${kmod_name}${dashvariant}-%{kmod_version}-%{kmod_release}.$(arch) | grep -E '\.ko(\.gz|\.bz2|\.xz|\.zst)?$' > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules rpm -ql kmod-${kmod_name}${dashvariant} | grep '\.ko$' \
> /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
EOF EOF
cat <<EOF fi
cat <<EOF
%postun -n kmod-${kmod_name}${dashvariant} %postun -n kmod-${kmod_name}${dashvariant}
if [ -e "/boot/System.map-${verrel}${dotvariant}" ]; then /sbin/depmod -aF /boot/System.map-${verrel}${variant} ${verrel}${variant} &> /dev/null || :
/usr/sbin/depmod -aeF "/boot/System.map-${verrel}${dotvariant}" "${verrel}${dotvariant}" > /dev/null || : EOF
fi
if [ ! -z "$kmp" ]; then
cat <<EOF
modules=( \$(cat /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules) ) modules=( \$(cat /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules) )
rm /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules #rm /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
if [ -x "/usr/sbin/weak-modules" ]; then if [ -x "/sbin/weak-modules" ]; then
printf '%s\n' "\${modules[@]}" \ printf '%s\n' "\${modules[@]}" \
| /usr/sbin/weak-modules --remove-modules | /sbin/weak-modules --remove-modules
fi fi
EOF EOF
fi
echo "%files -n kmod-${kmod_name}${dashvariant}" echo "%files -n kmod-${kmod_name}${dashvariant}"
if [ "" == "$override_filelist" ]; if [ "" == "$kmp_override_filelist" ];
then then
echo "%defattr(644,root,root,755)" echo "%defattr(644,root,root,755)"
echo "/lib/modules/${verrel}${dotvariant}" echo "/lib/modules/${verrel}${variant}/"
echo "/lib/firmware/"
else else
cat "$override_filelist" | get_filelist cat "$kmp_override_filelist"
fi fi
} }
@ -287,12 +214,10 @@ Usage: ${myprog} <command> <option>+
- Get "base" version-release. - Get "base" version-release.
variant <uname> variant <uname>
- Get variant from uname. - Get variant from uname.
variant_char <uname> <variant>
- Get kernel variant separator character.
kernel_source <uname> <variant>
- Get path to kernel source directory.
rpmtemplate <mainpgkname> <uname> <variants> rpmtemplate <mainpgkname> <uname> <variants>
- Return a template for use in a source RPM - Return a template for use in a source RPM
rpmtemplate_kmp <mainpgkname> <uname> <variants>
- Return a template for use in a source RPM with KMP dependencies
version version
- Output version number and exit. - Output version number and exit.
EOF EOF
@ -303,22 +228,12 @@ while [ "${1}" ] ; do
case "${1}" in case "${1}" in
verrel) verrel)
shift shift
print_verrel "$@" print_verrel $@
exit $? exit $?
;; ;;
variant) variant)
shift shift
print_variant "$@" print_variant $@
exit $?
;;
variant_char)
shift
print_variant_char "$@"
exit $?
;;
kernel_source)
shift
print_kernel_source "$@"
exit $? exit $?
;; ;;
rpmtemplate) rpmtemplate)
@ -326,6 +241,12 @@ while [ "${1}" ] ; do
print_rpmtemplate "$@" print_rpmtemplate "$@"
exit $? exit $?
;; ;;
rpmtemplate_kmp)
shift
kmp=1
print_rpmtemplate "$@"
exit $?
;;
version) version)
echo "${myprog} ${myver}" echo "${myprog} ${myver}"
exit 0 exit 0

View File

@ -2,81 +2,50 @@
redhat_kernel_module_package 1 redhat_kernel_module_package 1
kernel_module_package_release 1 kernel_module_package_release 1
redhat_kmp_has_post_hooks 1 %__find_provides /usr/lib/rpm/redhat/find-provides
%__find_requires /usr/lib/rpm/redhat/find-requires
%__brp_kmod_set_exec_bit /usr/lib/rpm/redhat/brp-kmod-set-exec-bit
%__brp_kmod_restore_perms /usr/lib/rpm/redhat/brp-kmod-restore-perms
%__kmod_brps_added 0
#kernel_module_package [ -n name ] [ -v version ] [ -r release ] [ -s script ] #kernel_module_package [ -n name ] [ -v version ] [ -r release ] [ -s script ]
# [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ... # [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ...
%kernel_module_package_buildreqs %global kmodtool_generate_buildreqs 1 \ %kernel_module_package_buildreqs %global kmodtool_generate_buildreqs 1 \
kernel-devel kernel-abi-stablelists redhat-rpm-config kernel-rpm-macros elfutils-libelf-devel kmod kernel-devel
%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \ %kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \
## An ugly hack: we want kmods to be processed by find-debuginfo, %define kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
## but it processes only files with executable permission set. %define kmp_version %{-v*}%{!-v:%{version}} \
## It is important now since, as of now, if debuginfo package %define kmp_release %{-r*}%{!-r:%{release}} \
## is enabled (and it is enabled), there's an RPM build error %define latest_kernel %(rpm -q --qf '%{VERSION}-%{RELEASE}\\\\n' `rpm -q kernel-devel | /usr/lib/rpm/redhat/rpmsort -r | head -n 1` | head -n 1) \
## as a result of lack of ether absence or emptiness of
## debugsourcefiles.list (which is likely a bug in RPM, but it looks
## like that there's no obvious fix and apparently no one have
## any issues with this).
## In order to minimise intrusiveness, usually (in Red Hat-built kmod
## RPMs) *.ko files just have executable permission being set as a part
## of %build section. There are two caveats with kmp, however:
## * We have no control over %build section itself (and it wasn't
## required previously)
## * Changing the criteria used in find-debuginfo.sh/brp-strip
## for selecting files that have to undergo debug section separation
## may introduce regression.
## As a result, we insert additional hooks in __spec_install_post
## (__brp_kmod_set_exec_bit in the beginning and
## __brp_kmod_restore_perms in the end) that (temporarily) set
## executable permission for *.ko files so find-debuginfo.sh will pick
## them up.
## Unfortunately, __spec_install_post's body is copied here since
## we want that __debug_package macro expansion has been performed
## lazily and it looks like RPM has no ability to provide a body
## of a macro verbatim.
if [ 0 = "%{__kmod_brps_added}" ]; then \
echo "%%global __spec_install_post \\\\" \
echo " %%{?__brp_kmod_set_exec_bit} \\\\" \
echo " %%%%{?__debug_package:%%%%{__debug_install_post}} \\\\" \
echo " %%{__arch_install_post} \\\\" \
echo " %%{__os_install_post} \\\\" \
echo " %%{?__brp_kmod_pre_sign_process} \\\\" \
echo " %%{?__brp_kmod_sign} \\\\" \
echo " %%{?__brp_kmod_post_sign_process} \\\\" \
echo " %%{?__brp_kmod_compress} \\\\" \
echo " %%{?__brp_kmod_post_compress_process} \\\\" \
echo " %%{?__brp_kmod_restore_perms} \\\\" \
echo "%%{nil}" \
fi \
%global __kmod_brps_added 1 \
%global kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
%global kmod_version %{-v*}%{!-v:%{version}} \
%global kmod_release %{-r*}%{!-r:%{release}} \
%global latest_kernel %({ rpm -q --qf '%%{VERSION}-%%{RELEASE}.%%{ARCH}\\\\n' `rpm -qa | egrep "^kernel(-rt|-aarch64)?-devel" | /usr/lib/rpm/redhat/rpmsort -r | head -n 1`; echo '%%%%{nil}'; } | head -n 1) \
%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \ %{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \ %global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
flavors="default" \ flavors="default" \
if [ "i686" == "%{_target_cpu}" ] || [ "x86_64" == "%{_target_cpu}" ] \
then \
xenver=$(rpm -q kernel-xen-devel-%{kverrel}|head -n 1)\
kdver=$(rpm -q kernel-kdump-devel-%{kverrel}|head -n 1)\
if [ "kernel-xen-devel-%{kverrel}" == "$xenver" ] \
then \
flavors="$flavors xen" \
fi \
if [ "kernel-kdump-devel-%{kverrel}" == "$kdver" ] \
then \
flavors="$flavors kdump" \
fi \
fi \
if [ -z "%*" ]; then \ if [ -z "%*" ]; then \
flavors_to_build=$flavors \ flavors_to_build=$flavors \
elif [ -z "%{-x}" ]; then \ elif [ -z "%{-x}" ]; then \
flavors_to_build="%*" \ flavors_to_build="%*" \
else \ else \
flavors_to_build=" $flavors "\ flavors_to_build=" $flavors "\
echo "[$flavors_to_build]" >/tmp/tmp.txt
for i in %* \ for i in %* \
do \ do \
flavors_to_build=${flavors_to_build//$i /} flavors_to_build=${flavors_to_build//$i /}
done \ done \
fi \ fi \
echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \ echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
echo "%%global kernel_source() \\\$([ default = \"%%%%{1}\" ] && echo \"/usr/src/kernels//%%%%kverrel\" || %{kmodtool} kernel_source \"%%%%{kverrel}\" \"%%%%{1}\" 2>/dev/null || { ls -Ud \"/usr/src/kernels///%%%%{kverrel}\"[.+]\"%%%%{1}\" | sort -V | tail -n 1; } || echo \"/usr/src/kernels////%%%%kverrel.%%%%1\")" \ echo "%%global kernel_source() /usr/src/kernels/%kverrel.\\\$([ %%%%{1} = default ] || echo "%%%%{1}.")%_target_cpu" \
echo "%%global kernel_module_package_moddir() extra" \
if [ ! -z "%{-f*}" ] \ if [ ! -z "%{-f*}" ] \
then \ then \
filelist="%{-f*}" \ filelist="%{-f*}" \
@ -90,5 +59,5 @@ redhat_kmp_has_post_hooks 1
then \ then \
nobuildreqs="no" \ nobuildreqs="no" \
fi \ fi \
override_filelist="$filelist" override_preamble="$preamble" nobuildreqs="$nobuildreqs" kmod_version=%kmod_version kmod_release=%kmod_release %{kmodtool} rpmtemplate %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \ kmp_override_filelist="$filelist" kmp_override_preamble="$preamble" kmp_nobuildreqs="$nobuildreqs" %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \
)} )}

View File

@ -1,2 +0,0 @@
%__modalias_provides /usr/lib/rpm/redhat/find-provides.d/modalias.prov
%__modalias_path .*\.(ko|ko\.gz|ko\.bz2|ko\.xz|ko\.zst)$

View File

@ -1,4 +1,4 @@
#! /bin/bash -efu #! /bin/sh
# heavily based upon find-suggests.ksyms by Andreas Gruenbacher <agruen@suse.de>. # heavily based upon find-suggests.ksyms by Andreas Gruenbacher <agruen@suse.de>.
# with modifications by Michael Brown <Michael_E_Brown@dell.com> # with modifications by Michael Brown <Michael_E_Brown@dell.com>
@ -14,8 +14,7 @@ IFS=$'\n'
# completeness, so that we can determine when drivers are folded into # completeness, so that we can determine when drivers are folded into
# mainline kernel. # mainline kernel.
# #
is_kernel_package="" case "$1" in
case "${1:-}" in
kernel-module-*) ;; # Fedora kernel module package names start with kernel-module-*) ;; # Fedora kernel module package names start with
# kernel-module. # kernel-module.
kernel*) is_kernel_package=1 ;; kernel*) is_kernel_package=1 ;;
@ -26,11 +25,6 @@ if ! [ -z "$is_kernel_package" ]; then
exit 0 exit 0
fi fi
# Check for presence of the commands used
which /sbin/modinfo >/dev/null || exit 0
which sed >/dev/null || exit 0
which sort >/dev/null || exit 0
print_modaliases() { print_modaliases() {
declare class=$1 variants=$2 pos=$3 declare class=$1 variants=$2 pos=$3
if [ -n "$variants" ]; then if [ -n "$variants" ]; then
@ -41,7 +35,7 @@ print_modaliases() {
} }
combine_modaliases() { combine_modaliases() {
declare tag class variants="" pos="" n declare tag class variants pos n
read class read class
while read tag; do while read tag; do
for ((n=0; n<${#class}; n++)); do for ((n=0; n<${#class}; n++)); do
@ -64,15 +58,19 @@ combine_modaliases() {
print_modaliases "$class" "$variants" "$pos" print_modaliases "$class" "$variants" "$pos"
} }
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do for module in $(grep -E '/lib/modules/.+\.ko$') $*; do
# | head -n1 because some modules have *two* version tags. *cough*b44*cough* # | head -n1 because some modules have *two* version tags. *cough*b44*cough*
modver=$(/sbin/modinfo -F version "$module"| head -n1) modver=$(/sbin/modinfo -F version "$module"| head -n1)
modver=${modver//[^0-9a-zA-Z._]/_} modver=${modver// /_}
# only add version tag if it has a version
[ -z "$modver" ] || modver=" = $modver"
/sbin/modinfo -F alias "$module" \ # only add version tag if it has a version
| sed -nre "s,[^][0-9a-zA-Z._:*?/-],_,g; s,(.+),modalias(\\1)$modver,p" if [ -n "$modver" ]; then
/sbin/modinfo -F alias "$module" \
| sed -nre "s,(.+),modalias(\\1) = $modver,p"
else
/sbin/modinfo -F alias "$module" \
| sed -nre "s,(.+),modalias(\\1),p"
fi
done \ done \
| sort -u \ | sort -u \
| combine_modaliases | combine_modaliases

View File

@ -1,2 +0,0 @@
%__provided_ksyms_provides /usr/lib/rpm/redhat/find-provides.ksyms
%__provided_ksyms_path .*\.(ko|ko\.gz|ko\.bz2|ko\.xz|ko\.zst)$

View File

@ -1,4 +0,0 @@
%__required_ksyms_requires /usr/lib/rpm/redhat/find-requires.ksyms
%__required_ksyms_path .*\.(ko|ko\.gz|ko\.bz2|ko\.xz|ko\.zst)$
# Exclude built-in kernel modules
%__required_ksyms_exclude_path ^/lib/modules/[1-9][^/]*/kernel/.*

View File

@ -12,8 +12,8 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# MA 02110-1301 USA. # USA.
use Getopt::Long qw(:config gnu_getopt); use Getopt::Long qw(:config gnu_getopt);

View File

@ -1,6 +1,6 @@
Name: kernel-srpm-macros Name: kernel-srpm-macros
Version: 1.0 Version: 1.0
Release: 13%{?dist} Release: 8%{?dist}
Summary: RPM macros that list arches the full kernel is built on Summary: RPM macros that list arches the full kernel is built on
# This package only exist in Fedora repositories # This package only exist in Fedora repositories
# The license is the standard (MIT) specified in # The license is the standard (MIT) specified in
@ -11,22 +11,16 @@ URL: https://src.fedoraproject.org/rpms/kernel-srpm-macros
BuildArch: noarch BuildArch: noarch
# We are now the ones shipping kmod.attr # We are now the ones shipping kmod.attr
Conflicts: redhat-rpm-config <= 184 Conflicts: redhat-rpm-config <= 184
# macros.kmp, kmodtool and rpmsort were moved from kernel-rpm-macros
# to kernel-srpm-macros in 1.0-9/185-9
Conflicts: kernel-rpm-macros < 185-9
# Macros # Macros
Source0: macros.kernel-srpm Source0: macros.kernel-srpm
Source1: macros.kmp Source1: macros.kmp
# Dependency generator scripts # Dependency generator scripts (deprecated)
Source100: find-provides.ksyms Source100: find-provides.ksyms
Source101: find-requires.ksyms Source101: find-requires.ksyms
Source102: firmware.prov Source102: firmware.prov
Source103: modalias.prov Source103: modalias.prov
Source104: provided_ksyms.attr
Source105: required_ksyms.attr
Source106: modalias.attr
# Dependency generators & their rules # Dependency generators & their rules
Source200: kmod.attr Source200: kmod.attr
@ -36,14 +30,6 @@ Source300: kmodtool
Source301: rpmsort Source301: rpmsort
Source302: symset-table Source302: symset-table
# kabi provides generator
Source400: kabi.attr
Source401: kabi.sh
# BRPs
Source500: brp-kmod-set-exec-bit
Source501: brp-kmod-restore-perms
%global rrcdir /usr/lib/rpm/redhat %global rrcdir /usr/lib/rpm/redhat
@ -54,26 +40,10 @@ The variable to use is kernel_arches.
%package -n kernel-rpm-macros %package -n kernel-rpm-macros
Version: 185 Version: 185
Release: %{release} Release: %{release}%{?dist}.1
Summary: Macros and scripts for building kernel module packages Summary: Macros and scripts for building kernel module packages
Requires: redhat-rpm-config >= 13 Requires: redhat-rpm-config >= 13
# for brp-kmod-compress
Requires: %{_bindir}/xz
# for brp-kmod-compress, brp-kmod-set-exec-bit
Requires: %{_bindir}/find
# for find-provides.ksyms, find-requires.ksyms, kmodtool
Requires: %{_bindir}/sed
# for find-provides.ksyms, find-requires.ksyms
Requires: %{_bindir}/awk
Requires: %{_bindir}/grep
Requires: %{_bindir}/nm
Requires: %{_bindir}/objdump
Requires: %{_bindir}/readelf
# for find-requires.ksyms
Requires: %{_sbindir}/modinfo
Requires: %{_sbindir}/modprobe
%description -n kernel-rpm-macros %description -n kernel-rpm-macros
Macros and scripts for building kernel module packages. Macros and scripts for building kernel module packages.
@ -100,33 +70,20 @@ mkdir -p %{buildroot}%{rrcdir}/find-provides.d
mkdir -p %{buildroot}%{_fileattrsdir} mkdir -p %{buildroot}%{_fileattrsdir}
install -p -m 755 -t %{buildroot}%{rrcdir} kmodtool rpmsort symset-table install -p -m 755 -t %{buildroot}%{rrcdir} kmodtool rpmsort symset-table
install -p -m 755 -t %{buildroot}%{rrcdir} find-provides.ksyms find-requires.ksyms install -p -m 755 -t %{buildroot}%{rrcdir} find-provides.ksyms find-requires.ksyms
install -p -m 755 -t %{buildroot}%{rrcdir}/find-provides.d firmware.prov modalias.prov install -p -m 644 -t %{buildroot}%{rrcdir}/find-provides.d firmware.prov modalias.prov
install -p -m 755 -t %{buildroot}%{rrcdir} brp-kmod-restore-perms brp-kmod-set-exec-bit
install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.kmp install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.kmp
install -p -m 644 -t %{buildroot}%{_fileattrsdir} kmod.attr install -p -m 644 -t %{buildroot}%{_fileattrsdir} kmod.attr
install -p -m 644 -t "%{buildroot}%{_fileattrsdir}" kabi.attr
install -p -m 755 -t "%{buildroot}%{_rpmconfigdir}" kabi.sh
install -p -m 644 -t "%{buildroot}%{_fileattrsdir}" provided_ksyms.attr required_ksyms.attr
install -p -m 644 -t "%{buildroot}%{_fileattrsdir}" modalias.attr
%files %files
%{_rpmconfigdir}/macros.d/macros.kernel-srpm %{_rpmconfigdir}/macros.d/macros.kernel-srpm
%{_rpmconfigdir}/macros.d/macros.kmp
%{_fileattrsdir}/kmod.attr %{_fileattrsdir}/kmod.attr
%{rrcdir}/kmodtool
%{rrcdir}/rpmsort
%files -n kernel-rpm-macros %files -n kernel-rpm-macros
%{_rpmconfigdir}/kabi.sh %{_rpmconfigdir}/macros.d/macros.kmp
%{_fileattrsdir}/kabi.attr
%{_fileattrsdir}/modalias.attr
%{_fileattrsdir}/provided_ksyms.attr
%{_fileattrsdir}/required_ksyms.attr
%dir %{rrcdir}/find-provides.d %dir %{rrcdir}/find-provides.d
%{rrcdir}/brp-kmod-restore-perms %{rrcdir}/kmodtool
%{rrcdir}/brp-kmod-set-exec-bit %{rrcdir}/rpmsort
%{rrcdir}/symset-table %{rrcdir}/symset-table
%{rrcdir}/find-provides.ksyms %{rrcdir}/find-provides.ksyms
%{rrcdir}/find-requires.ksyms %{rrcdir}/find-requires.ksyms
@ -134,37 +91,6 @@ install -p -m 644 -t "%{buildroot}%{_fileattrsdir}" modalias.attr
%{rrcdir}/find-provides.d/modalias.prov %{rrcdir}/find-provides.d/modalias.prov
%changelog %changelog
* Mon Jun 12 2023 Eugene Syromiatnikov <esyr@redhat.com> - 1.0-13
- Handle symvers.xz in kabi.attr (#2209253).
- Fix indirect __crc_* sumbols parsing in find-provides.ksyms
and find-requires.ksyms to avoid matching multiple sections
producing bogus duplicate provides for kmods that have both __kcrctab
and __kcrctab_gpl sections (#2115811, #2178935).
- Call "readelf -R" on a correct section in find-requires.ksyms.
- Rewrite section data extraction in find-provides.ksyms and find-requires.ksyms
to avoid garbage at the end of extracted sections, causing unnecessary awk
complaints (#2115811).
- Perform section parsing inside the awk script in find-provides.ksyms
and find-requires.ksyms to avoid hitting command line argument limit
when handling large .rodata sections (#2178935).
* Tue Jan 31 2023 Eugene Syromiatnikov <esyr@redhat.com> - 1.0-12
- Support storing of __crc_* symbols in sections other than .rodata.
- Resolves: #2135047
* Thu Feb 17 2022 Eugene Syromiatnikov <esyr@redhat.com> - 1.0-11
- Work around a change in type of __crc_* symbols for some kmods printed by nm
on ppc64le and s390x
- Resolves: #2055464
* Thu Nov 18 2021 Eugene Syromiatnikov <esyr@redhat.com> - 1.0-10
- Add conflicts of kernel-srpm-macros with kernel-rpm-macros < 185-9
as macros.kmp, kmodtool, and rpmsort were moved from the latter
to the former.
* Mon Sep 20 2021 Eugene Syromiatnikov <esyr@redhat.com> - 1.0-9
- Update scripts with RHEL-specific changes.
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.0-8 * Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.0-8
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688 Related: rhbz#1991688