Re: A more accurate System.map, including modules

Gerd Knorr (kraxel@goldbach.isdn.cs.tu-berlin.de)
Tue, 23 Sep 1997 10:24:58 +0200


In article <19970922222518.28963.qmail@mail.ocs.com.au>, you wrote:
>On Mon, 22 Sep 1997 20:41:51 +0100 (BST),
>alan@lxorguk.ukuu.org.uk (Alan Cox) wrote:
>>Whats wrong with insmod -m ? It seems there are an army of people reinventing
>>before typing "man insmod"
>
>Not this time, insmod -m was my first choice. However -m is only
>supported by insmod, not by modprobe. kerneld does not pass the -m
>flag so it would need to be changed.

kerneld calls modprobe, modprobe calls insmod. insmod is'nt the real
insmod, but the script below. the real insmod binary is
/sbin/insmod-real. *All* loadmaps go to /lib/modules/loadmaps

Gerd

-----------------------------------------------------------------------
#!/bin/sh
# insmod wrapper for loadmap trickery
# usage:
# 1) rename insmod to insmod-real
# 2) copy or symlink this script to insmod
#
# then the script will dump all module loadmaps to $MAPDIR
#
#######################################################################

# destination directory
MAPDIR=/lib/modules/loadmaps

# the real thing
INSMOD=/sbin/insmod-real

#######################################################################
OPTS=""
MAP=""

set -- `getopt fkmpsxXvo: $*` || exit 1
for i; do
case $i in
-f | -k | -p | -x | -X | -v)
# pass throuth
OPTS="$OPTS $i"; shift ;;
-o)
# pass throuth, with arg
OPTS="$OPTS $i $2"; shift; shift;;
-m)
# note this, no file but stdout for loadmap
OPTS="$OPTS $1"; MAP="nofile"; shift ;;
-s)
# kill - no syslog becauce we want dump to a file
shift;;
--)
# grab module name for loadmap filename
MOD=$2; shift; shift; break;
esac
done

if [ "$MAP" = "nofile" ]; then
# -m on command line -- dump loadmap to stdout (to make it
# work like people expect from docs)
$INSMOD $OPTS $MOD $*
else
# dump it to our directory
DESTFILE="$MAPDIR/`basename $MOD .o`"
echo "$INSMOD $OPTS $MOD $*" > $DESTFILE
date >> $DESTFILE
echo "--" >> $DESTFILE
$INSMOD $OPTS -m $MOD $* >> $DESTFILE
fi