|
|
1.1 root 1: # kgen version 1.0.2
2: #
3: # Copyright 1992, Mark Williams Company
4: #
5: # Link and patch a kernel with configuration used when COHERENT was installed.
6: #
7: # Usage: kgen [new-kernel-name [lib-directory]]
8: #
9: # new-kernel-name defaults to "/testcoh"
10: # lib-directory defaults to "/conf"
11:
12: #-------------------------------------
13: #
14: # Initialization.
15: #
16: TARGET=${1-/testcoh}
17: KDIR=${2-/conf}
18:
19: #
20: # The following files describe the installed configuration.
21: #
22: PATCHFILE=/conf/gen/patches
23: LDKERFILE=/conf/gen/ldker
24: KBDFILE=/conf/gen/kbd
25:
26: #
27: # If no slash in TARGET, prepend one
28: #
29: if echo $TARGET | grep -v "/" > /dev/null
30: then
31: TARGET="/"$TARGET
32: fi
33:
34: #
35: # If TARGET not at root level, abort.
36: #
37: if echo $TARGET | grep -v "^/.*" > /dev/null
38: then
39: echo "New kernel must be in root directory in order to boot."
40: echo "$0 aborted."
41: exit 1
42: fi
43:
44: #
45: # Ask before overwiting a kernel file.
46: #
47: if [ -f $TARGET ]
48: then
49: echo -n "File $TARGET already exists. Overwrite? "
50: read ANS
51: if [ x${ANS} != xy ]
52: then
53: echo "$0 aborted."
54: exit 1
55: fi
56: fi
57:
58: set -e
59:
60: #-------------------------------------
61: echo "Fetching configuration files..."
62:
63: # Fetch patch file created during installation.
64: sed -e 's/\/mnt\/coherent/$TARGET/' < $PATCHFILE > /tmp/patches
65: chmog 555 bin bin /tmp/patches
66:
67: PATCH=
68: PATCH="${PATCH} drvl+60=lpcon"
69: PATCH="${PATCH} drvl+100=asycon"
70: PATCH="${PATCH} drvl+180=ptycon"
71: PATCH="${PATCH} drvl+460=semcon"
72: #PATCH="${PATCH} drvl+480=shmcon"
73: #PATCH="${PATCH} drvl+500=msgcon"
74:
75: UNDEF=
76: UNDEF="$UNDEF -u lpcon"
77: UNDEF="$UNDEF -u flcon"
78: UNDEF="$UNDEF -u asycon"
79: UNDEF="$UNDEF -u ptycon"
80: UNDEF="$UNDEF -u semcon"
81: #UNDEF="$UNDEF -u shmcon"
82: #UNDEF="$UNDEF -u msgcon"
83:
84: . $LDKERFILE
85:
86: KB=`cat $KBDFILE`
87:
88: #-------------------------------------
89: echo "Linking Target File..."
90:
91: cd $KDIR
92: /bin/ld $UNDEF $HDUNDEF -K -o $TARGET -e stext ker386.o $KB kl386.a
93:
94: #-------------------------------------
95: echo "Patching Target File..."
96:
97: /conf/patch $TARGET $PATCH $HDPATCH
98: /conf/asypatch -v $TARGET < /etc/default/async
99:
100: export TARGET
101: /tmp/patches
102: rm /tmp/patches
103:
104: /bin/chmog 400 sys sys $TARGET
105:
106: echo "\nNew kernel is $TARGET.\n"
107: echo "To test this kernel:"
108: echo " /etc/shutdown to single-user mode"
109: echo " sync"
110: echo " Press reset."
111: echo " During reboot, press SPACE at the prompt to abort default boot."
112: echo " Type `basename $TARGET` at the question mark and press ENTER.\n"
113: echo "To make the new kernel the default start-up kernel:"
114: echo " ln -f $TARGET /autoboot\n"
115: echo -n "Press ENTER to continue."
116: read JUNK
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.