X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=scripts%2Fdepmod.sh;h=122599b1c13b7d4ca14b4e9ff637ec19789f3e64;hb=60cbc8c9108be5542b8b7b9e16231fdee062f6d9;hp=a272356859497fec41796a37e750c4dfc891827d;hpb=655402d41742cc8e490f4357745408d361bdd2d4;p=kernel%2Flinux-3.0.git diff --git a/scripts/depmod.sh b/scripts/depmod.sh index a272356..122599b 100755 --- a/scripts/depmod.sh +++ b/scripts/depmod.sh @@ -2,22 +2,36 @@ # # A depmod wrapper used by the toplevel Makefile -if test $# -ne 2; then - echo "Usage: $0 /sbin/depmod " >&2 +if test $# -ne 3; then + echo "Usage: $0 /sbin/depmod " >&2 exit 1 fi DEPMOD=$1 KERNELRELEASE=$2 - -if ! "$DEPMOD" -V 2>/dev/null | grep -q module-init-tools; then - echo "Warning: you may need to install module-init-tools" >&2 - echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt" >&2 - sleep 1 -fi +SYMBOL_PREFIX=$3 if ! test -r System.map -a -x "$DEPMOD"; then exit 0 fi + +# older versions of depmod don't support -P +# support was added in module-init-tools 3.13 +if test -n "$SYMBOL_PREFIX"; then + release=$("$DEPMOD" --version) + package=$(echo "$release" | cut -d' ' -f 1) + if test "$package" = "module-init-tools"; then + version=$(echo "$release" | cut -d' ' -f 2) + later=$(printf '%s\n' "$version" "3.13" | sort -V | tail -n 1) + if test "$later" != "$version"; then + # module-init-tools < 3.13, drop the symbol prefix + SYMBOL_PREFIX="" + fi + fi + if test -n "$SYMBOL_PREFIX"; then + SYMBOL_PREFIX="-P $SYMBOL_PREFIX" + fi +fi + # older versions of depmod require the version string to start with three # numbers, so we cheat with a symlink here depmod_hack_needed=true @@ -40,7 +54,7 @@ set -- -ae -F System.map if test -n "$INSTALL_MOD_PATH"; then set -- "$@" -b "$INSTALL_MOD_PATH" fi -"$DEPMOD" "$@" "$KERNELRELEASE" +"$DEPMOD" "$@" "$KERNELRELEASE" $SYMBOL_PREFIX ret=$? if $depmod_hack_needed; then