Displaying system model ID string

From: Davis, Alan <Davis_at_tessco.com>
Date: Thu, 16 Mar 2000 14:07:04 -0500

I stole the following code from sys_check to easily
display the system model string as it's shown in
the sys_check report.

#!/bin/ksh
KERNEL=vmunix
TMP5=/tmp/get_systype_out.$$
TMP6=/tmp/get_systype_in.$$

getkvar()
# $1 kernel variable
# $2 print option
# returns value
{
#print "a $1 a $2 a" >&2
        strk="p${2} "
        if [ "$3" != "" ]; then
                strk=""
        fi
        print "" > ${TMP6}
        /usr/bin/dbx -c ${TMP6} -k /$KERNEL /dev/mem << EREEEOF > ${TMP5}
2>&1
${strk}${1}
quit
EREEEOF
        echo "`tail -1 ${TMP5}`"
# jj=`echo "'tail -1 ${TMP5}'" | grep 'not defined or not
active'`
# Insufficient symbol table
# if [ -n "$jj" ]; then
# print "0"
# else
# echo "`tail -1 ${TMP5}`"
# fi

        rm ${TMP5} ${TMP6}
}

        set -- `sizer -c|sed 's/\"//g'`
        styp=$2

        set -- `getkvar '(char *)rpb + rpb->rpb_dsr_off + ((struct rpb_dsr
*) ((char*) rpb + rpb->rpb_dsr_off))->rpb_sysname_off + sizeof (long)'`

        stryp=`echo "$3 $4 $5 $6 $7" | sed 's/\"//g'`

        ptype=`getkvar "(int) proc_type" | sed 's/ //g'`
# /sys/include/arch/alpha/cpuconf.h
        case $ptype in
        2) pstr="EV4 (21064)";;
        5) pstr="EV5 (21164)";;
        6) pstr="EV45 (21064/xxx)";;
        7) pstr="EV56 (21164A)";;
        8) pstr="EV6 (21264)";;
        9) pstr="PCA56 (21164PC)";;
        10) pstr="PCA57 (21164PC)";;
        11) pstr="EV67 (21264A)";;
        12) pstr="EV68CB (21264C)";;
        13) pstr="EV68AL (21264B)";;
        14) pstr="EV68CX (21264D)";;
        *) pstr="unknown $ptype";;
        esac

echo $stryp $pstr
exit

-----
Alan C. Davis
Technology Services
davis_at_tessco.com
                                               
Received on Thu Mar 16 2000 - 19:07:05 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:40 NZDT