Hi all. As a result of private email correspondance I have recently received, I became aware that the current system of identifying the versions of the various subsystems required to support any particular kernel version is inadequate, and decided to do something about it. The enclosed patch is my offering to rectify this. The problems identified are: 1. Different subsystems are identified in Documentation/Changes and in scripts/ver_linux, probably due to the difficulty of maintaining two files in sync with each other. As a result, it is not clear what the required versions of some subsystems are. 2. The existing script does not make it clear which subsystems need to be updated. The user is expected to decide by cross-referencing the details it provides with those provided elsewhere. 3. The command to perform this analysis is not immediately obvious. My offering (developed against the 2.4.2 kernel source tree) does away with all three of these problems by: A. Making Documentation/Changes the sole source of information on the subsystems required. The script I have developed then reads the table in this file, and uses commands listed therein to determine the installed versions of the relevant subsystems. The format of this table had to be changed slightly to accommodate the script, but this was done without impairing the readability thereof. B. Adding lines to Documentation/Changes to document those subsystems listed by scripts/ver_linux that were not already in the table in Documentation/Changes so that all relevant subsystems are considered. This was done by adding a separate table formatted identically to the existing one, but indicating that the subsystems therein may not be required. Note that the "required versions" listed in this new table are those installed on my system, with the exception of the Linux C++ library which is apparently not installed here. These versions need to be tweaked to reflect the actual requirements for that kernel. C. Comparing the installed and required versions of each subsystem, and indicating the results of that comparison in the displayed results by colouring the name of the subsystem. A facility to disable this is also included, and is activated by providing a parameter to the script. Any parameter will serve this function. D. Inserting lines in the primary Makefile to allow `make vsn` to run the relevant command to generate the results with colouring, and `make vsnbw` to do so without colours. Both change the permissions of the script to make it an executable. There is ONE problem with this method, which I have not been able to solve. This is that the command used by scripts/ver_linux to determine the installed version of the Gnu C Library can't be replicated using the method this script is based on, and I have had to replace it with a simpler script which may produce different results in some cases. If this is a problem, it is open to others to solve as I have licensed this under version 2 (only) of the Gnu General Public Licence. Best wishes from Riley.
--- linux/Documentation/Changes~ Fri Feb 16 23:53:08 2001 +++ linux/Documentation/Changes Tue Mar 13 23:38:46 2001 @@ -48,16 +48,31 @@ Card) hardware, for example, you probably needn't concern yourself with pcmcia-cs. -o Gnu C 2.91.66 # gcc --version +o Gnu C # 2.91.66 # gcc --version -o Gnu make 3.77 # make --version +o Gnu make # 3.77 # make --version -o binutils 2.9.1.0.25 # ld -v +o binutils # 2.9.1.0.25 # ld -v -o util-linux 2.10o # fdformat --version +o util-linux # 2.10o # fdformat --version -o modutils 2.4.2 # insmod -V +o modutils # 2.4.2 # insmod -V -o e2fsprogs 1.19 # tune2fs +o e2fsprogs # 1.19 # tune2fs -o reiserfsprogs 3.x.0b # reiserfsck 2>&1|grep reiserfsprogs +o reiserfsprogs # 3.x.0b # reiserfsck 2>&1|grep reiserfsprogs -o pcmcia-cs 3.1.21 # cardmgr -V +o pcmcia-cs # 3.1.21 # cardmgr -V -o PPP 2.4.0 # pppd --version +o PPP # 2.4.0 # pppd --version /dev/tty -o isdn4k-utils 3.1pre1 # isdnctrl 2>&1|grep version +o isdn4k-utils # 3.1pre1 # isdnctrl 2>&1|grep version + +In addition, it is wise to ensure that the following packages are at least +at the versions suggested below, although these may not be required, depending +on the exact configuration of your system: + +o Console Tools # 0.3.3 # loadkeys -V +o Current Kernel # 2.2.10 # uname -a +o Dynamic Linker # 2.1.0 # ldd -v > /dev/null && ldd -v || ldd +--version +o ProcPS # 2.0.0 # ps --version +o Mount # 2.10e # mount --version +o Net Tools # 1.50 # hostname -V +o Shell Utils # 2.0 # expr --v + +o Linux C Library # 2.1.0 # ls /lib/libc-* | cut -d - -f 2 | sed +'s/\.so//' +o Linux C++ Library # 1.0 # ls -l /usr/lib/lib{g,stdc}++.so 2> /dev/null Kernel compilation ================== --- linux/scripts/version~ Thu Jan 1 01:00:00 1970 +++ linux/scripts/version Wed Mar 14 00:14:44 2001 @@ -0,0 +1,139 @@ +#!/bin/bash + +unalias -a + +function display() { + local W + declare -i N=$1 SZ=0 + + while read W ; do + SZ=`echo -n "$W" | wc -c` + N=$N+$SZ+1 + if [ $N -ge $1 ]; then + printf '\n\t%s' "$W" + N=$SZ+8 + else + printf ' %s' "$W" + fi + done + echo +} + +function getmod() { + tr -s '\t' ' ' < /proc/modules 2> /dev/null \ + | cut -d ' ' -f 1 \ + | sed 's/^ *\([^ ].*[^ ]\) *$/\1/' \ + | sort -f \ + | tr -s '\n' ' ' +} + +function encode() { + if [ -z "$1" ]; then + cat + else + sed 's/'"`printf '\033'`"'\[[0-9;]*m//g' + fi +} + +function getvsn() { + local CMD ITEM RES STAT VSN + + cat <<-.EOF + The status of the subsystems needed to use the `kernel` kernel are: + + .EOF + printf '%-25s %-16s %s\n' \ + 'Subsystem' 'Required' 'Installed' \ + '~~~~~~~~~~~~~~~~~~' '~~~~~~~~~~~~' '~~~~~~~~~~~~~' + prepare | while read ITEM VSN CMD ; do + export CMD=`echo "$CMD" | tr '_' ' '` + export ITEM=`echo "$ITEM" | tr '_' ' '` + export RES=`process "$CMD"` + export STAT=`status "$VSN" "$RES"` + printf '\033[1;%sm%-25s\033[0m %-16s <= %s\n' "$STAT" "$ITEM" "$VSN" "$RES" \ + | encode "$1" + done + printf '%-25s %-16s %s\n\n' \ + '~~~~~~~~~~~~~~~~~~' '~~~~~~~~~~~~' '~~~~~~~~~~~~~' + if [ -z "$1" ]; then + printf 'Colours used in the above table are as follows:\n\n' + printf '\033[1;35mMAGENTA\033[0m = Package is not installed. Is it +needed?\n\n' + printf '\033[1;31m RED \033[0m = Installed version of package is too old, +upgrade.\n' + printf '\033[1;32m GREEN \033[0m = Installed version of package is required +version.\n' + printf '\033[1;33m AMBER \033[0m = Installed version of package is newer.\n\n' + fi +} + +function header() { + cat <<-.EOF + `basename "$0"` 1.0.0 Linux Kernel Version Dependancy Analyser + Copyright (C) 2001, Memory Alpha Systems, + Released under the GNU General Public Licence, v2. + + .EOF +} + +function kernel() { + local A B C D + + head -5 Makefile \ + | fgrep = \ + | cut -d = -f 2 \ + | tr '\n' ' ' \ + | ( cat ; echo ) \ + | while read A B C D ; do + if [ -z "$D" ]; then + echo $A.$B.$C + else + echo $A.$B.$C-$D + fi + done +} + +function modules() { + local M=`getmod` + + printf 'The following modules are installed:\n' + if [ -n "$M" ]; then + printf '%s\n' $M | display 73 + echo + fi +} + +function prepare() { + grep '#[^#]*#' Documentation/Changes \ + | sort -f \ + | tr -s '\t ' '_' \ + | sed 's/^o_*\(.*\)_#_\(.*\)_#_\(.*\)$/\1 \2 \3/' +} + +function process() { + local X + + eval "$1" 2>&1 \ + | head -1 \ + | tr -cs '0-9.A-Za-z' '\n' \ + | grep '[0-9]\.[0-9]' \ + | tail -1 +} + +function status() { + local FIRST + + if [ -z "$2" ]; then + echo 35 + elif [ "$1" != "$2" ]; then + FIRST=`printf '%s\n' "$1" "$2" | sort -n | head -1` + if [ "$FIRST" != "$2" ]; then + echo 33 + else + echo 31 + fi + else + echo 32 + fi +} + +header +modules +getvsn "$@" --- linux/Makefile~ Thu Feb 22 00:54:15 2001 +++ linux/Makefile Wed Mar 14 09:07:36 2001 @@ -239,6 +239,14 @@ Version: dummy @rm -f include/linux/compile.h +vsn: + chmod 755 scripts/KnlVsn + scripts/KnlVsn + +vsnbw: + chmod 755 scripts/KnlVsn + scripts/KnlVsn bw + boot: vmlinux @$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" -C arch/$(ARCH)/boot