3 # Copyright (c) 1990 The Regents of the University of California.
6 # Written and contributed by W. Jolitz 12/90
8 # Redistribution and use in source and binary forms are permitted provided
9 # that: (1) source distributions retain this entire copyright notice and
10 # comment, and (2) distributions including binaries display the following
11 # acknowledgement: ``This product includes software developed by the
12 # University of California, Berkeley and its contributors'' in the
13 # documentation or other materials provided with the distribution and in
14 # all advertising materials mentioning features or use of this software.
15 # Neither the name of the University nor the names of its contributors may
16 # be used to endorse or promote products derived from this software without
17 # specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 # @(#)MAKEDEV 5.2 (Berkeley) 6/22/90
24 # Device "make" file. Valid arguments:
25 # all makes all known devices, standard number of units (or close)
26 # std standard devices
27 # local configuration specific devices
30 # wt* QIC-interfaced (e.g. not SCSI) 3M cartridge tape
31 # st* "NEW type scsi tapes" (old driver uses the
32 # block devices of the disks to get access)
35 # wd* "winchester" disk drives (ST506,IDE,ESDI,RLL,...)
36 # fd* "floppy" disk drives (3 1/2", 5 1/4")
41 # pc* devices for stock pccons
42 # vty* virtual console devices for syscons/pcvt/codrv
45 # mse* Logitech and ATI Inport bus mouse
49 # com* standard PC COM ports (really makes tty* entries for com)
50 # sio* fast interrupt PC COM ports (really makes tty* entries for sio)
51 # tty* alias for sio ports, this is what the system really wants
54 # pty* set of 16 master and slave pseudo terminals
55 # vty* virtual terminals using syscons/pcvt/codrv console
59 # lpa* interruptless lp
63 # Special purpose devices:
67 # tw* xten power controller
69 # $Id: MAKEDEV,v 1.10 1993/10/06 03:35:03 rgrimes Exp $
72 PATH=/sbin:/bin/:/usr/bin:/usr/sbin:
79 sh MAKEDEV std # standard
80 sh MAKEDEV wd0 wd1 fd0 fd1 wt0 sd0 sd1 st0 cd0 # bdev
81 sh MAKEDEV pty0 tty0 tty1 tty2 tty3 pc0 lpt0 lpt1 lpt2 # cdev
82 sh MAKEDEV ch0 tw0 bpf0 dcf0 lpa0 lpa1 lpa2 # cdev
83 sh MAKEDEV speaker mse0 sio0 sio1 sio2 sio3 # cdev
84 # NOTE: co0 and vty04 are not done by a "sh MAKEDEV all"
85 # these are for codrv and interfere with other devices! - rgrimes
88 rm -f console drum mem kmem null tty klog stdin stdout stderr
89 mknod console c 0 0; chmod 600 console; chown root.wheel console
90 mknod drum c 4 0; chmod 640 drum; chown root.kmem drum
91 mknod kmem c 2 1; chmod 640 kmem; chown root.kmem kmem
92 mknod mem c 2 0; chmod 640 mem; chown root.kmem mem
93 mknod null c 2 2; chmod 666 null; chown root.wheel null
94 mknod zero c 2 12; chmod 666 zero; chown root.wheel zero
95 mknod io c 2 14; chmod 640 io; chown root.kmem io
96 mknod tty c 1 0; chmod 666 tty; chown root.wheel tty
97 mknod klog c 7 0; chmod 600 klog; chown root.wheel klog
98 mknod stdin c 22 0; chmod 666 stdin; chown root.wheel stdin
99 mknod stdout c 22 1; chmod 666 stdout; chown root.wheel stdout
100 mknod stderr c 22 2; chmod 666 stderr; chown root.wheel stderr
102 mkdir fd > /dev/null 2>&1
103 (cd fd && eval `echo "" | awk ' BEGIN { \
104 for (i = 0; i < 64; i++) \
105 printf("mknod %d c 22 %d;", i, i)}'`)
112 # Create device files for new Archive/Wangtek QIC-02 tape driver (vak)
114 umask 2 ; u=`expr $i : '..\(.*\)'`
115 if [ x$u = x ]; then u=0; fi
116 rm -f rwt$u nrwt$u rwt${u}a nrwt${u}a rwt${u}b nrwt${u}b
117 mknod rwt${u} c 10 `expr 0 + $u` # 150 megabytes
118 mknod nrwt${u} c 10 `expr 4 + $u`
119 mknod rwt${u}a c 10 `expr 8 + $u` # 120 megabytes
120 mknod nrwt${u}a c 10 `expr 12 + $u`
121 mknod rwt${u}b c 10 `expr 16 + $u` # 60 megabytes
122 mknod nrwt${u}b c 10 `expr 20 + $u`
123 chown root.operator rwt$u nrwt$u rwt${u}a nrwt${u}a rwt${u}b nrwt${u}b
128 umask 2 ; unit=`expr $i : '..\(.*\)'`
130 fd*) name=fd; blk=2; chr=9;;
131 sd*) name=sd; blk=4; chr=13;;
132 wd*) name=wd; blk=0; chr=3;;
134 rm -f $name$unit? r$name$unit?
137 mknod ${name}${unit}a b $blk `expr $unit '*' 8 + 0`
138 mknod ${name}${unit}b b $blk `expr $unit '*' 8 + 1`
139 mknod ${name}${unit}c b $blk `expr $unit '*' 8 + 2`
140 mknod ${name}${unit}d b $blk `expr $unit '*' 8 + 3`
141 mknod ${name}${unit}e b $blk `expr $unit '*' 8 + 4`
142 mknod ${name}${unit}f b $blk `expr $unit '*' 8 + 5`
143 mknod ${name}${unit}g b $blk `expr $unit '*' 8 + 6`
144 mknod ${name}${unit}h b $blk `expr $unit '*' 8 + 7`
145 mknod r${name}${unit}a c $chr `expr $unit '*' 8 + 0`
146 mknod r${name}${unit}b c $chr `expr $unit '*' 8 + 1`
147 mknod r${name}${unit}c c $chr `expr $unit '*' 8 + 2`
148 mknod r${name}${unit}d c $chr `expr $unit '*' 8 + 3`
149 mknod r${name}${unit}e c $chr `expr $unit '*' 8 + 4`
150 mknod r${name}${unit}f c $chr `expr $unit '*' 8 + 5`
151 mknod r${name}${unit}g c $chr `expr $unit '*' 8 + 6`
152 mknod r${name}${unit}h c $chr `expr $unit '*' 8 + 7`
153 chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
154 chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
157 echo bad unit for disk in: $i
164 unit=`expr $i : '...\(.*\)'`
166 mknod tty0$unit c 8 $unit
167 chown uucp.wheel tty0$unit
171 class=`expr $i : 'pty\(.*\)'`
174 1) offset=16 name=q;;
175 2) offset=32 name=r;;
176 3) offset=48 name=s;;
177 # Note that telnetd, rlogind, and xterm (at least) only look at p-s.
178 4) offset=64 name=t;;
179 *) echo bad unit for pty in: $i;;
184 eval `echo $offset $name | awk ' { b=$1; n=$2 } END {
185 for (i = 0; i < 16; i++)
186 printf("rm -f tty%s%x; mknod tty%s%x c 5 %d; \
187 rm -f pty%s%x; mknod pty%s%x c 6 %d; ", \
188 n, i, n, i, b+i, n, i, n, i, b+i); }'`
190 if [ $class = 1 ]; then
191 mv ttyqf ttyv0; mv ptyqf ptyv0
198 umask 2 ; unit=`expr $i : '..\(.*\)'`
200 st*) name=st; chr=14;;
202 rm -f r$name$unit nr$name$unit er$name$unit enr$name$unit
203 rm -f hr$name$unit hnr$name$unit her$name$unit henr$name$unit
204 rm -f mr$name$unit mnr$name$unit mer$name$unit menr$name$unit
205 rm -f lr$name$unit lnr$name$unit ler$name$unit lenr$name$unit
208 mknod r${name}${unit} c $chr `expr $unit '*' 16 + 0`
209 mknod nr${name}${unit} c $chr `expr $unit '*' 16 + 1`
210 mknod er${name}${unit} c $chr `expr $unit '*' 16 + 2`
211 mknod hr${name}${unit} c $chr `expr $unit '*' 16 + 4`
212 mknod hnr${name}${unit} c $chr `expr $unit '*' 16 + 5`
213 mknod her${name}${unit} c $chr `expr $unit '*' 16 + 6`
214 mknod mr${name}${unit} c $chr `expr $unit '*' 16 + 8`
215 mknod mnr${name}${unit} c $chr `expr $unit '*' 16 + 9`
216 mknod mer${name}${unit} c $chr `expr $unit '*' 16 + 10`
217 mknod lr${name}${unit} c $chr `expr $unit '*' 16 + 12`
218 mknod lnr${name}${unit} c $chr `expr $unit '*' 16 + 13`
219 mknod ler${name}${unit} c $chr `expr $unit '*' 16 + 14`
220 chgrp operator r${name}${unit} nr${name}${unit} \
222 chgrp operator hr${name}${unit} hnr${name}${unit} \
224 chgrp operator mr${name}${unit} mnr${name}${unit} \
226 chgrp operator lr${name}${unit} lnr${name}${unit} \
228 chmod 640 r${name}${unit} nr${name}${unit} \
230 chmod 640 hr${name}${unit} hnr${name}${unit} \
232 chmod 640 mr${name}${unit} mnr${name}${unit} \
234 chmod 640 lr${name}${unit} lnr${name}${unit} \
238 echo bad unit for tape in: $i
245 umask 2 ; unit=`expr $i : '..\(.*\)'`
247 ch*) name=ch; chr=17;;
252 mknod ${name}${unit} c $chr `expr $unit '*' 16 + 0`
253 chgrp operator ${name}${unit}
254 chmod 640 ${name}${unit}
257 echo bad unit for media changer in: $i
264 umask 2 ; unit=`expr $i : '..\(.*\)'`
266 cd*) name=cd; blk=6; chr=15;;
268 rm -f $name$unit? r$name$unit?
271 mknod ${name}${unit}a b $blk `expr $unit '*' 8 + 0`
272 mknod ${name}${unit}d b $blk `expr $unit '*' 8 + 3`
273 mknod r${name}${unit}a c $chr `expr $unit '*' 8 + 0`
274 mknod r${name}${unit}d c $chr `expr $unit '*' 8 + 3`
275 chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
276 chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
279 echo bad unit for disk in: $i
286 unit=`expr $i : 'lpt\(.*\)'`
288 mknod lpt$unit c 16 $unit
289 chown root.wheel lpt$unit
293 unit=`expr $i : 'tw\(.*\)'`
295 mknod tw$unit c 19 $unit
296 chown root.wheel tw$unit
299 # hv 22-apr-93 use this to create the necessary video device for
305 rm -f ${name} kbd kbdco vgaco ttyv[0-9][0-9]
306 mknod ${name} c ${chr} ${minor}
307 chown root.wheel $name
310 # Use this to create virtual consoles for syscons, pcvt or codrv
312 # use as MAKEDEV vtyNN to create NN entries
315 units=`expr $i : 'vty\(.*\)'`
317 eval `echo ${chr} ${units} | awk ' { c=$1; n=$2 } END {
318 for (i = 0; i < n; i++)
319 printf("rm -f ttyv%01x; mknod ttyv%01x c %d %d;", \
325 unit=`expr $i : 'bpf\(.*\)'`
327 mknod bpf$unit c 23 $unit
328 chown root.wheel bpf$unit
332 unit=`expr $i : 'dcf\(.*\)'`
334 mknod dcf$unit c 24 $unit
335 chown root.wheel dcf$unit
339 unit=`expr $i : 'lpa\(.*\)'`
341 rm -f lpa$unit lpa${unit}p
342 mknod lpa${unit} c $chr `expr $unit + 0`
343 mknod lpa${unit}p c $chr `expr $unit + 32`
344 chown root.wheel lpa${unit} lpa${unit}p
350 chown root.wheel speaker
354 unit=`expr $i : '...\(.*\)'`
356 mknod tty0$unit c 28 $unit
357 chown uucp.wheel tty0$unit
361 unit=`expr $i : 'mse\(.*\)'`
364 mknod mse$unit c $chr `expr $unit '*' 2 + 1` # non-blocking for X11
365 chown root.wheel mse$unit
369 unit=`expr $i : 'psm\(.*\)'`
372 mknod psm$unit c $chr `expr $unit '*' 2 + 1` # non-blocking for X11
373 chown root.wheel psm$unit
377 name=`expr $i : 'mouse-\(.*\)'`
378 if [ ! -c $name ]; then
379 $0 $name # make the appropriate device