As I mentioned before, most of what came out of my research into
performing some kind of kernel version control had to do with
installing some control in the procedure used to generate kernels.
First, we began using RCS to keep track of kernel configuration files,
embedding RCS $Revision strings into the 'ident' statement with
something like:
ident "SERVER$Revision$"
You just have to be careful to make sure that the 'ident' strings does
not have spaces after it is co'ed through RCS because /etc/config will
reject it.
The second major step we took was to use RCS to keep track of kernel
objects, while I didn't find a way to embed strings into the objects,
we chose the next best things which was to embed bogus strings into the
kernel. This was done with a modification to
/usr/kvm/sys/conf.common/newvers.sh
When I receive object patches from Sun, I would install them in the
following manner:
Let's say for example that is was locore.o that needed to be replaced.
This is how I would install it:
cp $LOC/locore.o /sys/sun4c/OBJ/locore.o.p100000-01 # copy with patch number
cd /sys/sun4c/OBJ
rm locore.o
ln -s locore.o.p100000-01 locore.o
This would leave an audit trail. The newvers.sh script that I
modified looks fo these symbolic links and generates a dummy C data
structure so that when I build the kernel and do an 'ident' on it, I
get something like:
$Id: ip_input.o -> ip_input.o.p100149-03 $
$Id: kern_descrip.o -> kern_descrip.o.p100075-06 $
$Id: klm_lockmgr.o -> klm_lockmgr.o.p100075-06 $
$Id: locore.o -> locore.o.p100232-01 $
Here is my version of /usr/kvm/sys/conf.common/newvers.sh
#
# $Header: /home/users/kernel/sys/conf.common/RCS/newvers.sh,v 1.3 1991/10/08 06:37:59 kernel Exp $
#
# $Log: newvers.sh,v $
# Revision 1.3 1991/10/08 06:37:59 kernel
# Added code to insert version of configuration file
# Added code to build dummy rcsid string with indications of patched
# objects
#
# Revision 1.2 1991/10/07 17:12:23 kernel
# Added RCS identification string
#
#
#
# called by: newvers.sh <release_file> <arch>
PATH=/usr/ucb:/bin:/usr/bin
if [ ! -r version ]; then echo 0 > version; fi
touch version
VERS=`expr \`cat version\` + 1`
OS="SunOS"
# Temporary workaround - partial initialization of uname "SunOS" string
# because some install scripts assume single "SunOS" in kernel.
# X_OS to be replaced by OS later
X_OS="sunOS"
ARCH=$2
# Truncate release field to 8 chars in utsname
RELEASE=`expr \`cat $1\` : '\(..\{0,7\}\)'`
echo '#include <sys/utsname.h>' > vers.c
echo >> vers.c
SNAME=`basename \`pwd\``
SLINE=`grep "^ident" ../conf/$SNAME | awk '{print $2}' | sed 's/"//g'`
echo $VERS $SLINE `cat $1` | \
awk ' { version = $1; system = $2; release = $3; }\
END { printf "char version[] = \"SunOS Release %s (%s) #%d: ", release, system, version >> "vers.c";\
printf "%d\n", version > "version"; }'
echo `date`'\nCopyright (c) 1983-1990, Sun Microsystems, Inc.\n";' >> vers.c
echo >> vers.c
# Initialize the utsname structure
echo $X_OS $RELEASE $VERS $ARCH | \
awk ' { sysname = $1; release = $2; version = $3; arch = $4; }\
END { printf "struct utsname utsname =\n\t{ \"%s\", \"\", \"\", \"%s\", \"%s\", \"%s\" };\n\n", \
sysname, release, version, arch >> "vers.c" ; } '
# Create dummy variable containing identification for patched objects
#
(cd ../OBJ; echo 'static char *rcsid[] = {'; ls -l *.o | grep lrwx | \
cut -c46-500 | sed 's/^/ "\$Id: /' | \
sed 's/$/ \$",/'; echo '""};') >> vers.c
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:18 CDT