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