@ -2,7 +2,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/find-provides.ksyms redhat-rpm-config-9.1
@@ -2,7 +2,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/find-provides.ksyms redhat-rpm-config-9.1
--- redhat-rpm-config-9.1.0_old/find-provides.ksyms 2013-03-22 10:48:56.344881194 +0800
+++ redhat-rpm-config-9.1.0/find-provides.ksyms 2013-03-22 10:49:31.727892674 +0800
@@ -4,6 +4,7 @@
for module in $(grep -E '/lib/modules/.+\.ko$'); do
nm $module \
- | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):ksym(\2) = \1:p'
@ -16,13 +16,13 @@ diff -Nuar redhat-rpm-config-9.1.0_old/find-requires redhat-rpm-config-9.1.0/fin
@@ -16,13 +16,13 @@ diff -Nuar redhat-rpm-config-9.1.0_old/find-requires redhat-rpm-config-9.1.0/fin
@@ -153,8 +153,7 @@
fi
done
-# Disabling for now while the Fedora kernel doesn't produce kABI deps.
-#[ -x /usr/lib/rpm/redhat/find-requires.ksyms ] && [ "$is_kmod" ] &&
-# printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/redhat/find-requires.ksyms
+[ -x /usr/lib/rpm/redhat/find-requires.ksyms ] && [ "$is_kmod" ] &&
+ printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/redhat/find-requires.ksyms
exit 0
diff -Nuar redhat-rpm-config-9.1.0_old/find-requires.ksyms redhat-rpm-config-9.1.0/find-requires.ksyms
--- redhat-rpm-config-9.1.0_old/find-requires.ksyms 2013-03-22 10:48:56.343881193 +0800
@ -34,9 +34,9 @@ diff -Nuar redhat-rpm-config-9.1.0_old/find-requires.ksyms redhat-rpm-config-9.1
@@ -34,9 +34,9 @@ diff -Nuar redhat-rpm-config-9.1.0_old/find-requires.ksyms redhat-rpm-config-9.1
+# 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'
+# Extract all of the symbols provided by this module.
all_provides() {
nm "$@" \
@ -46,7 +46,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/find-requires.ksyms redhat-rpm-config-9.1
@@ -46,7 +46,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/find-requires.ksyms redhat-rpm-config-9.1
+ | awk --non-decimal-data '{printf("0x%08x\t%s\n", $1, $2)}' \
+ | LANG=C sort -k2,2 -u
}
+# Extract all of the requirements of this module.
all_requires() {
for module in "$@"; do
@ -71,12 +71,12 @@ diff -Nuar redhat-rpm-config-9.1.0_old/find-requires.ksyms redhat-rpm-config-9.1
@@ -71,12 +71,12 @@ diff -Nuar redhat-rpm-config-9.1.0_old/find-requires.ksyms redhat-rpm-config-9.1
+ <(all_provides "$module") \
+ | LANG=C sort -k1,1 -u
}
if ! [ -e /sbin/modinfo -a -e /sbin/modprobe ]; then
@@ -22,27 +43,72 @@
exit 0
fi
+check_kabi() {
+ arch=$(uname -m)
+ kabi_file="/lib/modules/kabi/kabi_whitelist_$arch"
@ -126,7 +126,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/find-requires.ksyms redhat-rpm-config-9.1
@@ -126,7 +126,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/find-requires.ksyms redhat-rpm-config-9.1
- /usr/lib/rpm/redhat/symset-table | sort > $symset_table
+ kernel=$(/sbin/modinfo -F vermagic "${modules[0]}" | sed -e 's: .*::' -e q)
+ symvers=$(mktemp -t ${0##*/}.XXXXX)
- join -t $'\t' -j 1 -a 2 $symset_table <(
- # Filter out requirements that we fulfill ourself.
- join -t $'\t' -j 2 -v 1 \
@ -170,7 +170,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -170,7 +170,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
+++ redhat-rpm-config-9.1.0/kmodtool 2013-03-22 10:49:58.453903908 +0800
@@ -1,7 +1,12 @@
#!/bin/bash
# kmodtool - Helper script for building kernel module RPMs
-# Copyright (c) 2003-2006 Ville Skyttä <ville.skytta@iki.fi>,
+# An original version appeared in Fedora. This version is
@ -185,7 +185,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -185,7 +185,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -24,21 +29,30 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# 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
@ -197,7 +197,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -197,7 +197,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
+# need to retain support for really old systems.
+
shopt -s extglob
myprog="kmodtool"
myver="0.10.10_kmp2"
-knownvariants=@(BOOT|PAE|@(big|huge)mem|debug|enterprise|kdump|?(large)smp|uml|xen[0U]?(-PAE)|xen)
@ -207,14 +207,14 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -207,14 +207,14 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
verrel=
variant=
-kmp=
get_verrel ()
{
verrel=${1:-$(uname -r)}
- verrel=${verrel%%$knownvariants}
+ verrel=${verrel/%.$knownvariants/}
}
print_verrel ()
@@ -51,7 +65,7 @@
{
@ -224,11 +224,11 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -224,11 +224,11 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
+ variant=${variant/#$verrel?(.)/}
variant=${variant:-'""'}
}
@@ -61,117 +75,128 @@
echo "${variant}"
}
+get_filelist() {
+ local IFS=$'\n'
+ filelist=($(cat))
@ -253,7 +253,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -253,7 +253,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
+ echo "/lib/modules/${verrel}${dotvariant}"
+ fi
+}
+
+
+
get_rpmtemplate ()
{
@ -265,40 +265,40 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -265,40 +265,40 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
- *) kdep="kernel-%{_target_cpu} = ${verrel}${variant}" ;;
- esac
+ local dotvariant="${variant:+.${variant}}"
echo "%package -n kmod-${kmod_name}${dashvariant}"
- if [ -z "$kmp_provides_summary" ]; then
+ if [ -z "$kmod_provides_summary" ]; then
echo "Summary: ${kmod_name} kernel module(s)"
fi
- if [ -z "$kmp_provides_group" ]; then
+ if [ -z "$kmod_provides_group" ]; then
echo "Group: System Environment/Kernel"
fi
- if [ ! -z "$kmp_version" ]; then
- echo "Version: %{kmp_version}"
+ if [ ! -z "$kmod_version" ]; then
+ echo "Version: %{kmod_version}"
fi
- if [ ! -z "$kmp_release" ]; then
- echo "Release: %{kmp_release}"
+ if [ ! -z "$kmod_release" ]; then
+ echo "Release: %{kmod_release}"
fi
- if [ ! -z "$kmp" ]; then
- echo "%global _use_internal_dependency_generator 0"
- fi
-
-
- cat <<EOF
-Provides: kernel-modules = ${verrel}${variant}
-Provides: ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
-EOF
-
-
- if [ -z "$kmp" ]; then
- echo "Requires: ${kdep}"
- fi
@ -309,14 +309,14 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -309,14 +309,14 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
-#
+ # Turn of the internal dep generator so we will use the kmod scripts.
+ echo "%global _use_internal_dependency_generator 0"
cat <<EOF
+Provides: kernel-modules >= ${verrel}${dotvariant}
+Provides: ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
Requires(post): /sbin/depmod
Requires(postun): /sbin/depmod
EOF
-if [ "no" != "$kmp_nobuildreqs" ]
-then
- echo "BuildRequires: kernel${dashvariant}-devel-%{_target_cpu} = ${verrel}"
@ -325,7 +325,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -325,7 +325,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
+ then
+ echo "BuildRequires: kernel${dashvariant}-devel"
+ fi
-if [ "" != "$kmp_override_preamble" ]
-then
- cat "$kmp_override_preamble"
@ -334,7 +334,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -334,7 +334,7 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
+ then
+ cat "$override_preamble"
+ fi
cat <<EOF
%description -n kmod-${kmod_name}${dashvariant}
-This package provides the ${kmod_name} kernel modules built for the Linux
@ -357,10 +357,10 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -357,10 +357,10 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
+ /sbin/depmod -aeF "/boot/System.map-${verrel}${dotvariant}" "${verrel}${dotvariant}" > /dev/null || :
fi
-EOF
-
-
- if [ ! -z "$kmp" ]; then
- cat <<EOF
-modules=( \$(find /lib/modules/${verrel}${variant}/extra/${kmod_name}) )
+modules=( \$(find /lib/modules/${verrel}${dotvariant}/extra/${kmod_name} | grep '\.ko$') )
if [ -x "/sbin/weak-modules" ]; then
@ -375,15 +375,15 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -375,15 +375,15 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
- > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
+rpm -ql kmod-${kmod_name}${dashvariant}-%{kmod_version}-%{kmod_release}.$(arch) | grep '\.ko$' > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
EOF
- fi
-
-
- cat <<EOF
+cat <<EOF
%postun -n kmod-${kmod_name}${dashvariant}
-/sbin/depmod -aF /boot/System.map-${verrel}${variant} ${verrel}${variant} &> /dev/null || :
-EOF
-
-
- if [ ! -z "$kmp" ]; then
- cat <<EOF
+if [ -e "/boot/System.map-${verrel}${dotvariant}" ]; then
@ -399,9 +399,9 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -399,9 +399,9 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
fi
EOF
- fi
echo "%files -n kmod-${kmod_name}${dashvariant}"
-if [ "" == "$kmp_override_filelist" ];
+if [ "" == "$override_filelist" ];
then
@ -414,14 +414,14 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
@@ -414,14 +414,14 @@ diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
+ cat "$override_filelist" | get_filelist
fi
}
@@ -216,8 +241,6 @@
- Get variant from uname.
rpmtemplate <mainpgkname> <uname> <variants>
rpmtemplate <mainpgkname> <uname> <variants>
- 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.
EOF
@@ -241,12 +264,6 @@
@ -442,18 +442,18 @@ diff -Nuar redhat-rpm-config-9.1.0_old/macros redhat-rpm-config-9.1.0/macros
@@ -442,18 +442,18 @@ diff -Nuar redhat-rpm-config-9.1.0_old/macros redhat-rpm-config-9.1.0/macros
+++ redhat-rpm-config-9.1.0/macros 2013-03-22 10:49:31.730892680 +0800
@@ -175,8 +175,8 @@
%__global_ldflags -Wl,-z,relro %{_hardened_ldflags}
# Use these macros to differentiate between RH and other KMP implementation(s).
-redhat_kernel_module_package 1
-kernel_module_package_release 1
+%global redhat_kernel_module_package 1
+%global kernel_module_package_release 1
#kernel_module_package [ -n name ] [ -v version ] [ -r release ] [ -s script ]
# [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ...
@@ -185,40 +185,27 @@
kernel-devel
kernel-devel
%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \
- %define kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
- %define kmp_version %{-v*}%{!-v:%{version}} \
@ -463,9 +463,9 @@ diff -Nuar redhat-rpm-config-9.1.0_old/macros redhat-rpm-config-9.1.0/macros
@@ -463,9 +463,9 @@ diff -Nuar redhat-rpm-config-9.1.0_old/macros redhat-rpm-config-9.1.0/macros
+ %global kmod_version %{-v*}%{!-v:%{version}} \
+ %global kmod_release %{-r*}%{!-r:%{release}} \
+ %global latest_kernel %(rpm -q --qf '%{VERSION}-%{RELEASE}.%{ARCH}\\\\n' `rpm -q kernel-devel | /usr/lib/rpm/redhat/rpmsort -r | head -n 1` | head -n 1) \
%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
flavors="default" \
%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
flavors="default" \
- if [ "i686" == "%{_target_cpu}" ] || [ "x86_64" == "%{_target_cpu}" ] \
- then \
- xenver=$(rpm -q kernel-xen-devel-%{kverrel}|head -n 1)\
@ -479,31 +479,31 @@ diff -Nuar redhat-rpm-config-9.1.0_old/macros redhat-rpm-config-9.1.0/macros
@@ -479,31 +479,31 @@ diff -Nuar redhat-rpm-config-9.1.0_old/macros redhat-rpm-config-9.1.0/macros
- flavors="$flavors kdump" \
- fi \
- fi \
if [ -z "%*" ]; then \
flavors_to_build=$flavors \
elif [ -z "%{-x}" ]; then \
flavors_to_build="%*" \
else \
flavors_to_build=" $flavors "\
if [ -z "%*" ]; then \
flavors_to_build=$flavors \
elif [ -z "%{-x}" ]; then \
flavors_to_build="%*" \
else \
flavors_to_build=" $flavors "\
- echo "[$flavors_to_build]" >/tmp/tmp.txt
for i in %* \
do \
flavors_to_build=${flavors_to_build//$i /}
done \
fi \
echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
for i in %* \
do \
flavors_to_build=${flavors_to_build//$i /}
done \
fi \
echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
- echo "%%global kernel_source() /usr/src/kernels/%kverrel-\\\$([ %%%%{1} = default ] || echo "%%%%{1}.")%_target_cpu" \
+ echo "%%global kernel_source() /usr/src/kernels/%kverrel\\\$([ %%%%{1} = default ] || echo ".%%%%{1}")" \
+ echo "%%global kernel_module_package_moddir() extra" \
if [ ! -z "%{-f*}" ] \
then \
filelist="%{-f*}" \
if [ ! -z "%{-f*}" ] \
then \
filelist="%{-f*}" \
@@ -231,7 +218,7 @@
then \
nobuildreqs="yes" \
fi \
then \
nobuildreqs="yes" \
fi \
- kmp_override_filelist="$filelist" kmp_override_preamble="$preamble" kmp_nobuildreqs="$buildreqs" %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \
+ 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 \
)}
#==============================================================================