|
|
eaaa62 |
diff -Nuar redhat-rpm-config-9.1.0_old/find-provides.ksyms redhat-rpm-config-9.1.0/find-provides.ksyms
|
|
|
eaaa62 |
--- redhat-rpm-config-9.1.0_old/find-provides.ksyms 2013-03-22 10:48:56.344881194 +0800
|
|
|
eaaa62 |
+++ redhat-rpm-config-9.1.0/find-provides.ksyms 2013-03-22 10:49:31.727892674 +0800
|
|
|
eaaa62 |
@@ -4,6 +4,7 @@
|
|
|
eaaa62 |
|
|
|
eaaa62 |
for module in $(grep -E '/lib/modules/.+\.ko$'); do
|
|
|
eaaa62 |
nm $module \
|
|
|
eaaa62 |
- | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):ksym(\2) = \1:p'
|
|
|
eaaa62 |
+ | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p' \
|
|
|
eaaa62 |
+ | awk --non-decimal-data '{printf("ksym(%s) = 0x%08x\n", $2, $1)}'
|
|
|
eaaa62 |
done \
|
|
|
eaaa62 |
| sort -u
|
|
|
eaaa62 |
diff -Nuar redhat-rpm-config-9.1.0_old/find-requires redhat-rpm-config-9.1.0/find-requires
|
|
|
eaaa62 |
--- redhat-rpm-config-9.1.0_old/find-requires 2013-03-22 10:48:56.343881193 +0800
|
|
|
eaaa62 |
+++ redhat-rpm-config-9.1.0/find-requires 2013-03-22 10:49:31.727892674 +0800
|
|
|
eaaa62 |
@@ -153,8 +153,7 @@
|
|
|
eaaa62 |
fi
|
|
|
eaaa62 |
done
|
|
|
eaaa62 |
|
|
|
eaaa62 |
-# Disabling for now while the Fedora kernel doesn't produce kABI deps.
|
|
|
eaaa62 |
-#[ -x /usr/lib/rpm/redhat/find-requires.ksyms ] && [ "$is_kmod" ] &&
|
|
|
eaaa62 |
-# printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/redhat/find-requires.ksyms
|
|
|
eaaa62 |
+[ -x /usr/lib/rpm/redhat/find-requires.ksyms ] && [ "$is_kmod" ] &&
|
|
|
eaaa62 |
+ printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/redhat/find-requires.ksyms
|
|
|
eaaa62 |
|
|
|
eaaa62 |
exit 0
|
|
|
eaaa62 |
diff -Nuar redhat-rpm-config-9.1.0_old/find-requires.ksyms redhat-rpm-config-9.1.0/find-requires.ksyms
|
|
|
eaaa62 |
--- redhat-rpm-config-9.1.0_old/find-requires.ksyms 2013-03-22 10:48:56.343881193 +0800
|
|
|
eaaa62 |
+++ redhat-rpm-config-9.1.0/find-requires.ksyms 2013-03-22 10:49:31.728892676 +0800
|
|
|
eaaa62 |
@@ -1,20 +1,41 @@
|
|
|
eaaa62 |
#! /bin/bash
|
|
|
eaaa62 |
+#
|
|
|
eaaa62 |
+# This script is called during external module building to create dependencies
|
|
|
eaaa62 |
+# both upon the RHEL kernel, and on additional external modules. Symbols that
|
|
|
eaaa62 |
+# cannot be reconciled against those provided by the kernel are assumed to be
|
|
|
eaaa62 |
+# provided by an external module and "ksym" replaces th regular "kernel" dep.
|
|
|
eaaa62 |
|
|
|
eaaa62 |
IFS=$'\n'
|
|
|
eaaa62 |
|
|
|
eaaa62 |
+# Extract all of the symbols provided by this module.
|
|
|
eaaa62 |
all_provides() {
|
|
|
eaaa62 |
nm "$@" \
|
|
|
eaaa62 |
- | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):\1\t\2:p' \
|
|
|
eaaa62 |
- | sort -k2 -u
|
|
|
eaaa62 |
+ | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p' \
|
|
|
eaaa62 |
+ | awk --non-decimal-data '{printf("0x%08x\t%s\n", $1, $2)}' \
|
|
|
eaaa62 |
+ | LANG=C sort -k2,2 -u
|
|
|
eaaa62 |
}
|
|
|
eaaa62 |
|
|
|
eaaa62 |
+# Extract all of the requirements of this module.
|
|
|
eaaa62 |
all_requires() {
|
|
|
eaaa62 |
for module in "$@"; do
|
|
|
eaaa62 |
set -- $(/sbin/modinfo -F vermagic "$module" | sed -e 's: .*::' -e q)
|
|
|
eaaa62 |
/sbin/modprobe --dump-modversions "$module" \
|
|
|
eaaa62 |
- | sed -r -e 's:^0x0*::' -e 's:$:\t'"$1"':'
|
|
|
eaaa62 |
+ | awk --non-decimal-data '
|
|
|
eaaa62 |
+ BEGIN { FS = "\t" ; OFS = "\t" }
|
|
|
eaaa62 |
+ {printf("0x%08x\t%s\n", $1, $2)}' \
|
|
|
eaaa62 |
+ | sed -r -e 's:$:\t'"$1"':'
|
|
|
eaaa62 |
done \
|
|
|
eaaa62 |
- | sort -k2 -u
|
|
|
eaaa62 |
+ | LANG=C sort -k2,2 -u
|
|
|
eaaa62 |
+}
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
+# Filter out requirements fulfilled by the module itself.
|
|
|
eaaa62 |
+mod_requires() {
|
|
|
eaaa62 |
+ module=$1
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
+ LANG=C join -t $'\t' -j 2 -v 1 \
|
|
|
eaaa62 |
+ <(all_requires "$module") \
|
|
|
eaaa62 |
+ <(all_provides "$module") \
|
|
|
eaaa62 |
+ | LANG=C sort -k1,1 -u
|
|
|
eaaa62 |
}
|
|
|
eaaa62 |
|
|
|
eaaa62 |
if ! [ -e /sbin/modinfo -a -e /sbin/modprobe ]; then
|
|
|
eaaa62 |
@@ -22,27 +43,72 @@
|
|
|
eaaa62 |
exit 0
|
|
|
eaaa62 |
fi
|
|
|
eaaa62 |
|
|
|
eaaa62 |
+check_kabi() {
|
|
|
eaaa62 |
+ arch=$(uname -m)
|
|
|
eaaa62 |
+ kabi_file="/lib/modules/kabi/kabi_whitelist_$arch"
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
+ # If not installed, output a warning and return (continue)
|
|
|
eaaa62 |
+ if [ ! -f "$kabi_file" ]; then
|
|
|
eaaa62 |
+ echo "" >&2
|
|
|
eaaa62 |
+ echo "********************************************************************************" >&2
|
|
|
eaaa62 |
+ echo "*********************** KERNEL ABI COMPATIBILITY WARNING ***********************" >&2
|
|
|
eaaa62 |
+ echo "********************************************************************************" >&2
|
|
|
eaaa62 |
+ echo "The kernel ABI reference files (provided by "kabi-whitelists") were not found." >&2
|
|
|
eaaa62 |
+ echo "No compatibility check was performed. Please install the kABI reference files" >&2
|
|
|
eaaa62 |
+ echo "and rebuild if you would like to verify compatibility with kernel ABI." >&2
|
|
|
eaaa62 |
+ echo "" >&2
|
|
|
eaaa62 |
+ return
|
|
|
eaaa62 |
+ fi
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
+ unset non_kabi
|
|
|
eaaa62 |
+ for symbol in "$@"; do
|
|
|
eaaa62 |
+ if ! egrep "^[[:space:]]$symbol\$" $kabi_file >/dev/null; then
|
|
|
eaaa62 |
+ non_kabi=("${non_kabi[@]}" "$symbol")
|
|
|
eaaa62 |
+ fi
|
|
|
eaaa62 |
+ done
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
+ if [ ${#non_kabi[@]} -gt 0 ]; then
|
|
|
eaaa62 |
+ echo "" >&2
|
|
|
eaaa62 |
+ echo "********************************************************************************" >&2
|
|
|
eaaa62 |
+ echo "*********************** KERNEL ABI COMPATIBILITY WARNING ***********************" >&2
|
|
|
eaaa62 |
+ echo "********************************************************************************" >&2
|
|
|
eaaa62 |
+ echo "The following kernel symbols are not guaranteed to remain compatible with" >&2
|
|
|
eaaa62 |
+ echo "future kernel updates to this RHEL release:" >&2
|
|
|
eaaa62 |
+ echo "" >&2
|
|
|
eaaa62 |
+ for symbol in "${non_kabi[@]}"; do
|
|
|
eaaa62 |
+ printf "\t$symbol\n" >&2
|
|
|
eaaa62 |
+ done
|
|
|
eaaa62 |
+ echo "" >&2
|
|
|
eaaa62 |
+ echo "Red Hat recommends that you consider using only official kernel ABI symbols" >&2
|
|
|
eaaa62 |
+ echo "where possible. Requests for additions to the kernel ABI can be filed with" >&2
|
|
|
eaaa62 |
+ echo "your partner or customer representative (component: driver-update-program)." >&2
|
|
|
eaaa62 |
+ echo "" >&2
|
|
|
eaaa62 |
+ fi
|
|
|
eaaa62 |
+}
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
modules=($(grep -E '/lib/modules/.+\.ko$'))
|
|
|
eaaa62 |
if [ ${#modules[@]} -gt 0 ]; then
|
|
|
eaaa62 |
- symset_table=$(mktemp -t ${0##*/}.XXXXX)
|
|
|
eaaa62 |
- /usr/lib/rpm/redhat/symset-table | sort > $symset_table
|
|
|
eaaa62 |
+ kernel=$(/sbin/modinfo -F vermagic "${modules[0]}" | sed -e 's: .*::' -e q)
|
|
|
eaaa62 |
+ symvers=$(mktemp -t ${0##*/}.XXXXX)
|
|
|
eaaa62 |
|
|
|
eaaa62 |
- join -t $'\t' -j 1 -a 2 $symset_table <(
|
|
|
eaaa62 |
- # Filter out requirements that we fulfill ourself.
|
|
|
eaaa62 |
- join -t $'\t' -j 2 -v 1 \
|
|
|
eaaa62 |
- <(all_requires "${modules[@]}") \
|
|
|
eaaa62 |
- <(all_provides "${modules[@]}") \
|
|
|
eaaa62 |
- | awk '
|
|
|
eaaa62 |
+ cat /usr/src/kernels/$kernel/Module.symvers | awk '
|
|
|
eaaa62 |
BEGIN { FS = "\t" ; OFS = "\t" }
|
|
|
eaaa62 |
- { print $3 "/" $2 "/" $1 }
|
|
|
eaaa62 |
- ' \
|
|
|
eaaa62 |
- | sort -u) \
|
|
|
eaaa62 |
- | sort -u \
|
|
|
eaaa62 |
- | awk '
|
|
|
eaaa62 |
- { FS = "\t" ; OFS = "\t" }
|
|
|
eaaa62 |
- NF == 3 { print "kernel(" $2 ") = " $3
|
|
|
eaaa62 |
- next }
|
|
|
eaaa62 |
- { split($1, arr, "/")
|
|
|
eaaa62 |
- print "ksym(" arr[3] ") = " arr[2] }
|
|
|
eaaa62 |
- '
|
|
|
eaaa62 |
+ { print $2 "\t" $1 }
|
|
|
eaaa62 |
+ ' \
|
|
|
eaaa62 |
+ | sed -r -e 's:$:\t'"$kernel"':' \
|
|
|
eaaa62 |
+ | LANG=C sort -k1,1 -u > $symvers
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
+ # Symbols matching with the kernel get a "kernel" dependency
|
|
|
eaaa62 |
+ LANG=C join -t '\t' -j 1 $symvers <(mod_requires "${modules[@]}") | LANG=C sort -u \
|
|
|
eaaa62 |
+ | awk '{ FS = "\t" ; OFS = "\t" } { print "kernel(" $1 ") = " $2 }'
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
+ # Symbols from elsewhere get a "ksym" dependency
|
|
|
eaaa62 |
+ LANG=C join -t '\t' -j 1 -v 2 $symvers <(mod_requires "${modules[@]}") | LANG=C sort -u \
|
|
|
eaaa62 |
+ | awk '{ FS = "\t" ; OFS = "\t" } { print "ksym(" $1 ") = " $2 }'
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
+ # Check kABI if the kabi-whitelists package is installed
|
|
|
eaaa62 |
+ # Do this last so we can try to output this error at the end
|
|
|
eaaa62 |
+ kabi_check_symbols=($(LANG=C join -t '\t' -j 1 $symvers <(mod_requires "${modules[@]}") | LANG=C sort -u \
|
|
|
eaaa62 |
+ | awk '{ FS = "\t" ; OFS = "\t" } { print $1 }'))
|
|
|
eaaa62 |
+ check_kabi "${kabi_check_symbols[@]}"
|
|
|
eaaa62 |
fi
|
|
|
eaaa62 |
diff -Nuar redhat-rpm-config-9.1.0_old/kmodtool redhat-rpm-config-9.1.0/kmodtool
|
|
|
eaaa62 |
--- redhat-rpm-config-9.1.0_old/kmodtool 2013-03-22 10:48:56.344881194 +0800
|
|
|
eaaa62 |
+++ redhat-rpm-config-9.1.0/kmodtool 2013-03-22 10:49:58.453903908 +0800
|
|
|
eaaa62 |
@@ -1,7 +1,12 @@
|
|
|
eaaa62 |
#!/bin/bash
|
|
|
eaaa62 |
|
|
|
eaaa62 |
# kmodtool - Helper script for building kernel module RPMs
|
|
|
eaaa62 |
-# Copyright (c) 2003-2006 Ville Skyttä <ville.skytta@iki.fi>,
|
|
|
eaaa62 |
+# An original version appeared in Fedora. This version is
|
|
|
eaaa62 |
+# generally called only by the %kernel_module_package RPM macro
|
|
|
eaaa62 |
+# during the process of building Driver Update Packages (which
|
|
|
eaaa62 |
+# are also known as "kmods" in the Fedora community).
|
|
|
eaaa62 |
+#
|
|
|
eaaa62 |
+# Copyright (c) 2003-2010 Ville Skyttä <ville.skytta@iki.fi>,
|
|
|
eaaa62 |
# Thorsten Leemhuis <fedora@leemhuis.info>
|
|
|
eaaa62 |
# Jon Masters <jcm@redhat.com>
|
|
|
eaaa62 |
#
|
|
|
eaaa62 |
@@ -24,21 +29,30 @@
|
|
|
eaaa62 |
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
eaaa62 |
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
eaaa62 |
|
|
|
eaaa62 |
+# Changelog:
|
|
|
eaaa62 |
+#
|
|
|
eaaa62 |
+# 2010/07/28 - Add fixes for filelists in line with LF standard
|
|
|
eaaa62 |
+# - Remove now defunct "framepointer" kernel variant
|
|
|
eaaa62 |
+# - Change version to "rhel6-rh2" as a consequence.
|
|
|
eaaa62 |
+#
|
|
|
eaaa62 |
+# 2010/01/10 - Simplified for RHEL6. We are working on upstream
|
|
|
eaaa62 |
+# moving to a newer format and in any case do not
|
|
|
eaaa62 |
+# need to retain support for really old systems.
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
shopt -s extglob
|
|
|
eaaa62 |
|
|
|
eaaa62 |
myprog="kmodtool"
|
|
|
eaaa62 |
myver="0.10.10_kmp2"
|
|
|
eaaa62 |
-knownvariants=@(BOOT|PAE|@(big|huge)mem|debug|enterprise|kdump|?(large)smp|uml|xen[0U]?(-PAE)|xen)
|
|
|
eaaa62 |
+knownvariants=@(debug|kdump)
|
|
|
eaaa62 |
kmod_name=
|
|
|
eaaa62 |
kver=
|
|
|
eaaa62 |
verrel=
|
|
|
eaaa62 |
variant=
|
|
|
eaaa62 |
-kmp=
|
|
|
eaaa62 |
|
|
|
eaaa62 |
get_verrel ()
|
|
|
eaaa62 |
{
|
|
|
eaaa62 |
verrel=${1:-$(uname -r)}
|
|
|
eaaa62 |
- verrel=${verrel%%$knownvariants}
|
|
|
eaaa62 |
+ verrel=${verrel/%.$knownvariants/}
|
|
|
eaaa62 |
}
|
|
|
eaaa62 |
|
|
|
eaaa62 |
print_verrel ()
|
|
|
eaaa62 |
@@ -51,7 +65,7 @@
|
|
|
eaaa62 |
{
|
|
|
eaaa62 |
get_verrel $@
|
|
|
eaaa62 |
variant=${1:-$(uname -r)}
|
|
|
eaaa62 |
- variant=${variant##$verrel}
|
|
|
eaaa62 |
+ variant=${variant/#$verrel?(.)/}
|
|
|
eaaa62 |
variant=${variant:-'""'}
|
|
|
eaaa62 |
}
|
|
|
eaaa62 |
|
|
|
eaaa62 |
@@ -61,117 +75,128 @@
|
|
|
eaaa62 |
echo "${variant}"
|
|
|
eaaa62 |
}
|
|
|
eaaa62 |
|
|
|
eaaa62 |
+get_filelist() {
|
|
|
eaaa62 |
+ local IFS=$'\n'
|
|
|
eaaa62 |
+ filelist=($(cat))
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
+ if [ ${#filelist[@]} -gt 0 ];
|
|
|
eaaa62 |
+ then
|
|
|
eaaa62 |
+ for ((n = 0; n < ${#filelist[@]}; n++));
|
|
|
eaaa62 |
+ do
|
|
|
eaaa62 |
+ line="${filelist[n]}"
|
|
|
eaaa62 |
+ line=$(echo "$line" \
|
|
|
eaaa62 |
+ | sed -e "s/%verrel/$verrel/g" \
|
|
|
eaaa62 |
+ | sed -e "s/%variant/$variant/g" \
|
|
|
eaaa62 |
+ | sed -e "s/%dashvariant/$dashvariant/g" \
|
|
|
eaaa62 |
+ | sed -e "s/%dotvariant/$dotvariant/g" \
|
|
|
eaaa62 |
+ | sed -e "s/\.%1/$dotvariant/g" \
|
|
|
eaaa62 |
+ | sed -e "s/\-%1/$dotvariant/g" \
|
|
|
eaaa62 |
+ | sed -e "s/%2/$verrel/g")
|
|
|
eaaa62 |
+ echo "$line"
|
|
|
eaaa62 |
+ done
|
|
|
eaaa62 |
+ else
|
|
|
eaaa62 |
+ echo "%defattr(644,root,root,755)"
|
|
|
eaaa62 |
+ echo "/lib/modules/${verrel}${dotvariant}"
|
|
|
eaaa62 |
+ fi
|
|
|
eaaa62 |
+}
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
get_rpmtemplate ()
|
|
|
eaaa62 |
{
|
|
|
eaaa62 |
local variant="${1}"
|
|
|
eaaa62 |
local dashvariant="${variant:+-${variant}}"
|
|
|
eaaa62 |
- case "$verrel" in
|
|
|
eaaa62 |
- *.el*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;;
|
|
|
eaaa62 |
- *.EL*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;;
|
|
|
eaaa62 |
- *) kdep="kernel-%{_target_cpu} = ${verrel}${variant}" ;;
|
|
|
eaaa62 |
- esac
|
|
|
eaaa62 |
+ local dotvariant="${variant:+.${variant}}"
|
|
|
eaaa62 |
|
|
|
eaaa62 |
echo "%package -n kmod-${kmod_name}${dashvariant}"
|
|
|
eaaa62 |
|
|
|
eaaa62 |
- if [ -z "$kmp_provides_summary" ]; then
|
|
|
eaaa62 |
+ if [ -z "$kmod_provides_summary" ]; then
|
|
|
eaaa62 |
echo "Summary: ${kmod_name} kernel module(s)"
|
|
|
eaaa62 |
fi
|
|
|
eaaa62 |
|
|
|
eaaa62 |
- if [ -z "$kmp_provides_group" ]; then
|
|
|
eaaa62 |
+ if [ -z "$kmod_provides_group" ]; then
|
|
|
eaaa62 |
echo "Group: System Environment/Kernel"
|
|
|
eaaa62 |
fi
|
|
|
eaaa62 |
|
|
|
eaaa62 |
- if [ ! -z "$kmp_version" ]; then
|
|
|
eaaa62 |
- echo "Version: %{kmp_version}"
|
|
|
eaaa62 |
+ if [ ! -z "$kmod_version" ]; then
|
|
|
eaaa62 |
+ echo "Version: %{kmod_version}"
|
|
|
eaaa62 |
fi
|
|
|
eaaa62 |
|
|
|
eaaa62 |
- if [ ! -z "$kmp_release" ]; then
|
|
|
eaaa62 |
- echo "Release: %{kmp_release}"
|
|
|
eaaa62 |
+ if [ ! -z "$kmod_release" ]; then
|
|
|
eaaa62 |
+ echo "Release: %{kmod_release}"
|
|
|
eaaa62 |
fi
|
|
|
eaaa62 |
|
|
|
eaaa62 |
- if [ ! -z "$kmp" ]; then
|
|
|
eaaa62 |
- echo "%global _use_internal_dependency_generator 0"
|
|
|
eaaa62 |
- fi
|
|
|
eaaa62 |
-
|
|
|
eaaa62 |
- cat <
|
|
|
eaaa62 |
-Provides: kernel-modules = ${verrel}${variant}
|
|
|
eaaa62 |
-Provides: ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
|
|
|
eaaa62 |
-EOF
|
|
|
eaaa62 |
-
|
|
|
eaaa62 |
- if [ -z "$kmp" ]; then
|
|
|
eaaa62 |
- echo "Requires: ${kdep}"
|
|
|
eaaa62 |
- fi
|
|
|
eaaa62 |
-
|
|
|
eaaa62 |
-#
|
|
|
eaaa62 |
-# RHEL5 - Remove common package requirement on general kmod packages.
|
|
|
eaaa62 |
-# Requires: ${kmod_name}-kmod-common >= %{?epoch:%{epoch}:}%{version}
|
|
|
eaaa62 |
-#
|
|
|
eaaa62 |
+ # Turn of the internal dep generator so we will use the kmod scripts.
|
|
|
eaaa62 |
+ echo "%global _use_internal_dependency_generator 0"
|
|
|
eaaa62 |
|
|
|
eaaa62 |
cat <
|
|
|
eaaa62 |
+Provides: kernel-modules >= ${verrel}${dotvariant}
|
|
|
eaaa62 |
+Provides: ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
|
|
|
eaaa62 |
Requires(post): /sbin/depmod
|
|
|
eaaa62 |
Requires(postun): /sbin/depmod
|
|
|
eaaa62 |
EOF
|
|
|
eaaa62 |
|
|
|
eaaa62 |
-if [ "no" != "$kmp_nobuildreqs" ]
|
|
|
eaaa62 |
-then
|
|
|
eaaa62 |
- echo "BuildRequires: kernel${dashvariant}-devel-%{_target_cpu} = ${verrel}"
|
|
|
eaaa62 |
-fi
|
|
|
eaaa62 |
+ if [ "yes" != "$nobuildreqs" ]
|
|
|
eaaa62 |
+ then
|
|
|
eaaa62 |
+ echo "BuildRequires: kernel${dashvariant}-devel"
|
|
|
eaaa62 |
+ fi
|
|
|
eaaa62 |
|
|
|
eaaa62 |
-if [ "" != "$kmp_override_preamble" ]
|
|
|
eaaa62 |
-then
|
|
|
eaaa62 |
- cat "$kmp_override_preamble"
|
|
|
eaaa62 |
-fi
|
|
|
eaaa62 |
+ if [ "" != "$override_preamble" ]
|
|
|
eaaa62 |
+ then
|
|
|
eaaa62 |
+ cat "$override_preamble"
|
|
|
eaaa62 |
+ fi
|
|
|
eaaa62 |
|
|
|
eaaa62 |
cat <
|
|
|
eaaa62 |
%description -n kmod-${kmod_name}${dashvariant}
|
|
|
eaaa62 |
-This package provides the ${kmod_name} kernel modules built for the Linux
|
|
|
eaaa62 |
-kernel ${verrel}${variant} for the %{_target_cpu} family of processors.
|
|
|
eaaa62 |
+This package provides the ${kmod_name} kernel modules built for
|
|
|
eaaa62 |
+the Linux kernel ${verrel}${dotvariant} for the %{_target_cpu}
|
|
|
eaaa62 |
+family of processors.
|
|
|
eaaa62 |
+EOF
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
+##############################################################################
|
|
|
eaaa62 |
+## The following are not part of this script directly, they are scripts ##
|
|
|
eaaa62 |
+## that will be executed by RPM during various stages of package processing ##
|
|
|
eaaa62 |
+##############################################################################
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
+cat <
|
|
|
eaaa62 |
%post -n kmod-${kmod_name}${dashvariant}
|
|
|
eaaa62 |
-if [ -e "/boot/System.map-${verrel}${variant}" ]; then
|
|
|
eaaa62 |
- /sbin/depmod -aeF "/boot/System.map-${verrel}${variant}" "${verrel}${variant}" > /dev/null || :
|
|
|
eaaa62 |
+if [ -e "/boot/System.map-${verrel}${dotvariant}" ]; then
|
|
|
eaaa62 |
+ /sbin/depmod -aeF "/boot/System.map-${verrel}${dotvariant}" "${verrel}${dotvariant}" > /dev/null || :
|
|
|
eaaa62 |
fi
|
|
|
eaaa62 |
-EOF
|
|
|
eaaa62 |
-
|
|
|
eaaa62 |
- if [ ! -z "$kmp" ]; then
|
|
|
eaaa62 |
- cat <
|
|
|
eaaa62 |
|
|
|
eaaa62 |
-modules=( \$(find /lib/modules/${verrel}${variant}/extra/${kmod_name}) )
|
|
|
eaaa62 |
+modules=( \$(find /lib/modules/${verrel}${dotvariant}/extra/${kmod_name} | grep '\.ko$') )
|
|
|
eaaa62 |
if [ -x "/sbin/weak-modules" ]; then
|
|
|
eaaa62 |
printf '%s\n' "\${modules[@]}" \
|
|
|
eaaa62 |
| /sbin/weak-modules --add-modules
|
|
|
eaaa62 |
fi
|
|
|
eaaa62 |
+EOF
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
+cat <
|
|
|
eaaa62 |
%preun -n kmod-${kmod_name}${dashvariant}
|
|
|
eaaa62 |
-rpm -ql kmod-${kmod_name}${dashvariant} | grep '\.ko$' \
|
|
|
eaaa62 |
- > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
|
|
|
eaaa62 |
+rpm -ql kmod-${kmod_name}${dashvariant}-%{kmod_version}-%{kmod_release}.$(arch) | grep '\.ko$' > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
|
|
|
eaaa62 |
EOF
|
|
|
eaaa62 |
|
|
|
eaaa62 |
- fi
|
|
|
eaaa62 |
-
|
|
|
eaaa62 |
- cat <
|
|
|
eaaa62 |
+cat <
|
|
|
eaaa62 |
%postun -n kmod-${kmod_name}${dashvariant}
|
|
|
eaaa62 |
-/sbin/depmod -aF /boot/System.map-${verrel}${variant} ${verrel}${variant} &> /dev/null || :
|
|
|
eaaa62 |
-EOF
|
|
|
eaaa62 |
-
|
|
|
eaaa62 |
- if [ ! -z "$kmp" ]; then
|
|
|
eaaa62 |
- cat <
|
|
|
eaaa62 |
+if [ -e "/boot/System.map-${verrel}${dotvariant}" ]; then
|
|
|
eaaa62 |
+ /sbin/depmod -aeF "/boot/System.map-${verrel}${dotvariant}" "${verrel}${dotvariant}" > /dev/null || :
|
|
|
eaaa62 |
+fi
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
modules=( \$(cat /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules) )
|
|
|
eaaa62 |
-#rm /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
|
|
|
eaaa62 |
+rm /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
|
|
|
eaaa62 |
if [ -x "/sbin/weak-modules" ]; then
|
|
|
eaaa62 |
printf '%s\n' "\${modules[@]}" \
|
|
|
eaaa62 |
| /sbin/weak-modules --remove-modules
|
|
|
eaaa62 |
fi
|
|
|
eaaa62 |
EOF
|
|
|
eaaa62 |
- fi
|
|
|
eaaa62 |
|
|
|
eaaa62 |
echo "%files -n kmod-${kmod_name}${dashvariant}"
|
|
|
eaaa62 |
|
|
|
eaaa62 |
-if [ "" == "$kmp_override_filelist" ];
|
|
|
eaaa62 |
+if [ "" == "$override_filelist" ];
|
|
|
eaaa62 |
then
|
|
|
eaaa62 |
echo "%defattr(644,root,root,755)"
|
|
|
eaaa62 |
- echo "/lib/modules/${verrel}${variant}/"
|
|
|
eaaa62 |
- echo "/lib/firmware/"
|
|
|
eaaa62 |
+ echo "/lib/modules/${verrel}${dotvariant}"
|
|
|
eaaa62 |
else
|
|
|
eaaa62 |
- cat "$kmp_override_filelist"
|
|
|
eaaa62 |
+ cat "$override_filelist" | get_filelist
|
|
|
eaaa62 |
fi
|
|
|
eaaa62 |
}
|
|
|
eaaa62 |
|
|
|
eaaa62 |
@@ -216,8 +241,6 @@
|
|
|
eaaa62 |
- Get variant from uname.
|
|
|
eaaa62 |
rpmtemplate <mainpgkname> <uname> <variants>
|
|
|
eaaa62 |
- Return a template for use in a source RPM
|
|
|
eaaa62 |
- rpmtemplate_kmp <mainpgkname> <uname> <variants>
|
|
|
eaaa62 |
- - Return a template for use in a source RPM with KMP dependencies
|
|
|
eaaa62 |
version
|
|
|
eaaa62 |
- Output version number and exit.
|
|
|
eaaa62 |
EOF
|
|
|
eaaa62 |
@@ -241,12 +264,6 @@
|
|
|
eaaa62 |
print_rpmtemplate "$@"
|
|
|
eaaa62 |
exit $?
|
|
|
eaaa62 |
;;
|
|
|
eaaa62 |
- rpmtemplate_kmp)
|
|
|
eaaa62 |
- shift
|
|
|
eaaa62 |
- kmp=1
|
|
|
eaaa62 |
- print_rpmtemplate "$@"
|
|
|
eaaa62 |
- exit $?
|
|
|
eaaa62 |
- ;;
|
|
|
eaaa62 |
version)
|
|
|
eaaa62 |
echo "${myprog} ${myver}"
|
|
|
eaaa62 |
exit 0
|
|
|
eaaa62 |
diff -Nuar redhat-rpm-config-9.1.0_old/macros redhat-rpm-config-9.1.0/macros
|
|
|
eaaa62 |
--- redhat-rpm-config-9.1.0_old/macros 2013-03-22 10:48:56.344881194 +0800
|
|
|
eaaa62 |
+++ redhat-rpm-config-9.1.0/macros 2013-03-22 10:49:31.730892680 +0800
|
|
|
eaaa62 |
@@ -175,8 +175,8 @@
|
|
|
eaaa62 |
%__global_ldflags -Wl,-z,relro %{_hardened_ldflags}
|
|
|
eaaa62 |
|
|
|
eaaa62 |
# Use these macros to differentiate between RH and other KMP implementation(s).
|
|
|
eaaa62 |
-redhat_kernel_module_package 1
|
|
|
eaaa62 |
-kernel_module_package_release 1
|
|
|
eaaa62 |
+%global redhat_kernel_module_package 1
|
|
|
eaaa62 |
+%global kernel_module_package_release 1
|
|
|
eaaa62 |
|
|
|
eaaa62 |
#kernel_module_package [ -n name ] [ -v version ] [ -r release ] [ -s script ]
|
|
|
eaaa62 |
# [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ...
|
|
|
eaaa62 |
@@ -185,40 +185,27 @@
|
|
|
eaaa62 |
kernel-devel
|
|
|
eaaa62 |
|
|
|
eaaa62 |
%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \
|
|
|
eaaa62 |
- %define kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
|
|
|
eaaa62 |
- %define kmp_version %{-v*}%{!-v:%{version}} \
|
|
|
eaaa62 |
- %define kmp_release %{-r*}%{!-r:%{release}} \
|
|
|
eaaa62 |
- %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) \
|
|
|
eaaa62 |
+ %global kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
|
|
|
eaaa62 |
+ %global kmod_version %{-v*}%{!-v:%{version}} \
|
|
|
eaaa62 |
+ %global kmod_release %{-r*}%{!-r:%{release}} \
|
|
|
eaaa62 |
+ %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) \
|
|
|
eaaa62 |
%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
|
|
|
eaaa62 |
%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
|
|
|
eaaa62 |
flavors="default" \
|
|
|
eaaa62 |
- if [ "i686" == "%{_target_cpu}" ] || [ "x86_64" == "%{_target_cpu}" ] \
|
|
|
eaaa62 |
- then \
|
|
|
eaaa62 |
- xenver=$(rpm -q kernel-xen-devel-%{kverrel}|head -n 1)\
|
|
|
eaaa62 |
- kdver=$(rpm -q kernel-kdump-devel-%{kverrel}|head -n 1)\
|
|
|
eaaa62 |
- if [ "kernel-xen-devel-%{kverrel}" == "$xenver" ] \
|
|
|
eaaa62 |
- then \
|
|
|
eaaa62 |
- flavors="$flavors xen" \
|
|
|
eaaa62 |
- fi \
|
|
|
eaaa62 |
- if [ "kernel-kdump-devel-%{kverrel}" == "$kdver" ] \
|
|
|
eaaa62 |
- then \
|
|
|
eaaa62 |
- flavors="$flavors kdump" \
|
|
|
eaaa62 |
- fi \
|
|
|
eaaa62 |
- fi \
|
|
|
eaaa62 |
if [ -z "%*" ]; then \
|
|
|
eaaa62 |
flavors_to_build=$flavors \
|
|
|
eaaa62 |
elif [ -z "%{-x}" ]; then \
|
|
|
eaaa62 |
flavors_to_build="%*" \
|
|
|
eaaa62 |
else \
|
|
|
eaaa62 |
flavors_to_build=" $flavors "\
|
|
|
eaaa62 |
- echo "[$flavors_to_build]" >/tmp/tmp.txt
|
|
|
eaaa62 |
for i in %* \
|
|
|
eaaa62 |
do \
|
|
|
eaaa62 |
flavors_to_build=${flavors_to_build//$i /}
|
|
|
eaaa62 |
done \
|
|
|
eaaa62 |
fi \
|
|
|
eaaa62 |
echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
|
|
|
eaaa62 |
- echo "%%global kernel_source() /usr/src/kernels/%kverrel-\\\$([ %%%%{1} = default ] || echo "%%%%{1}.")%_target_cpu" \
|
|
|
eaaa62 |
+ echo "%%global kernel_source() /usr/src/kernels/%kverrel\\\$([ %%%%{1} = default ] || echo ".%%%%{1}")" \
|
|
|
eaaa62 |
+ echo "%%global kernel_module_package_moddir() extra" \
|
|
|
eaaa62 |
if [ ! -z "%{-f*}" ] \
|
|
|
eaaa62 |
then \
|
|
|
eaaa62 |
filelist="%{-f*}" \
|
|
|
eaaa62 |
@@ -231,7 +218,7 @@
|
|
|
eaaa62 |
then \
|
|
|
eaaa62 |
nobuildreqs="yes" \
|
|
|
eaaa62 |
fi \
|
|
|
eaaa62 |
- kmp_override_filelist="$filelist" kmp_override_preamble="$preamble" kmp_nobuildreqs="$buildreqs" %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \
|
|
|
eaaa62 |
+ 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 \
|
|
|
eaaa62 |
)}
|
|
|
eaaa62 |
|
|
|
eaaa62 |
#==============================================================================
|