New device support patch, if_ed, sio, tw, codrv
[unix-history] / dev / MAKEDEV
CommitLineData
b98528ef
WJLGJ
1#!/bin/sh -
2#
3# Copyright (c) 1990 The Regents of the University of California.
4# All rights reserved.
5#
6# Written and contributed by W. Jolitz 12/90
7#
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.
21#
22# @(#)MAKEDEV 5.2 (Berkeley) 6/22/90
23#
24# Device "make" file. Valid arguments:
b526fba4 25# all makes all known devices, standard number of units (or close)
b98528ef
WJLGJ
26# std standard devices
27# local configuration specific devices
28#
29# Tapes:
30# wt* QIC-interfaced (e.g. not SCSI) 3M cartridge tape
42049003
JH
31# st* "NEW type scsi tapes" (old driver uses the
32# block devices of the disks to get access)
b98528ef
WJLGJ
33#
34# Disks:
35# wd* "winchester" disk drives (ST506,IDE,ESDI,RLL,...)
36# fd* "floppy" disk drives (3 1/2", 5 1/4")
37# as* "SCSI" disk/tape/CDROM drives
42049003 38# sd* "NEW type scsi disks"
76ee8424 39# cd* "NEW type cdrom disks"
b98528ef 40#
42049003 41# Console ports:
76ee8424
HV
42# pc* devices for stock pccons (cleans up co devices)
43# co* devices for codrv (cleans up pc devices)
44# vty* virtual console devices for codrv (cleans up pc devices)
42049003 45#
b98528ef
WJLGJ
46# Terminal ports:
47# com* standard PC COM ports
b526fba4 48# tty* alias for PC COM ports, this is what the system really wants
76ee8424 49# sio* fast interrupt PC COM ports
b98528ef
WJLGJ
50#
51# Pseudo terminals:
52# pty* set of 16 master and slave pseudo terminals
76ee8424 53# vty* virtual terminals using codrv console
b98528ef
WJLGJ
54#
55# Printers:
42049003
JH
56# lpt* stock lp
57# lpa* interruptless lp
b98528ef
WJLGJ
58#
59# Call units:
60#
61# Special purpose devices:
42049003 62# bpf* packet filter
b526fba4 63# dcf* dcf clock
76ee8424
HV
64# speaker pc speaker
65# tw* xten power controller
42049003
JH
66#
67# PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
68# -------------------- ----- ----------------------
76ee8424 69# CURRENT PATCH LEVEL: 3 00160
42049003
JH
70# -------------------- ----- ----------------------
71#
72# 16 Feb 93 Julian Elischer ADDED for SCSI system
73# 16 Feb 93 Julian Elischer media changer device
74# 10 Mar 93 Rodney W. Grimes general clean up of above patches
75# typo in rm of kmem (was kmdem)
76# major number for /dev/fd/* and /dev/std*
77# added lpt, lpa, bpf, vga, vgaco, kbdco
b526fba4
RG
78# 08 Apr 93 Rodney W. Grimes Cleanup chgrp, chown and chmod stuff
79# Added duplicate name tty=com,
80# added speaker, dcf
76ee8424
HV
81# 22 Apr 93 Holger Veit device create for co,pc,vty
82# 26 May 93 Rodney W. Grimes Redid all to be in bdev/cdev order.
83# 26 May 93 Gene Stark Added tw xten power controller
84# Rodney W. Grimes Added sio serial port (fast interrupt)
b98528ef
WJLGJ
85#
86
87PATH=/sbin:/bin/:/usr/bin:/usr/sbin:
88umask 77
89for i
90do
91case $i in
92
b526fba4 93all)
76ee8424
HV
94 sh MAKEDEV std # standard
95 sh MAKEDEV wd0 wd1 fd0 fd1 wt0 sd0 sd1 as0 as1 st0 cd0 # bdev
96 sh MAKEDEV pty0 tty0 tty1 tty2 tty3 pc0 lpt0 lpt1 lpt2 # cdev
97 sh MAKEDEV ch0 tw0 bpf0 co0 vty04 dcf0 lpa0 lpa1 lpa2 # cdev
98 sh MAKEDEV speaker mse0 sio0 sio1 sio2 sio3 # cdev
b526fba4 99 ;;
b98528ef 100std)
42049003 101 rm -f console drum mem kmem null tty klog stdin stdout stderr
b526fba4
RG
102 mknod console c 0 0; chmod 600 console; chown root.wheel console
103 mknod drum c 4 0; chmod 640 drum; chown root.kmem drum
104 mknod kmem c 2 1; chmod 640 kmem; chown root.kmem kmem
105 mknod mem c 2 0; chmod 640 mem; chown root.kmem mem
106 mknod null c 2 2; chmod 666 null; chown root.wheel null
107 mknod tty c 1 0; chmod 666 tty; chown root.wheel tty
108 mknod klog c 7 0; chmod 600 klog; chown root.wheel klog
109 mknod stdin c 22 0; chmod 666 stdin; chown root.wheel stdin
110 mknod stdout c 22 1; chmod 666 stdout; chown root.wheel stdout
111 mknod stderr c 22 2; chmod 666 stderr; chown root.wheel stderr
b98528ef
WJLGJ
112 rm -f fd/*
113 mkdir fd > /dev/null 2>&1
114 (cd fd && eval `echo "" | awk ' BEGIN { \
115 for (i = 0; i < 64; i++) \
42049003 116 printf("mknod %d c 22 %d;", i, i)}'`)
b98528ef
WJLGJ
117 chown -R bin.bin fd
118 chmod 555 fd
119 chmod 666 fd/*
120 ;;
121
122wt*)
b526fba4
RG
123 umask 2;
124 rm -f wt0 rwt0
125 mknod wt0 b 3 0; chown root.operator wt0
126 mknod rwt0 c 10 0; chown root.operator rwt0
127 umask 77;
b98528ef
WJLGJ
128 ;;
129
b526fba4 130as*|fd*|sd*|wd*)
b98528ef
WJLGJ
131 umask 2 ; unit=`expr $i : '..\(.*\)'`
132 case $i in
b98528ef 133 as*) name=as; blk=4; chr=13;;
b526fba4 134 fd*) name=fd; blk=2; chr=9;;
42049003 135 sd*) name=sd; blk=4; chr=13;;
b526fba4 136 wd*) name=wd; blk=0; chr=3;;
b98528ef
WJLGJ
137 esac
138 rm -f $name$unit? r$name$unit?
139 case $unit in
42049003 140 0|1|2|3|4|5|6)
b98528ef
WJLGJ
141 mknod ${name}${unit}a b $blk `expr $unit '*' 8 + 0`
142 mknod ${name}${unit}b b $blk `expr $unit '*' 8 + 1`
143 mknod ${name}${unit}c b $blk `expr $unit '*' 8 + 2`
144 mknod ${name}${unit}d b $blk `expr $unit '*' 8 + 3`
145 mknod ${name}${unit}e b $blk `expr $unit '*' 8 + 4`
146 mknod ${name}${unit}f b $blk `expr $unit '*' 8 + 5`
147 mknod ${name}${unit}g b $blk `expr $unit '*' 8 + 6`
148 mknod ${name}${unit}h b $blk `expr $unit '*' 8 + 7`
149 mknod r${name}${unit}a c $chr `expr $unit '*' 8 + 0`
150 mknod r${name}${unit}b c $chr `expr $unit '*' 8 + 1`
151 mknod r${name}${unit}c c $chr `expr $unit '*' 8 + 2`
152 mknod r${name}${unit}d c $chr `expr $unit '*' 8 + 3`
153 mknod r${name}${unit}e c $chr `expr $unit '*' 8 + 4`
154 mknod r${name}${unit}f c $chr `expr $unit '*' 8 + 5`
155 mknod r${name}${unit}g c $chr `expr $unit '*' 8 + 6`
156 mknod r${name}${unit}h c $chr `expr $unit '*' 8 + 7`
157 chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
158 chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
159 ;;
160 *)
161 echo bad unit for disk in: $i
162 ;;
163 esac
164 umask 77
165 ;;
166
b526fba4
RG
167com*|tty*)
168 unit=`expr $i : '...\(.*\)'`
169 rm -f com0$unit tty0$unit
b98528ef 170 mknod com0$unit c 8 $unit
b526fba4
RG
171 mknod tty0$unit c 8 $unit
172 chown uucp.wheel com0$unit tty0$unit
b98528ef
WJLGJ
173 ;;
174
175pty*)
176 class=`expr $i : 'pty\(.*\)'`
177 case $class in
178 0) offset=0 name=p;;
179 1) offset=16 name=q;;
180 2) offset=32 name=r;;
181 3) offset=48 name=s;;
182# Note that telnetd, rlogind, and xterm (at least) only look at p-s.
183 4) offset=64 name=t;;
184 *) echo bad unit for pty in: $i;;
185 esac
186 case $class in
187 0|1|2|3|4)
188 umask 0
189 eval `echo $offset $name | awk ' { b=$1; n=$2 } END {
190 for (i = 0; i < 16; i++)
b526fba4
RG
191 printf("rm -f tty%s%x; mknod tty%s%x c 5 %d; \
192 rm -f pty%s%x; mknod pty%s%x c 6 %d; ", \
193 n, i, n, i, b+i, n, i, n, i, b+i); }'`
b98528ef
WJLGJ
194 umask 77
195 if [ $class = 1 ]; then
196 mv ttyqf ttyv0; mv ptyqf ptyv0
197 fi
198 ;;
199 esac
200 ;;
201
42049003
JH
202st*)
203 umask 2 ; unit=`expr $i : '..\(.*\)'`
204 case $i in
205 st*) name=st; chr=14; blk=5;;
206 esac
207 rm -f $name$unit n$name$unit e$name$unit en$name$unit \
208 r$name$unit nr$name$unit er$name$unit enr$name$unit
209 case $unit in
210 0|1|2|3|4|5|6)
211 mknod ${name}${unit} b $blk `expr $unit '*' 16 + 0`
212 mknod n${name}${unit} b $blk `expr $unit '*' 16 + 1`
213 mknod e${name}${unit} b $blk `expr $unit '*' 16 + 2`
214 mknod en${name}${unit} b $blk `expr $unit '*' 16 + 3`
215 mknod r${name}${unit} c $chr `expr $unit '*' 16 + 0`
216 mknod nr${name}${unit} c $chr `expr $unit '*' 16 + 1`
217 mknod er${name}${unit} c $chr `expr $unit '*' 16 + 2`
218 mknod enr${name}${unit} c $chr `expr $unit '*' 16 + 3`
219 chgrp operator ${name}${unit} n${name}${unit} \
220 e$name$unit en$name$unit \
221 r${name}${unit} nr${name}${unit} \
222 er${name}${unit} enr${name}${unit}
223 chmod 640 ${name}${unit} n${name}${unit} \
224 e$name$unit en$name$unit \
225 r${name}${unit} nr${name}${unit} \
226 er${name}${unit} enr${name}${unit}
227 ;;
228 *)
229 echo bad unit for tape in: $i
230 ;;
231 esac
232 umask 77
233 ;;
234
235ch*)
236 umask 2 ; unit=`expr $i : '..\(.*\)'`
237 case $i in
238 ch*) name=ch; chr=17;;
239 esac
240 rm -f $name$unit
241 case $unit in
242 0|1|2|3|4|5|6)
243 mknod ${name}${unit} c $chr `expr $unit '*' 16 + 0`
244 chgrp operator ${name}${unit}
245 chmod 640 ${name}${unit}
246 ;;
247 *)
248 echo bad unit for media changer in: $i
249 ;;
250 esac
251 umask 77
252 ;;
253
254cd*)
255 umask 2 ; unit=`expr $i : '..\(.*\)'`
256 case $i in
257 cd*) name=cd; blk=6; chr=15;;
258 esac
259 rm -f $name$unit? r$name$unit?
260 case $unit in
261 0|1|2|3|4|5|6)
262 mknod ${name}${unit}a b $blk `expr $unit '*' 8 + 0`
263 mknod ${name}${unit}d b $blk `expr $unit '*' 8 + 3`
264 mknod r${name}${unit}a c $chr `expr $unit '*' 8 + 0`
265 mknod r${name}${unit}d c $chr `expr $unit '*' 8 + 3`
266 chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
267 chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
268 ;;
269 *)
270 echo bad unit for disk in: $i
271 ;;
272 esac
273 umask 77
274 ;;
275
276lpt*)
277 unit=`expr $i : 'lpt\(.*\)'`
278 rm -f lpt$unit
279 mknod lpt$unit c 16 $unit
b526fba4 280 chown root.wheel lpt$unit
42049003
JH
281 ;;
282
76ee8424
HV
283tw*)
284 unit=`expr $i : 'tw\(.*\)'`
285 rm -f tw$unit
286 mknod tw$unit c 19 $unit
287 chown root.wheel tw$unit
288 ;;
289
290# hv 22-apr-93 use this to create the necessary devices for codrv
291# this will cleanup /dev/vga left from pccons
292co*)
42049003 293 chr=21
76ee8424
HV
294 name=vga
295 rm -rf ${name}
296 mknod ${name} c ${chr} 128
297 ln ${name} ${name}co
298 chmod 644 ${name}
299 chown root.wheel ${name}
300
301 chr=21
302 name=kbd
303 rm -rf ${name}
304 mknod ${name} c ${chr} 128
305 ln ${name} ${name}co
306 chmod 644 ${name}
307 chown root.wheel ${name}
308 ;;
309
310# hv 22-apr-93 use this to create the necessary video device for
311# pccons driver
312pc*)
313 chr=12
314 minor=0
315 name=vga
316 rm -f ${name} kbd kbdco vgaco ttyv[0-9][0-9]
42049003 317 mknod ${name} c ${chr} ${minor}
b526fba4 318 chown root.wheel $name
42049003
JH
319 ;;
320
76ee8424
HV
321# hv 22-apr-93 use this to create virtual consoles for codrv
322# /dev/ttyv00-12
323# use as MAKEDEV vtyNN to create NN entries
324vty*)
325 chr=12
326 units=`expr $i : 'vty\(.*\)'`
327 umask 0
328 eval `echo ${chr} ${units} | awk ' { c=$1; n=$2 } END {
329 for (i = 0; i < n; i++)
330 printf("rm -f ttyv%01x; mknod ttyv%01x c %d %d;", \
331 i, i, c, i); }'`
332 umask 77
333 ;;
334
42049003
JH
335bpf*)
336 unit=`expr $i : 'bpf\(.*\)'`
337 rm -f bpf$unit
338 mknod bpf$unit c 23 $unit
b526fba4
RG
339 chown root.wheel bpf$unit
340 ;;
341
342dcf*)
343 unit=`expr $i : 'dcf\(.*\)'`
344 rm -f dcf$unit
345 mknod dcf$unit c 24 $unit
346 chown root.wheel dcf$unit
42049003
JH
347 ;;
348
349lpa*)
350 unit=`expr $i : 'lpa\(.*\)'`
b526fba4
RG
351 chr=25
352 rm -f lpa$unit lpa${unit}p
353 mknod lpa${unit} c $chr `expr $unit + 0`
354 mknod lpa${unit}p c $chr `expr $unit + 32`
355 chown root.wheel lpa${unit} lpa${unit}p
356 ;;
357
358speaker)
359 rm -f speaker
360 mknod speaker c 26 0
361 chown root.wheel speaker
42049003
JH
362 ;;
363
76ee8424
HV
364sio*)
365 unit=`expr $i : '...\(.*\)'`
366 rm -f sio0$unit
367 mknod sio0$unit c 28 $unit
368 chown uucp.wheel sio0$unit
369 ;;
370
b98528ef
WJLGJ
371local)
372 umask 0
373 sh MAKEDEV.local
374 ;;
375
376esac
377done