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