BSD 4_3_Reno release
[unix-history] / usr / src / etc / etc.hp300 / MAKEDEV
CommitLineData
9ebf8dd1
KB
1#!/bin/sh -
2#
0ba30325
KB
3# Copyright (c) 1990 The Regents of the University of California.
4# All rights reserved.
9ebf8dd1 5#
1c15e888
C
6# Redistribution and use in source and binary forms are permitted provided
7# that: (1) source distributions retain this entire copyright notice and
8# comment, and (2) distributions including binaries display the following
9# acknowledgement: ``This product includes software developed by the
10# University of California, Berkeley and its contributors'' in the
11# documentation or other materials provided with the distribution and in
12# all advertising materials mentioning features or use of this software.
13# Neither the name of the University nor the names of its contributors may
14# be used to endorse or promote products derived from this software without
15# specific prior written permission.
16# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
0ba30325 19#
1c15e888 20# @(#)MAKEDEV 5.2 (Berkeley) 6/22/90
9ebf8dd1
KB
21#
22# Device "make" file. Valid arguments:
23# std standard devices
24# local configuration specific devices
25# Tapes:
26# ct* HP300 HP-IB cartridge tape
27# Disks:
28# cd* "concatenated" pseudo-disks
9ebf8dd1
KB
29# rd* HP300 HP-IB disks
30# sd* HP300 SCSI disks
0ba30325 31# vnd* "file" pseudo-disks
9ebf8dd1
KB
32# Terminal multiplexors:
33# dca* HP200/300 single port serial interface
34# dcm* HP200/300 4 port serial mux interface
35# Pseudo terminals:
36# pty* set of 16 master and slave pseudo terminals
37# Printers:
38# Call units:
39# Special purpose devices:
40# flog* kernel logging device
41# grf* raw interface to HP300 graphics devices
42# ite* terminal emulator interface to HP300 graphics devices
43# hil HP300 HIL input devices
0ba30325
KB
44
45PATH=/sbin:/bin/:/usr/bin
9ebf8dd1
KB
46umask 77
47for i
48do
49case $i in
50
51std)
0ba30325
KB
52 mknod console c 0 0
53 mknod drum c 3 0 ; chmod 640 drum ; chgrp kmem drum
54 mknod kmem c 2 1 ; chmod 640 kmem ; chgrp kmem kmem
55 mknod mem c 2 0 ; chmod 640 mem ; chgrp kmem mem
56 mknod null c 2 2 ; chmod 666 null
57 mknod tty c 1 0 ; chmod 666 tty
58 mknod klog c 6 0 ; chmod 600 klog
59 mknod stdin c 53 0 ; chmod 666 stdin
60 mknod stdout c 53 1 ; chmod 666 stdout
61 mknod stderr c 53 2 ; chmod 666 stderr
62 mkdir fd > /dev/null 2>&1
63 (cd fd && eval `echo "" | awk ' BEGIN { \
64 for (i = 0; i < 64; i++) \
65 printf("mknod %d c 53 %d;", i, i)}'`)
66 chown -R bin.bin fd
67 chmod 555 fd
68 chmod 666 fd/*
9ebf8dd1
KB
69 ;;
70
71ct*)
72 umask 0 ; unit=`expr $i : '..\(.*\)'`
73 case $i in
74 ct*) blk=0; chr=7;;
75 esac
76 case $unit in
77 0|1|2|3|4|5|6|7)
78 four=`expr $unit + 4` ; eight=`expr $unit + 8`
79 twelve=`expr $unit + 12`; twenty=`expr $unit + 20`
80 #
81 # block devices don't work so don't make them
0ba30325
KB
82 #mknod ct$unit b $blk $unit
83 #mknod ct$four b $blk $four
84 #mknod ct$eight b $blk $eight
85 #mknod ct$twelve b $blk $twelve
86 #mknod nct$unit b $blk $four ;: sanity w/pdp11 v7
87 #mknod nct$eight b $blk $twelve ;: ditto
9ebf8dd1 88 #
0ba30325
KB
89 mknod rct$unit c $chr $unit
90 mknod rct$four c $chr $four
91 mknod rct$eight c $chr $eight
92 mknod rct$twelve c $chr $twelve
9ebf8dd1
KB
93 ln rct$four nrct$unit ;: sanity w/pdp11 v7
94 ln rct$twelve nrct$eight ;: ditto
95 ;;
96 *)
97 echo bad unit for tape in: $1
98 ;;
99 esac
100 umask 77
101 ;;
102
103cd*|fd*|rd*|sd*)
104 umask 2 ; unit=`expr $i : '..\(.*\)'`
105 case $i in
106 rd*) name=rd; blk=2; chr=9;;
107 sd*) name=sd; blk=4; chr=8;;
108 cd*) name=cd; blk=5; chr=17;;
0ba30325 109 vnd*) name=vnd; blk=6; chr=19;;
9ebf8dd1
KB
110 esac
111 case $unit in
112 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|\
113 17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)
0ba30325
KB
114 mknod ${name}${unit}c b $blk `expr $unit '*' 8 + 2`
115 mknod r${name}${unit}c c $chr `expr $unit '*' 8 + 2`
116 if [ $name != cd -a $name != vnd ]
9ebf8dd1 117 then
0ba30325
KB
118 mknod ${name}${unit}a b $blk `expr $unit '*' 8 + 0`
119 mknod ${name}${unit}b b $blk `expr $unit '*' 8 + 1`
120 mknod ${name}${unit}d b $blk `expr $unit '*' 8 + 3`
121 mknod ${name}${unit}e b $blk `expr $unit '*' 8 + 4`
122 mknod ${name}${unit}f b $blk `expr $unit '*' 8 + 5`
123 mknod ${name}${unit}g b $blk `expr $unit '*' 8 + 6`
124 mknod ${name}${unit}h b $blk `expr $unit '*' 8 + 7`
125 mknod r${name}${unit}a c $chr `expr $unit '*' 8 + 0`
126 mknod r${name}${unit}b c $chr `expr $unit '*' 8 + 1`
127 mknod r${name}${unit}d c $chr `expr $unit '*' 8 + 3`
128 mknod r${name}${unit}e c $chr `expr $unit '*' 8 + 4`
129 mknod r${name}${unit}f c $chr `expr $unit '*' 8 + 5`
130 mknod r${name}${unit}g c $chr `expr $unit '*' 8 + 6`
131 mknod r${name}${unit}h c $chr `expr $unit '*' 8 + 7`
9ebf8dd1
KB
132 fi
133 chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
134 chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
135 ;;
136 *)
137 echo bad unit for disk in: $i
138 ;;
139 esac
140 umask 77
141 ;;
142
143dca*)
144 unit=`expr $i : 'dca\(.*\)'`
145 case $unit in
146 0)
0ba30325 147 mknod tty0 c 12 0
9ebf8dd1
KB
148 ;;
149 *)
150 echo bad unit for dca in: $i
151 ;;
152 esac
153 ;;
154
155dcm*)
156 unit=`expr $i : 'dcm\(.*\)'`
157 case $unit in
158 0|1|2|3)
159 eval `echo $unit | awk ' { unit = $1; u = 4 * $1 } END {
160 for (i = 0; i < 4; i++)
0ba30325 161 printf("mknod tty0%x c 15 %d; ",u+i,u+i); }'`
9ebf8dd1
KB
162 ;;
163 *)
164 echo bad unit for dcm in: $i
165 ;;
166 esac
167 ;;
168
169ite*)
170 unit=`expr $i : 'ite\(.*\)'`
171 case $unit in
172 0|1|2|3)
0ba30325 173 mknod ttye${unit} c 13 ${unit}
9ebf8dd1
KB
174 ;;
175 *)
176 echo bad unit for ite in: $i
177 ;;
178 esac
179 ;;
180
181grf*)
182 unit=`expr $i : 'grf\(.*\)'`
183 case $unit in
184 0|1|2|3)
0ba30325 185 mknod grf${unit} c 10 ${unit}; chmod 666 grf${unit}
9ebf8dd1
KB
186 echo "grf${unit}: use MAKEDEV.hpux to make HP-UX names for device"
187 ;;
188 *)
189 echo bad unit for grf in: $i
190 ;;
191 esac
192 ;;
193
194hil)
195 for unit in 0 1 2 3 4 5 6 7
196 do
0ba30325 197 mknod hil${unit} c 14 ${unit}
9ebf8dd1
KB
198 if [ -f /usr/local/hilinfo ]
199 then
200 case `/usr/local/hilinfo -t hil${unit}` in
201 mouse)
202 if [ ! -f locator ]
203 then
204 ln hil${unit} locator
205 fi
206 ;;
207 keyboard)
208 if [ ! -f keyboard ]
209 then
210 ln hil${unit} keyboard
211 fi
212 ;;
213 *)
214 ;;
215 esac
216 fi
217 done
218 if [ ! -f /usr/local/hilinfo ]
219 then
220 ln hil1 keyboard
221 ln hil3 locator
222 fi
223 chmod 666 hil*
224 echo "hil: use MAKEDEV.hpux to make HP-UX names for devices"
225 ;;
226
227pty*)
228 class=`expr $i : 'pty\(.*\)'`
229 case $class in
230 0) offset=0 name=p;;
231 1) offset=16 name=q;;
232 2) offset=32 name=r;;
233 3) offset=48 name=s;;
234# Note that telnetd, rlogind, and xterm (at least) only look at p-s.
235 4) offset=64 name=t;;
236 *) echo bad unit for pty in: $i;;
237 esac
238 case $class in
239 0|1|2|3|4)
240 umask 0
241 eval `echo $offset $name | awk ' { b=$1; n=$2 } END {
242 for (i = 0; i < 16; i++)
0ba30325
KB
243 printf("mknod tty%s%x c 4 %d; \
244 mknod pty%s%x c 5 %d; ", \
9ebf8dd1
KB
245 n, i, b+i, n, i, b+i); }'`
246 umask 77
247 if [ $class = 1 ]; then
248 mv ttyqf ttyv0; mv ptyqf ptyv0
249 fi
250 ;;
251 esac
252 ;;
253
254local)
255 umask 0
256 sh MAKEDEV.local
257 ;;
258
259esac
260done