xref: /original-bsd/etc/etc.vax/MAKEDEV (revision fb90007d)
12880608fSmckusick#!/bin/sh -
22880608fSmckusick#
3*fb90007dSbostic#	@(#)MAKEDEV	8.1 (Berkeley) 06/09/93
47c3db03cSbostic#
57c3db03cSbostic
66b7db209Ssam# Device "make" file.  Valid arguments:
79a3a1cccSsam#	std	standard devices
86b7db209Ssam#	local	configuration specific devices
96b7db209Ssam# Tapes:
106b7db209Ssam#	ht*	massbus tm03 & tu??
116b7db209Ssam#	tm*	unibus tm11 & te10 emulations (e.g. Emulex tc-11)
129f7203aeSkarels#	tms*	unibus/qbus TMSCP (e.g. TU81, TK50)
136b7db209Ssam#	ts*	unibus ts11
146b7db209Ssam#	mt*	massbus tu78
156b7db209Ssam#	ut*	unibus tu45 emulations (e.g.si 9700)
169cf5e8d3Shelge#	uu*	tu58 cassettes on dl11 controller
176b7db209Ssam# Disks:
186b7db209Ssam#	hp*	massbus rm??
196b7db209Ssam#	hk*	unibus rk06 and rk07
206b7db209Ssam#	up*	other unibus devices (e.g. on Emulex sc-21v controller)
216b7db209Ssam#	ra*	unibus uda50 w/ ra??
229f7203aeSkarels#	kra*	bi kdb50 w/ ra??
231f5a00adSsam#	rl*	unibus rl02
246b7db209Ssam#	rb*	730 idc w/ rb80 and/or rb02
25c198872dShelge#	rx*	unibus rx211 floppy disk
266b7db209Ssam# Terminal multiplexors:
276b7db209Ssam#	dz*	unibus dz11 and dz32
286b7db209Ssam#	dh*	unibus dh11 and emulations (e.g. Able dmax, Emulex cs-11)
296b7db209Ssam#	dmf*	unibus dmf32
304700f717Smckusick#	dhu*    unibus dhu11
313fbba9eeSkarels#	dmz*    unibus dmz32
326b7db209Ssam# Pseudo terminals:
336b7db209Ssam#	pty*	set of 16 master and slave pseudo terminals
34d201b27aSsam# Printers:
351f5a00adSsam#	ct*	unibus parallel interface to CAT typesetter
366b7db209Ssam#	lp*	unibus lp11 parallel interface
37d201b27aSsam#	va*	unibus varian parallel interface
38d201b27aSsam#	vp*	unibus versatec parallel interface
396b7db209Ssam# Call units:
406b7db209Ssam#	dn*	unibus dn11 and emulations (e.g. Able Quadracall)
411f5a00adSsam# Special purpose devices:
421f5a00adSsam#	ik*	unibus interface to ikonas frame buffer
431f5a00adSsam#	ps*	unibus interface to e&s picture system 2
441f5a00adSsam#	ad*	unibus interface to data translation a/d converter
45279c633cSsklower#	np*	unibus ethernet co-processor interface, for downloading.
46024d0cd0Skarels#	qv*	qvss (microvax) display
47024d0cd0Skarels#	ttyv0	qvss (microvax) display reserved pty
48492c862fSbosticPATH=/sbin:/bin:/usr/bin
496b7db209Ssamumask 77
506b7db209Ssamfor i
516b7db209Ssamdo
526b7db209Ssamcase $i in
536b7db209Ssam
546b7db209Ssamstd)
55492c862fSbostic	mknod console		c 0 0
56492c862fSbostic	mknod drum		c 7 0	; chmod 640 drum ; chgrp kmem drum
57492c862fSbostic	mknod floppy		c 8 0
58492c862fSbostic	mknod crl		c 35 0
59492c862fSbostic	mknod csa1		c 51 0
60492c862fSbostic	mknod csa2		c 51 1
61492c862fSbostic	mknod tu0		b 8 0
62492c862fSbostic	mknod tu1		b 8 1
63492c862fSbostic	mknod kUmem		c 3 3	; chmod 600 kUmem
64492c862fSbostic	mknod kmem		c 3 1	; chmod 640 kmem ; chgrp kmem kmem
65492c862fSbostic	mknod mem		c 3 0	; chmod 640 mem ; chgrp kmem mem
66492c862fSbostic	mknod null		c 3 2	; chmod 666 null
679842e909Smarc	mknod zero              c 3 12  ; chmod 666 zero
68492c862fSbostic	mknod tty		c 2 0	; chmod 666 tty
69492c862fSbostic	mknod klog		c 33 0	; chmod 600 klog
70492c862fSbostic	mknod stdin		c 53 0	; chmod 666 stdin
71492c862fSbostic	mknod stdout		c 53 1	; chmod 666 stdout
72492c862fSbostic	mknod stderr		c 53 2	; chmod 666 stderr
73492c862fSbostic	mkdir fd > /dev/null 2>&1
74492c862fSbostic	(cd fd && eval `echo "" | awk ' BEGIN { \
75492c862fSbostic		for (i = 0; i < 64; i++) \
76492c862fSbostic			printf("mknod %d c 53 %d;", i, i)}'`)
77492c862fSbostic	chown -R bin.bin fd
78492c862fSbostic	chmod 555 fd
79492c862fSbostic	chmod 666 fd/*
806b7db209Ssam	;;
816b7db209Ssam
829f7203aeSkarelsht*|tm*|tms*|ts*|ut*)
839f7203aeSkarels	umask 0 ; unit=`expr $i : '[^0-9]*\(.*\)'`
846b7db209Ssam	case $i in
856b7db209Ssam	ht*) blk=1; chr=5 ;;
869f7203aeSkarels	tms*) blk=15; chr=38;;
876b7db209Ssam	tm*) blk=5; chr=14;;
886b7db209Ssam	ts*) blk=6; chr=16;;
896b7db209Ssam	ut*) blk=10; chr=17;;
906b7db209Ssam	esac
916b7db209Ssam	case $unit in
926b7db209Ssam	0|1|2|3|4|5|6|7)
936b7db209Ssam		four=`expr $unit + 4` ; eight=`expr $unit + 8`
946b7db209Ssam		twelve=`expr $unit + 12`; twenty=`expr $unit + 20`
95492c862fSbostic		mknod mt$unit		b $blk $unit
96492c862fSbostic		mknod mt$four		b $blk $four
97492c862fSbostic		mknod mt$eight		b $blk $eight
98492c862fSbostic		mknod mt$twelve		b $blk $twelve
99492c862fSbostic		mknod nmt$unit		b $blk $four ;: sanity w/pdp11 v7
100492c862fSbostic		mknod nmt$eight		b $blk $twelve ;: ditto
101492c862fSbostic		mknod nrmt$unit		c $chr $four ;: sanity w/pdp11 v7
102492c862fSbostic		mknod nrmt$eight	c $chr $twelve ;: ditto
103492c862fSbostic		mknod rmt$unit		c $chr $unit
104492c862fSbostic		mknod rmt$four		c $chr $four
105492c862fSbostic		mknod rmt$eight		c $chr $eight
106492c862fSbostic		mknod rmt$twelve	c $chr $twelve
107c1408d80Ssam		if [ $i = ut ]
1086b7db209Ssam		then
109492c862fSbostic			mknod mt$twenty		b $blk $twenty
110492c862fSbostic			mknod rmt$twenty	c $chr $twenty
1116b7db209Ssam		fi
1126b7db209Ssam		;;
1136b7db209Ssam	*)
114c1c91c61Scomay		echo bad unit for tape in: $1
1156b7db209Ssam		;;
1166b7db209Ssam	esac
117d83b45ecSralph	umask 77
1186b7db209Ssam	;;
1196b7db209Ssam
1207b8843d4Smckusickmt*)
1217b8843d4Smckusick	umask 0 ; unit=`expr $i : '..\(.*\)'`
1227b8843d4Smckusick	case $i in
1237b8843d4Smckusick	mt*) blk=7; chr=19;;
1247b8843d4Smckusick	esac
1257b8843d4Smckusick	case $unit in
1267b8843d4Smckusick	0|1|2|3|4|5|6|7)
1277b8843d4Smckusick		eight=`expr $unit + 0`;
1287b8843d4Smckusick		twelve=`expr $unit + 4`;
1297b8843d4Smckusick		sixteen=`expr $unit + 8`;
1307b8843d4Smckusick		twenty=`expr $unit + 12`;
131492c862fSbostic		mknod mt8		b $blk $eight
132492c862fSbostic		mknod mt12		b $blk $twelve
133492c862fSbostic		mknod mt16		b $blk $sixteen
134492c862fSbostic		mknod mt20		b $blk $twenty
135492c862fSbostic		mknod nmt8		b $blk $twelve ;: ditto
136492c862fSbostic		mknod nrmt8		c $chr $twelve ;: ditto
137492c862fSbostic		mknod rmt8		c $chr $eight
138492c862fSbostic		mknod rmt12		c $chr $twelve
139492c862fSbostic		mknod rmt16		c $chr $sixteen
140492c862fSbostic		mknod rmt20		c $chr $twenty
141492c862fSbostic		mknod nmt16		b $blk $twenty ;: ditto
142492c862fSbostic		mknod nrmt16		c $chr $twenty ;: ditto
1437b8843d4Smckusick		;;
1447b8843d4Smckusick	*)
1457b8843d4Smckusick		echo bad unit for tape in: $1
1467b8843d4Smckusick		;;
1477b8843d4Smckusick	esac
1487b8843d4Smckusick	umask 77
1497b8843d4Smckusick	;;
1507b8843d4Smckusick
1519f7203aeSkarelshp*|hk*|up*|ra*|kra*|rl*|rb*)
152d83b45ecSralph	umask 2 ; unit=`expr $i : '..\(.*\)'`
1536b7db209Ssam	case $i in
1546b7db209Ssam	hp*) name=hp; blk=0; chr=4;;
1556b7db209Ssam	hk*) name=hk; blk=3; chr=11;;
1566b7db209Ssam	up*) name=up; blk=2; chr=13;;
1576b7db209Ssam	ra*) name=ra; blk=9; chr=9;;
1589f7203aeSkarels	kra*) name=kra; blk=16; chr=52;;
159c1c91c61Scomay	rb*) name=rb; blk=11; chr=23;;
1601f5a00adSsam	rl*) name=rl; blk=14; chr=32;;
1616b7db209Ssam	esac
1626b7db209Ssam	case $unit in
1630e257724Smckusick	0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|\
1640e257724Smckusick	17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)
165492c862fSbostic		mknod ${name}${unit}a	b $blk `expr $unit '*' 8 + 0`
166492c862fSbostic		mknod ${name}${unit}b	b $blk `expr $unit '*' 8 + 1`
167492c862fSbostic		mknod ${name}${unit}c	b $blk `expr $unit '*' 8 + 2`
168492c862fSbostic		mknod ${name}${unit}g	b $blk `expr $unit '*' 8 + 6`
169492c862fSbostic		mknod r${name}${unit}a	c $chr `expr $unit '*' 8 + 0`
170492c862fSbostic		mknod r${name}${unit}b	c $chr `expr $unit '*' 8 + 1`
171492c862fSbostic		mknod r${name}${unit}c	c $chr `expr $unit '*' 8 + 2`
172492c862fSbostic		mknod r${name}${unit}g	c $chr `expr $unit '*' 8 + 6`
1736b7db209Ssam		if [ $name != hk ]
1746b7db209Ssam		then
175492c862fSbostic		mknod ${name}${unit}d	b $blk `expr $unit '*' 8 + 3`
176492c862fSbostic		mknod ${name}${unit}e	b $blk `expr $unit '*' 8 + 4`
177492c862fSbostic		mknod ${name}${unit}f	b $blk `expr $unit '*' 8 + 5`
178492c862fSbostic		mknod ${name}${unit}h	b $blk `expr $unit '*' 8 + 7`
179492c862fSbostic		mknod r${name}${unit}d	c $chr `expr $unit '*' 8 + 3`
180492c862fSbostic		mknod r${name}${unit}e	c $chr `expr $unit '*' 8 + 4`
181492c862fSbostic		mknod r${name}${unit}f	c $chr `expr $unit '*' 8 + 5`
182492c862fSbostic		mknod r${name}${unit}h	c $chr `expr $unit '*' 8 + 7`
1836b7db209Ssam		fi
184d83b45ecSralph		chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
1854700f717Smckusick		chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
1866b7db209Ssam		;;
1876b7db209Ssam	*)
1886b7db209Ssam		echo bad unit for disk in: $i
1896b7db209Ssam		;;
1906b7db209Ssam	esac
191d83b45ecSralph	umask 77
1926b7db209Ssam	;;
1936b7db209Ssam
19480a2c5b1Ssamrx*)
19580a2c5b1Ssam	unit=`expr $i : '..\(.*\)'`
196c198872dShelge	name=rx; chr=30; blk=12;
19780a2c5b1Ssam	case $unit in
19880a2c5b1Ssam	0|1|2|3|4|5|6|7)
199492c862fSbostic		mknod ${name}${unit}	b $blk `expr $unit '*' 8 + 0`
200492c862fSbostic		mknod r${name}${unit}a	c $chr `expr $unit '*' 8 + 0`
201492c862fSbostic		mknod r${name}${unit}b	c $chr `expr $unit '*' 8 + 1`
202492c862fSbostic		mknod r${name}${unit}c	c $chr `expr $unit '*' 8 + 2`
203492c862fSbostic		mknod r${name}${unit}d	c $chr `expr $unit '*' 8 + 3`
20480a2c5b1Ssam		;;
20580a2c5b1Ssam	*)
20680a2c5b1Ssam		echo bad unit for floppy disk in: $i
20780a2c5b1Ssam		;;
20880a2c5b1Ssam	esac
20980a2c5b1Ssam	;;
2109cf5e8d3Shelge
2119cf5e8d3Shelgeuu*)
2129cf5e8d3Shelge	unit=`expr $i : '..\(.*\)'`
2139cf5e8d3Shelge	name=uu; blk=13;
2149cf5e8d3Shelge	case $unit in
2159cf5e8d3Shelge	0|1|2|3)
216492c862fSbostic		mknod ${name}${unit}	b $blk `expr $unit '*' 2 + 0`
217492c862fSbostic		mknod ${name}${unit}a	b $blk `expr $unit '*' 2 + 1`
2189cf5e8d3Shelge		;;
2199cf5e8d3Shelge	*)
2209cf5e8d3Shelge		echo bad unit for uu cassette in: $i
2219cf5e8d3Shelge		;;
2229cf5e8d3Shelge	esac
2239cf5e8d3Shelge	;;
2249cf5e8d3Shelge
2256b7db209Ssamdz*)
2266b7db209Ssam	unit=`expr $i : 'dz\(.*\)'`
2276b7db209Ssam	case $unit in
2286b7db209Ssam	0|1|2|3|4|5|6|7)
2296b7db209Ssam		eval `echo $unit | awk ' { u = $1 } END {
2306b7db209Ssam		    for (i = 0; i < 8; i++)
231492c862fSbostic			printf("mknod tty%02d c 1 %d; ",u*8+i,u*8+i); }'`
2326b7db209Ssam		;;
2336b7db209Ssam	*)
2346b7db209Ssam		echo bad unit for dz in: $i
2356b7db209Ssam		;;
2366b7db209Ssam	esac
2376b7db209Ssam	;;
2386b7db209Ssam
2393fbba9eeSkarelsdhu*|dh*|dmf*|dmz*)
2406b7db209Ssam	case $i in
2413fbba9eeSkarels	dmz*)	name=dmz; major=37; count=24;
2423fbba9eeSkarels		unit=`expr $i : "$name\(.*\)"`
2433fbba9eeSkarels		case $unit in
2443fbba9eeSkarels		0) ch=a ;; 1) ch=b ;; 2) ch=c ;; 3) ch=e ;;
2453fbba9eeSkarels		4) ch=f ;; 5) ch=g ;;
2463fbba9eeSkarels		*) echo bad unit for $name in: $i ;;
2473fbba9eeSkarels		esac;;
2483fbba9eeSkarels	dmf*)	name=dmf; major=22; count=8;
2493fbba9eeSkarels		unit=`expr $i : "$name\(.*\)"`
2503fbba9eeSkarels		case $unit in
2513fbba9eeSkarels		0) ch=A ;; 1) ch=B ;; 2) ch=C ;; 3) ch=E ;;
2523fbba9eeSkarels		4) ch=F ;; 5) ch=G ;; 6) ch=H ;; 7) ch=I ;;
2533fbba9eeSkarels		*) echo bad unit for $name in: $i ;;
2543fbba9eeSkarels		esac;;
2553fbba9eeSkarels	dhu*)	name=dhu; major=34; count=16;
2563fbba9eeSkarels		unit=`expr $i : "$name\(.*\)"`;
2573fbba9eeSkarels		case $unit in
2583fbba9eeSkarels		0) ch=S ;; 1) ch=T ;; 2) ch=U ;; 3) ch=V ;;
2593fbba9eeSkarels		4) ch=W ;; 5) ch=X ;; 6) ch=Y ;; 7) ch=Z ;;
2603fbba9eeSkarels		*) echo bad unit for $name in: $i ;;
2613fbba9eeSkarels		esac;;
2623fbba9eeSkarels	dh*)	name=dh; major=12; count=16;
2636b7db209Ssam		unit=`expr $i : "$name\(.*\)"`
2646b7db209Ssam		case $unit in
2656b7db209Ssam		0) ch=h ;; 1) ch=i ;; 2) ch=j ;; 3) ch=k ;;
2666b7db209Ssam		4) ch=l ;; 5) ch=m ;; 6) ch=n ;; 7) ch=o ;;
2676b7db209Ssam		*) echo bad unit for $name in: $i ;;
2683fbba9eeSkarels		esac;;
2696b7db209Ssam	esac
2703fbba9eeSkarels	eval `echo $ch $unit $major $count |
2713fbba9eeSkarels	  awk ' { ch = $1; u = $4 * $2; m = $3; cnt = $4 } END {
2723fbba9eeSkarels	    for (i = 0; i < cnt; i++)
2733fbba9eeSkarels	      if (i < 10)
274492c862fSbostic		printf("mknod tty%s%x c %d %d; ",ch,i,m,u+i);
2753fbba9eeSkarels	      else
276492c862fSbostic		printf("mknod tty%s%c c %d %d; ",ch,87+i,m,u+i); }'`
2776b7db209Ssam	;;
2786b7db209Ssam
279d201b27aSsamlp*|va*|vp*)
280d201b27aSsam	case $i in
281d201b27aSsam	lp*) name=lp; major=15;;
282d201b27aSsam	va*) name=va; major=10;;
283d201b27aSsam	vp*) name=vp; major=6;;
284d201b27aSsam	esac
285d201b27aSsam	unit=`expr $i : "$name\(.*\)"`
2866b7db209Ssam	case $unit in
2876b7db209Ssam	0|1|2|3|4|5|6|7)
288492c862fSbostic		mknod $i c $major $unit;
2896b7db209Ssam		chmod 666 $i
2906b7db209Ssam		;;
2916b7db209Ssam	*)
292d201b27aSsam		echo bad unit for $name in: $i
2936b7db209Ssam		;;
2946b7db209Ssam	esac
2956b7db209Ssam	;;
2966b7db209Ssam
2976b7db209Ssampty*)
2986b7db209Ssam	class=`expr $i : 'pty\(.*\)'`
2996b7db209Ssam	case $class in
3006b7db209Ssam	0) offset=0 name=p;;
3016b7db209Ssam	1) offset=16 name=q;;
3026b7db209Ssam	2) offset=32 name=r;;
303e58711b4Sbloom	3) offset=48 name=s;;
304f12cb0e1Sbloom	4) offset=64 name=t;;
305f12cb0e1Sbloom	5) offset=80 name=u;;
3066b7db209Ssam	*) echo bad unit for pty in: $i;;
3076b7db209Ssam	esac
3086b7db209Ssam	case $class in
309f12cb0e1Sbloom	0|1|2|3|4|5)
3106b7db209Ssam		umask 0
311950ddd82Ssam		eval `echo $offset $name | awk ' { b=$1; n=$2 } END {
3126b7db209Ssam			for (i = 0; i < 16; i++)
313492c862fSbostic				printf("mknod tty%s%x c 20 %d; \
314492c862fSbostic					mknod pty%s%x c 21 %d; ", \
3156b7db209Ssam					n, i, b+i, n, i, b+i); }'`
3166b7db209Ssam		umask 77
3176b7db209Ssam		;;
3186b7db209Ssam	esac
3196b7db209Ssam	;;
3206b7db209Ssam
321279c633cSsklowernp*)
322279c633cSsklower	class=`expr $i : 'np\(.*\)'`
323279c633cSsklower	case $class in
324279c633cSsklower	0) offset=0 name=0;;
325279c633cSsklower	1) offset=16 name=1;;
326279c633cSsklower	2) offset=32 name=2;;
327024d0cd0Skarels	*) echo bad unit for np in: $i;;
328279c633cSsklower	esac
329279c633cSsklower	case $class in
330279c633cSsklower	0|1|2)
331279c633cSsklower		eval `echo $offset | awk ' { b=$1 } END {
332279c633cSsklower			for (i = 0; i < 4; i++)
333492c862fSbostic				printf("mknod np%02d c 39 %d;", \
334279c633cSsklower					b+i, b+i); }'`
335279c633cSsklower		;;
336279c633cSsklower	esac
337279c633cSsklower	;;
338279c633cSsklower
3391f5a00adSsamdn*|ik*|ps*|ad*|ct*)
3401f5a00adSsam	unit=`expr $i : '..\(.*\)'`
3411f5a00adSsam	case $i in
3421f5a00adSsam	ct*) name=ct; chr=18;;
3431f5a00adSsam	dn*) name=cu; chr=24;;
3441f5a00adSsam	ps*) name=ps; chr=27;;
3451f5a00adSsam	ad*) name=ad; chr=29;;
3461f5a00adSsam	ik*) name=ik; chr=31;;
3471f5a00adSsam	esac
348d166afbbSsam	case $unit in
3496b7db209Ssam	0|1|2|3|4|5|6|7)
3506b7db209Ssam		umask 0
351492c862fSbostic		mknod ${name}${unit} c ${chr} ${unit}
3526b7db209Ssam		umask 77
3536b7db209Ssam		;;
3546b7db209Ssam	*)
3551f5a00adSsam		echo bad unit for ${name} in: $i
3566b7db209Ssam		;;
3576b7db209Ssam	esac
3586b7db209Ssam	;;
3596b7db209Ssam
360024d0cd0Skarelsqv0)
361492c862fSbostic	mknod qv0 c 40 0
362492c862fSbostic	mknod qvcons c 40 1
363492c862fSbostic	mknod mouse c 40 2
364024d0cd0Skarels	;;
365024d0cd0Skarels
366024d0cd0Skarelsttyv0)
3679f7203aeSkarels	if [ ! -f ttyqe ]; then sh ./MAKEDEV pty1; fi
368024d0cd0Skarels	mv ttyqf ttyv0
369024d0cd0Skarels	mv ptyqf ptyv0
370024d0cd0Skarels	;;
371024d0cd0Skarels
3726b7db209Ssamlocal)
373898732d7Ssam	sh MAKEDEV.local
3746b7db209Ssam	;;
3756b7db209Ssamesac
3766b7db209Ssamdone
377