2006-12-19 00:17:44 +01:00
|
|
|
SUSE specific kernel provides/requires scripts
|
|
|
|
|
2006-12-19 00:17:44 +01:00
|
|
|
Index: scripts/find-provides.ksyms
|
|
|
|
===================================================================
|
|
|
|
--- /dev/null
|
|
|
|
+++ scripts/find-provides.ksyms
|
|
|
|
@@ -0,0 +1,20 @@
|
2006-12-19 00:17:44 +01:00
|
|
|
+#! /bin/sh
|
|
|
|
+
|
|
|
|
+IFS=$'\n'
|
|
|
|
+
|
|
|
|
+case "$1" in
|
|
|
|
+kernel-module-*) ;; # Fedora kernel module package names start with
|
|
|
|
+ # kernel-module.
|
2006-12-19 00:17:44 +01:00
|
|
|
+kernel*) is_kernel_package=1 ;;
|
2006-12-19 00:17:44 +01:00
|
|
|
+esac
|
|
|
|
+
|
2006-12-19 00:17:44 +01:00
|
|
|
+if ! [ -z "$is_kernel_package" ]; then
|
|
|
|
+ cat > /dev/null
|
|
|
|
+ exit 0
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
+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'
|
2006-12-19 00:17:44 +01:00
|
|
|
+done \
|
|
|
|
+| sort -u
|
2006-12-19 00:17:44 +01:00
|
|
|
Index: scripts/find-requires.ksyms
|
|
|
|
===================================================================
|
|
|
|
--- /dev/null
|
|
|
|
+++ scripts/find-requires.ksyms
|
|
|
|
@@ -0,0 +1,58 @@
|
2006-12-19 00:17:44 +01:00
|
|
|
+#! /bin/bash
|
|
|
|
+
|
|
|
|
+IFS=$'\n'
|
|
|
|
+
|
|
|
|
+case "$1" in
|
|
|
|
+kernel-module-*) ;; # Fedora kernel module package names start with
|
|
|
|
+ # kernel-module.
|
|
|
|
+kernel*) is_kernel_package=1 ;;
|
|
|
|
+esac
|
|
|
|
+
|
|
|
|
+all_provides() {
|
|
|
|
+ for module in "$@"; do
|
|
|
|
+ nm "$module"
|
|
|
|
+ done \
|
|
|
|
+ | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):\1\t\2:p' \
|
2006-12-19 00:17:44 +01:00
|
|
|
+ | sort -k2 -u
|
2006-12-19 00:17:44 +01:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+all_requires() {
|
|
|
|
+ for module in "$@"; do
|
|
|
|
+ set -- $(/sbin/modinfo -F vermagic "$module" | sed -e 's: .*::' -e q)
|
2006-12-19 00:17:44 +01:00
|
|
|
+ if [ -e "/boot/symsets-$1.tar.gz" ]; then
|
|
|
|
+ /sbin/modprobe --dump-modversions "$module" \
|
2006-12-19 00:17:44 +01:00
|
|
|
+ | sed -r -e 's:^0x0*::' -e 's:$:\t'"$1"':'
|
2006-12-19 00:17:44 +01:00
|
|
|
+ fi
|
2006-12-19 00:17:44 +01:00
|
|
|
+ done \
|
2006-12-19 00:17:44 +01:00
|
|
|
+ | sort -k2 -u
|
2006-12-19 00:17:44 +01:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+if ! [ -z "$is_kernel_package" -a -e /sbin/modinfo -a -e /sbin/modprobe ]; then
|
|
|
|
+ cat > /dev/null
|
|
|
|
+ exit 0
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
+modules=($(grep -E '/lib/modules/.+\.ko$'))
|
|
|
|
+if [ ${#modules[@]} -gt 0 ]; then
|
|
|
|
+ symset_table=$(mktemp -t ${0##*/}.XXXXX)
|
2006-12-19 00:17:44 +01:00
|
|
|
+ /usr/lib/rpm/symset-table | sort > $symset_table
|
2006-12-19 00:17:44 +01:00
|
|
|
+
|
|
|
|
+ join -t $'\t' -j 1 -a 2 $symset_table <(
|
|
|
|
+ # Filter out requirements that we fulfill ourself.
|
|
|
|
+ join -t $'\t' -j 2 -v 1 \
|
|
|
|
+ <(all_requires "${modules[@]}") \
|
|
|
|
+ <(all_provides "${modules[@]}") \
|
|
|
|
+ | awk '
|
|
|
|
+ BEGIN { FS = "\t" ; OFS = "\t" }
|
|
|
|
+ { print $3 "/" $2 "/" $1 }
|
|
|
|
+ ' \
|
2006-12-19 00:17:44 +01:00
|
|
|
+ | sort -u) \
|
2006-12-19 00:17:44 +01:00
|
|
|
+ | sort -u \
|
|
|
|
+ | awk '
|
|
|
|
+ { FS = "\t" ; OFS = "\t" }
|
2006-12-19 00:17:44 +01:00
|
|
|
+ NF == 3 { print "kernel(" $2 ") = " $3
|
2008-05-06 18:29:40 +02:00
|
|
|
+ next }
|
2006-12-19 00:17:44 +01:00
|
|
|
+ { split($1, arr, "/")
|
|
|
|
+ print "ksym(" arr[3] ") = " arr[2] }
|
2006-12-19 00:17:44 +01:00
|
|
|
+ '
|
|
|
|
+fi
|