MAKEDEV.tmpl revision 1.11
1#!/bin/sh -
2#	$NetBSD: MAKEDEV.tmpl,v 1.11 2003/12/10 11:40:11 hannken Exp $
3#
4# Copyright (c) 2003 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions
9# are met:
10# 1. Redistributions of source code must retain the above copyright
11#    notice, this list of conditions and the following disclaimer.
12# 2. Redistributions in binary form must reproduce the above copyright
13#    notice, this list of conditions and the following disclaimer in the
14#    documentation and/or other materials provided with the distribution.
15# 3. All advertising materials mentioning features or use of this software
16#    must display the following acknowledgement:
17#        This product includes software developed by the NetBSD
18#        Foundation, Inc. and its contributors.
19# 4. Neither the name of The NetBSD Foundation nor the names of its
20#    contributors may be used to endorse or promote products derived
21#    from this software without specific prior written permission.
22#
23# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
24# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
27# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33# POSSIBILITY OF SUCH DAMAGE.
34#
35#
36###########################################################################
37#
38#   PLEASE RUN "cd ../share/man/man8 ; make makedevs"
39#   AFTER CHANGING THIS FILE, AND COMMIT THE UPDATED MANPAGE!
40#
41###########################################################################
42#
43# Device "make" file.  Valid arguments:
44#	all	makes all known devices, including local devices.
45#		Tries to make the 'standard' number of each type.
46#	init	A set of devices that is used for MFS /dev by init.
47#		May be equal to "all".
48#	floppy	devices to be put on install floppies
49#	ramdisk	devices to be put into INSTALL kernel ramdisks.
50#	std	standard devices
51#	local	configuration specific devices
52#	usbs	make USB devices
53#	isdns	make ISDN devices
54#
55# Tapes:
56#	st*	SCSI tapes
57#	wt*	QIC-interfaced (e.g. not SCSI) 3M cartridge tape
58#	ht*	MASSBUS TM03 and TU??
59#	mt*	MSCP tapes (e.g. TU81, TK50)
60#	tm*	UNIBUS TM11 and TE10 emulations (e.g. Emulex TC-11)
61#	ts*	UNIBUS TS11
62#	ut*	UNIBUS TU45 emulations (e.g. si 9700)
63#	uu*	TU58 cassettes on DL11 controller
64#
65# Disks:
66#	ccd*	concatenated disk devices
67#	cd*	SCSI or ATAPI CD-ROM
68#	cgd*	cryptographic disk devices
69#	raid*	RAIDframe disk devices
70#	sd*	SCSI disks
71#	wd*	"winchester" disk drives (ST506,IDE,ESDI,RLL,...)
72#	bmd*	Nereid bank memory disks
73#	ed*	IBM PS/2 ESDI disk devices
74#	fd*	"floppy" disk drives (3 1/2", 5 1/4")
75#	fss*	Files system snapshot devices
76#	gdrom*	Dreamcast "gigadisc" CD-ROM drive
77#	hk*	UNIBUS RK06 and RK07
78#	hp*	MASSBUS RM??
79#	ld*	Logical disk devices (e.g., hardware RAID)
80#	mcd*	Mitsumi CD-ROM
81#	md*	memory pseudo-disk devices
82#	ofdisk*	OpenFirmware disk devices
83#	ra*	MSCP disks (RA??, RD??)
84#	rb*	730 IDC w/ RB80 and/or RB02
85#	rd*	HDC9224 RD disks on VS2000
86#	rl*	UNIBUS RL02
87#	rx*	MSCP floppy disk (RX33/50/...)
88#	up*	other UNIBUS devices (e.g. on Emulex SC-21V controller)
89#	vnd*	"file" pseudo-disks
90#	xd*	Xylogic 753/7053 disks
91#	xy*	Xylogic 450/451 disks
92#
93# Pointing devices:
94#	wsmouse* wscons mouse events
95#	lms*	Logitech bus mouse
96#	mms*	Microsoft bus mouse
97#	qms*	"quadrature mouse"
98#	pms*	PS/2 mouse
99#	mouse	mouse (provides events, for X11)
100#
101# Keyboard devices:
102#	wskbd*	wscons keyboard events
103#	kbd	raw keyboard (provides events, for X11)
104#	kbdctl	keyboard control
105#
106# Terminals/Console ports:
107#	tty[01]*	standard serial ports
108#	tty0*	SB1250 ("sbscn") serial ports (sbmips)
109#	ttyE*	wscons - Workstation console ("wscons") glass-tty emulators
110#	ttyCZ?	Cyclades-Z multiport serial boards.  Each "unit"
111#		makes 64 ports.
112#	ttyCY?	Cyclom-Y multiport serial boards. Each "unit" makes
113#		32 ports.
114#	ttye*	ITE bitmapped consoles
115#	ttyv0	pccons
116#	ttyC?	NS16550 ("com") serial ports
117#	ttyS*	SA1110 serial port (hpcarm)
118#	ttyTX?	TX39 internal serial ports (hpcmips)
119#	ttyB?	DEC 3000 ZS8530 ("scc") serial ports (alpha)
120#	ttyA*	mfc serial ports (amiga)
121#	ttyB*	msc serial ports (amiga)
122#	ttyC*	com style serial ports (DraCo, HyperCom) (amiga)
123#		On the DraCo, units 0 and 1 are the built-in "modem" and
124#		"mouse" ports, if configured.
125#	ttyA0   8530 Channel A (formerly ser02) (atari)
126#	ttyA1	8530 Channel B (formerly mdm02) (atari)
127#	ttyB0	UART on first 68901 (formerly mdm01) (atari)
128#	ixpcom	IXP12x0 COM ports
129#	ttyM?	HP200/300 4 port serial mux interface (hp300)
130#	ttya	"ttya" system console (luna68k)
131#	ttyb	second system serial port (luna68k)
132#	tty*	Onboard serial ports (mvme68k)
133#		On the mvme147 these are: ttyZ1, ttyZ2 and ttyZ3.
134#		On the mvme167, and '177: ttyC1, ttyC2 and ttyC3.
135#		Note that tty[CZ]0 is grabbed by the console device
136#		so is not created by default
137#	dc*	PMAX 4 channel serial interface (kbd, mouse, modem, printer)
138#	scc*	82530 serial interface (pmax)
139#	ttyZ*	Zilog 8530 ("zstty") serial ports
140#	tty[abcd]	Built-in serial ports (sparc)
141#	tty*	Z88530 serial controllers (sparc64)
142#	ttyh*	SAB82532 serial controllers (sparc64)
143#	tty[a-j]	Built-in serial ports (sun2, sun3)
144#	ttyC?	pccons (arc)
145#	dz*	UNIBUS DZ11 and DZ32 (vax)
146#	dh*	UNIBUS DH11 and emulations (e.g. Able DMAX, Emulex CS-11) (vax)
147#	dmf*	UNIBUS DMF32 (vax)
148#	dhu*    UNIBUS DHU11 (vax)
149#	dmz*    UNIBUS DMZ32 (vax)
150#	dl*	UNIBUS DL11 (vax)
151#
152# Terminal multiplexors:
153#	dc*	4 channel serial interface (keyboard, mouse, modem, printer)
154#	dh*	UNIBUS DH11 and emulations (e.g. Able DMAX, Emulex CS-11)
155#	dhu*	UNIBUS DHU11
156#	dl*	UNIBUS DL11
157#	dmf*	UNIBUS DMF32
158#	dmz*	UNIBUS DMZ32
159#	dz*	UNIBUS DZ11 and DZ32
160#	scc*	82530 serial interface
161#
162# Call units:
163#	dn*	UNIBUS DN11 and emulations (e.g. Able Quadracall)
164#
165# Pseudo terminals:
166#	pty*	set of 62 master and slave pseudo terminals
167#	opty	first 16 ptys, to save inodes on install media
168#	ipty	first 2 ptys, for install media use only
169#
170# Printers:
171#	arcpp*	Archimedes parallel port
172#	lpt*	stock lp
173#	lpa*	interruptless lp
174#	par*	Amiga motherboard parallel port
175#
176# USB devices:
177#	usb*	USB control devices
178#	uhid*	USB generic HID devices
179#	ulpt*	USB printer devices
180#	ugen*	USB generic devices
181#	urio*	USB Diamond Rio 500 devices
182#	uscanner*	USB scanners
183#	ttyU*	USB modems
184#
185# ISDN devices:
186#	isdn	communication between userland isdnd and kernel
187#	isdnctl	control device
188#	isdnbchan* raw b-channel access
189#	isdntel*	telephony device
190#	isdnteld*	telephony dialout device
191#	isdntrc*	trace device
192#
193# Video devices:
194#	bwtwo*	monochromatic frame buffer
195#	cgtwo*	8-bit color frame buffer
196#	cgthree*	8-bit color frame buffer
197#	cgfour*	8-bit color frame buffer
198#	cgsix*	accelerated 8-bit color frame buffer
199#	cgeight*	24-bit color frame buffer
200#	etvme	Tseng et-compatible cards on VME (atari)
201#	ik*	UNIBUS interface to Ikonas frame buffer
202#	leo	Circad Leonardo VME-bus true color (atari)
203#	ps*	UNIBUS interface to Picture System 2
204#	qv*	QVSS (MicroVAX) display
205#	tcx*	accelerated 8/24-bit color frame buffer
206#
207# Maple bus devices:
208#	maple	Maple bus control devices
209#	mlcd*	Maple bus LCD devices
210#	mmem*	Maple bus storage devices
211#
212# Special purpose devices:
213#	ad*	UNIBUS interface to Data Translation A/D converter
214#	agp*	AGP GART devices
215#	altq	ALTQ control interface
216#	apm	power management device
217#	audio*	audio devices
218#	beep	PC speaker
219#	bell*	OPM bell device (x68k)
220#	bktr	Brooktree 848/849/878/879 based TV cards
221#	bpf*	packet filter
222#	cfs*	Coda file system device
223#	ch*	SCSI media changer
224#	cir*	Consumer IR
225#	clockctl clock control for non root users
226#	crypto	hardware crypto access driver
227#	dmoverio hardware-assisted data movers
228#	dpt*	DPT/Adaptec EATA RAID management interface
229#	dpti*	DPT/Adaptec I2O RAID management interface
230#	fb*	PMAX generic framebuffer pseudo-device
231#	fd	file descriptors
232#	grf*	graphics frame buffer device
233#	hil	HP300 HIL input devices
234#	icp	ICP-Vortex/Intel RAID control interface
235#	iic*	IIC bus device
236#	iop*	I2O IOP control interface
237#	ipl	IP Filter
238#	irframe* IrDA physical frame
239#	ite*	terminal emulator interface to HP300 graphics devices
240#	joy*	joystick device
241#	kttcp	kernel ttcp helper device
242#	lkm	loadable kernel modules interface
243#	magma*	Magma multiport serial/parallel cards
244#	midi*	MIDI
245#	mlx*	Mylex DAC960 control interface
246#	mly*	Mylex AcceleRAID/eXtremeRAID control interface
247#	np*	UNIBUS Ethernet co-processor interface, for downloading.
248#	nsmb*	SMB requester
249#	openfirm OpenFirmware accessor
250#	pci*	PCI bus access devices
251#	pf	PF packet filter (not in tree)
252#	pow*	power management device (x68k)
253#	px*	PixelStamp Xserver access
254#	radio*	radio devices
255#	random	Random number generator
256#	rtc*	RealTimeClock
257#	satlink* PlanetConnect satellite receiver driver
258#	scsibus* SCSI busses
259#	se*	SCSI Ethernet
260#	ses*	SES/SAF-TE SCSI Devices
261#	speaker	PC speaker		(XXX - installed)
262#	sram	battery backuped memory (x68k)
263#	ss*	SCSI scanner
264#	stic*	PixelStamp interface chip
265#	sysmon	System Monitoring hardware
266#	systrace syscall tracer
267#	tun*	network tunnel driver
268#	twe	3ware Escalade control interface
269#	uk*	unknown SCSI device
270#	veriexec verified executable fingerprint loader
271#	vmegen*	generic VME access
272#	view*	generic interface to graphic displays (Amiga)
273#	wsfont*	console font control
274#	wsmux*	wscons event multiplexor
275
276dialin=0
277dialout=524288
278callunit=262144
279
280# Keep /usr/etc so SunOS can find chown
281PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/etc
282
283# only allow read&write for owner by default
284umask 077
285
286# Check if we have fdesc mounted
287if [ -d fd ]; then
288        case "`df fd`" in
289        *fdesc*) nofdesc=false;;
290        *) nofdesc=true;;
291        esac
292else
293        nofdesc=true
294fi
295
296# called from makedev, with params
297# mkdev name b/c major minor [mode] [group]
298mkdev() {
299	rm -f $1
300	mknod $1 $2 $3 $4
301	test -n "$5" && chmod $5 $1
302	test -n "$6" && chgrp $6 $1
303}
304
305makedev()
306{
307
308for i
309do
310
311case $i in
312
313%MD_DEVICES%
314
315all)
316	makedev all_md
317	makedev std fd pty0
318	makedev ccd0 ccd1 ccd2 ccd3
319	makedev cgd0 cgd1 cgd2 cgd3
320	makedev fss0 fss1 fss2 fss3
321	makedev md0 md1
322	makedev raid0 raid1 raid2 raid3 raid4 raid5 raid6 raid7
323	makedev vnd0 vnd1 vnd2 vnd3
324	makedev bpf0 bpf1 bpf2 bpf3 bpf4 bpf5 bpf6 bpf7
325	makedev tun0 tun1 tun2 tun3
326	makedev ipl crypto random systrace
327	makedev lkm clockctl
328	makedev local
329	;;
330
331init)
332	# unless overridden by MD entry, this is equal to 'all'
333	makedev all
334	;;
335
336%MI_DEVICES_BEGIN%
337audio)
338	makedev audio0 audio1 audio2 audio3
339	ln -fs sound0 sound
340	ln -fs audio0 audio
341	ln -fs mixer0 mixer
342	ln -fs audioctl0 audioctl
343	;;
344
345radio)
346	makedev radio0 radio1
347	ln -fs radio0 radio
348	;;
349
350ramdisk)
351	makedev floppy md0
352	;;
353
354usbs)
355	makedev usb usb0 usb1 usb2 usb3 usb4 usb5 usb6 usb7
356	makedev uhid0 uhid1 uhid2 uhid3
357	makedev ulpt0 ulpt1
358	makedev ttyU0 ttyU1
359	makedev urio0
360	makedev uscanner0 uscanner1
361	makedev ugen0
362	;;
363
364isdns)
365	makedev isdn isdnctl isdnbchan0 isdnbchan1 isdntel0 isdntel1 isdnteld0 isdnteld1 isdntrc0 isdntrc1
366	;;
367
368std)
369	rm -f console constty drum mem kmem null zero io klog ksyms
370	mknod console		c %cons_chr% 0
371	mknod constty		c %cons_chr% 1
372	mknod drum		c %swap_chr% 0	; chmod 640 drum ; chgrp kmem drum
373	mknod kmem		c %mem_chr% 1	; chmod 640 kmem ; chgrp kmem kmem
374	mknod mem		c %mem_chr% 0	; chmod 640 mem	; chgrp kmem mem
375	mknod null		c %mem_chr% 2	; chmod 666 null
376	mknod zero		c %mem_chr% 12	; chmod 666 zero
377	mknod klog		c %log_chr% 0	; chmod 600 klog
378	mknod ksyms		c %ksyms_chr% 0	; chmod 444 ksyms
379	if $nofdesc; then
380		rm -f tty stdin stdout stderr
381		mknod tty	c %ctty_chr% 0	; chmod 666 tty
382		mknod stdin	c %filedesc_chr% 0	; chmod 666 stdin
383		mknod stdout	c %filedesc_chr% 1	; chmod 666 stdout
384		mknod stderr	c %filedesc_chr% 2	; chmod 666 stderr
385	fi
386	;;
387
388usb*)
389	unit=${i#usb}
390	if [ "$unit" = "" ]; then
391	    unit=255
392	    usb=usb
393	else
394	    usb=usb$unit
395	fi
396	major=%usb_chr%
397	rm -f $usb
398	mknod $usb c $major $unit
399	chmod 600 $usb
400	;;
401
402uhid*)
403	unit=${i#uhid}
404	uhid=uhid$unit
405	major=%uhid_chr%
406	rm -f $uhid
407	mknod $uhid c $major $unit
408	chmod 666 $uhid
409	;;
410
411ulpt*)
412	unit=${i#ulpt}
413	ulpt=ulpt$unit
414	ulpn=ulpn$unit
415	major=%ulpt_chr%
416	rm -f $ulpt $ulpn
417	mknod $ulpt c $major $unit
418	mknod $ulpn c $major $(($unit + 64))
419	chmod 600 $ulpt $ulpn
420	;;
421
422urio*)
423	unit=${i#urio}
424	urio=urio$unit
425	major=%urio_chr%
426	rm -f $urio
427	mknod $urio c $major $unit
428	chmod 666 $urio
429	;;
430
431uscanner*)
432	unit=${i#uscanner}
433	uscanner=uscanner$unit
434	major=%uscanner_chr%
435	rm -f $uscanner
436	mknod $uscanner c $major $unit
437	chmod 600 $uscanner
438	;;
439
440ttyU*)
441	unit=${i#ttyU}
442	ttyU=ttyU$unit
443	dtyU=dtyU$unit
444	ctyU=ctyU$unit
445	major=%ucom_chr%
446	rm -f $ttyU $dtyU $ctyU
447	mknod $ttyU c $major $(($unit + $dialin  ))
448	mknod $dtyU c $major $(($unit + $dialout ))
449	mknod $ctyU c $major $(($unit + $callunit))
450	chown uucp $ttyU $dtyU $ctyU
451	chmod 600 $ttyU $dtyU $ctyU
452	;;
453
454ugen*)
455	unit=${i#ugen}
456	ugen=ugen$unit
457	major=%ugen_chr%
458	for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
459	do
460		ugenj=$ugen.$j
461		rm -f $ugenj
462		mknod $ugenj c $major $(($unit * 16 + ${j#0}))
463		chmod 600 $ugenj
464	done
465	;;
466
467wscons)
468	makedev ttyE0 ttyE1 ttyE2 ttyE3 ttyE4 ttyE5 ttyE6 ttyE7
469	makedev wsmouse0 wsmouse1 wsmouse2 wsmouse3
470	makedev wskbd0 wskbd1 wskbd2 wskbd3
471	makedev wsmux0 wsmux1 wsmux2 wsmux3
472	makedev wsmouse wskbd
473	makedev ttyEcfg ttyEstat
474	makedev wsfont
475	;;
476
477wsmouse)
478	rm -f wsmouse
479	mknod wsmouse c %wsmux_chr% 0
480	chmod 600 wsmouse
481	;;
482
483wskbd)
484	rm -f wskbd
485	mknod wskbd c %wsmux_chr% 1
486	chmod 600 wskbd
487	;;
488
489wsmux*)
490	unit=${i#wsmux}
491	unitctl=$(($unit + 128))
492	wsmux=wsmux$unit
493	wsmuxctl=wsmuxctl$unit
494	major=%wsmux_chr%
495	rm -f $wsmux $wsmuxctl
496	mknod $wsmux c $major $unit
497	chmod 600 $wsmux
498	mknod $wsmuxctl c $major $unitctl
499	chmod 200 $wsmuxctl
500	;;
501
502ttyEstat)
503	chr=%wsdisplay_chr%
504	rm -f ttyEstat
505	mknod ttyEstat c $chr 254
506	chmod 600 ttyEstat
507	;;
508
509ttyEcfg)
510	chr=%wsdisplay_chr%
511	rm -f ttyEcfg
512	mknod ttyEcfg c $chr 255
513	chmod 600 ttyEcfg
514	;;
515
516ttyE*)
517	chr=%wsdisplay_chr%; unit=${i#ttyE}
518	rm -f ttyE$unit
519	mknod ttyE$unit c $chr $unit
520	;;
521
522wsmouse*)
523	unit=${i#wsmouse}
524	wsmouse=wsmouse$unit
525	major=%wsmouse_chr%
526	rm -f $wsmouse
527	mknod $wsmouse c $major $unit
528	chmod 600 $wsmouse
529	;;
530
531wskbd*)
532	unit=${i#wskbd}
533	wskbd=wskbd$unit
534	major=%wskbd_chr%
535	rm -f $wskbd
536	mknod $wskbd c $major $unit
537	chmod 600 $wskbd
538	;;
539
540fd)
541	if $nofdesc; then
542		rm -f fd/*
543		mkdir fd 2>/dev/null
544		n=0
545		while [ $n -lt 64 ]; do
546			mknod fd/$n c %filedesc_chr% $n
547			n=$(($n + 1))
548		done
549		chmod 755 fd
550		chmod 666 fd/*
551	fi
552	;;
553
554wt*)
555	case $i in
556	wt*) name=wt;  unit=${i#wt};	chr=%wt_chr%;	blk=%wt_blk%;;
557	esac
558	for sub in $unit $(($unit+8)) $(($unit+16))
559	do
560	    rm -f $name$sub n$name$sub r$name$sub nr$name$sub
561	    mknod $name$sub	b $blk $(($sub + 0))
562	    mknod n$name$sub	b $blk $(($sub + 4))
563	    mknod r$name$sub	c $chr $(($sub + 0))
564	    mknod nr$name$sub	c $chr $(($sub + 4))
565	    chgrp operator $name$sub n$name$sub r$name$sub nr$name$sub
566	    chmod 660 $name$sub n$name$sub r$name$sub nr$name$sub
567	done
568	;;
569
570md*)
571	makedisk_minimal md ${i#md} %md_blk% %md_chr%
572	;;
573
574fss*)
575	name=fss; unit=${i#fss};	blk=%fss_blk%;	chr=%fss_chr%
576	mknod $name$unit	b $blk $unit
577	mknod r$name$unit	c $chr $unit
578	chgrp operator $name$unit r$name$unit
579	chmod 660 $name$unit r$name$unit
580	;;
581
582ss*)
583	case $i in
584	ss*) name=ss;	unit=${i#ss};	chr=%ss_chr%;;
585	esac
586	rm -f $name$unit n$name$unit en$name$unit
587	mknod $name$unit	c $chr $(($unit * 16 + 0))
588	mknod n$name$unit	c $chr $(($unit * 16 + 1))
589	mknod en$name$unit	c $chr $(($unit * 16 + 3))
590	chgrp operator $name$unit n$name$unit en$name$unit
591	chmod 640 $name$unit n$name$unit en$name$unit
592	;;
593
594ccd*|cgd*|raid*|vnd*)
595	case $i in
596	ccd*) name=ccd;	unit=${i#ccd};	blk=%ccd_blk%;	chr=%ccd_chr%;;
597	cgd*) name=cgd;	unit=${i#cgd};	blk=%cgd_blk%;	chr=%cgd_chr%;;
598	raid*) name=raid; unit=${i#raid}; blk=%raid_blk%; chr=%raid_chr%;;
599	vnd*) name=vnd;	unit=${i#vnd};	blk=%vnd_blk%;	chr=%vnd_chr%;;
600	esac
601	%MKDISK% $name $unit $blk $chr
602	;;
603
604sd*)
605	name=sd; unit=${i#sd};	blk=%sd_blk%;	chr=%sd_chr%
606	%MKDISK% $name $unit $blk $chr
607	;;
608
609wd*)
610	name=wd; unit=${i#wd}; blk=%wd_blk%; chr=%wd_chr%
611	%MKDISK% $name $unit $blk $chr
612	;;
613
614fd*)
615	name=fd; unit=${i#fd}; blk=%fd_blk%; chr=%fd_chr%
616	%MKDISK% $name $unit $blk $chr
617	;;
618
619ld*)
620	name=ld; unit=${i#ld}; blk=%ld_blk%; chr=%ld_chr%
621	%MKDISK% $name $unit $blk $chr
622	;;
623
624ed*)
625	name=ed; unit=${i#ed}; blk=%ed_blk%; chr=%ed_chr%
626	%MKDISK% $name $unit $blk $chr
627	;;
628
629ofdisk*)
630	name=ofdisk; unit=${i#ofdisk}; blk=%ofdisk_blk%; chr=%ofdisk_chr%
631	%MKDISK% $name $unit $blk $chr
632	;;
633
634ttyCZ*)
635	unit=${i#ttyCZ}
636	major=%cz_chr%
637	minor=$(($unit * 64))
638	eminor=$(($minor + 64))
639	while [ $minor -lt $eminor ]; do
640		if [ $minor -lt 10 ]; then
641			nminor=000$minor
642		elif [ $minor -lt 100 ]; then
643			nminor=00$minor
644		elif [ $minor -lt 1000 ]; then
645			nminor=0$minor
646		else
647			nminor=$minor
648		fi
649		rm -f ttyCZ$nminor dtyCZ$nminor
650		mknod ttyCZ$nminor c $major $(($minor + $dialin  ))
651		mknod dtyCZ$nminor c $major $(($minor + $dialout ))
652		chown uucp ttyCZ$nminor dtyCZ$nminor
653		chmod 600 ttyCZ$nminor dtyCZ$nminor
654		minor=$(($minor + 1))
655	done
656	;;
657
658ttyCY*)
659	unit=${i#ttyCY}
660	major=%cy_chr%
661	minor=$(($unit * 32))
662	eminor=$(($minor + 32))
663	while [ $minor -lt $eminor ]; do
664		if [ $minor -lt 10 ]; then
665			nminor=00$minor
666		elif [ $minor -lt 100 ]; then
667			nminor=0$minor
668		else
669			nminor=$minor
670		fi
671		rm -f ttyCY$nminor dtyCY$nminor
672		mknod ttyCY$nminor c $major $(($minor + $dialin  ))
673		mknod dtyCY$nminor c $major $(($minor + $dialout ))
674		chown uucp ttyCY$nminor dtyCY$nminor
675		chmod 600 ttyCY$nminor dtyCY$nminor
676		minor=$(($minor + 1))
677	done
678	;;
679
680tty[0-9]|tty0[0-9])
681	# some archs have built-in zstty (major %zstty_chr%) instead
682	# of NS16550; create ttyZ* and hardlink as [dt]ty0*; this
683	# needs to be before com entry, for archs which have both
684	unit=${i#tty}
685	unit=$(($unit + 0))
686	makedev ttyZ${unit}
687	rm -f tty0$unit dty0$unit
688	ln -fs ttyZ$unit tty0${unit}
689	ln -fs dtyZ$unit dty0${unit}
690	;;
691
692tty0*|tty1*|tty[0-9])
693	ounit=${i#tty}
694	ounit=$(($ounit + 0))
695	if [ $ounit -lt 10 ]; then
696		unit=0$ounit
697	else
698		unit=$ounit
699	fi
700	rm -f tty$unit dty$unit
701	mknod tty$unit c %com_chr% $(($ounit + $dialin ))
702	mknod dty$unit c %com_chr% $(($ounit + $dialout))
703	chown uucp tty$unit dty$unit
704	;;
705
706ttyC*)
707	# some archs call it ttyC traditionally
708	unit=${i#ttyC}
709	rm -f ttyC$unit dtyC$unit
710	mknod ttyC$unit c %com_chr% $(($unit + $dialin))
711	mknod dtyC$unit c %com_chr% $(($unit + $dialout))
712	chown uucp ttyC$unit dtyC$unit
713	;;
714
715ttyh*)
716	unit=${i#ttyh}
717	rm -f ttyh$unit dtyh$unit
718	mknod ttyh$unit c %sabtty_chr% $(($unit + $dialin ))
719	mknod dtyh$unit c %sabtty_chr% $(($unit + $dialout))
720	chown uucp ttyh$unit dtyh$unit
721	;;
722
723ttyZ*)
724	name=ttyZ; dname=dtyZ; unit=${i#ttyZ}; chr=%zstty_chr%
725	rm -f $name$unit $dname$unit
726	mknod  $name$unit c $chr $(($unit + $dialin ))
727	mknod $dname$unit c $chr $(($unit + $dialout))
728	chown uucp $name$unit $dname$unit
729	;;
730
731opty)
732	rm -f ttyp[0-9a-f] ptyp[0-9a-f]
733	for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f
734	do
735		case $j in
736		[0-9])	jn=$j ;;
737		a)	jn=10 ;;
738		b)	jn=11 ;;
739		c)	jn=12 ;;
740		d)	jn=13 ;;
741		e)	jn=14 ;;
742		f)	jn=15 ;;
743		esac
744		mknod ttyp$j c %pts_chr% $jn
745		mknod ptyp$j c %ptc_chr% $jn
746	done
747	chmod 666 ttyp[0-9a-f] ptyp[0-9a-f]
748	;;
749
750pty*)
751	class=${i#pty}
752	set -- p q r s t u v w x y z P Q R S T
753	if [ "$class" -ge $# ]; then
754		echo "$MAKEDEV: $i: pty unit must be between 0 and 15"
755		continue
756	fi
757	shift $class
758	name=$1
759	if [ "$name" = v ]; then
760		echo "$MAKEDEV: $i: pty unit conflicts with console ttyv0 device."
761		continue
762	fi
763	rm -f tty$name[0-9a-zA-Z] pty$name[0-9a-zA-Z]
764	jn=0
765	unit=$(($class * 16))
766	names=
767	set -- - 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
768	while
769		shift
770		j=$1
771		[ -n "$j" ]
772	do
773		if [ $j = g ]; then
774			unit=$(($unit + $class * 30 + 256 - 16))
775		fi
776		mknod tty$name$j c %pts_chr% $unit
777		mknod pty$name$j c %ptc_chr% $unit
778		names="$names tty$name$j pty$name$j"
779		unit=$(($unit + 1))
780	done
781	chmod 666 $names
782	unset names
783	;;
784
785stic*)
786	unit=${i#stic}
787	rm -f stic$unit
788	mknod stic$unit c %stic_chr% $unit
789	chmod 600 stic$unit
790	;;
791
792st*)
793	case $i in
794	st*) name=st;	unit=${i#st};	chr=%st_chr%;	blk=%st_blk%;;
795	esac
796	rm -f $name$unit n$name$unit e$name$unit en$name$unit \
797		r$name$unit nr$name$unit er$name$unit enr$name$unit
798	mknod $name$unit	b $blk $(($unit * 16 + 0))
799	mknod n$name$unit	b $blk $(($unit * 16 + 1))
800	mknod e$name$unit	b $blk $(($unit * 16 + 2))
801	mknod en$name$unit	b $blk $(($unit * 16 + 3))
802	mknod r$name$unit	c $chr $(($unit * 16 + 0))
803	mknod nr$name$unit	c $chr $(($unit * 16 + 1))
804	mknod er$name$unit	c $chr $(($unit * 16 + 2))
805	mknod enr$name$unit	c $chr $(($unit * 16 + 3))
806	chgrp operator $name$unit n$name$unit e$name$unit en$name$unit \
807		r$name$unit nr$name$unit er$name$unit enr$name$unit
808	chmod 660 $name$unit n$name$unit e$name$unit en$name$unit \
809		r$name$unit nr$name$unit er$name$unit enr$name$unit
810	;;
811
812ses*|ch*|uk*)
813	case $i in
814	ch*) name=ch;	unit=${i#ch};	chr=%ch_chr%;;
815	uk*) name=uk;	unit=${i#uk};	chr=%uk_chr%;;
816	ses*) name=ses;	unit=${i#ses};	chr=%ses_chr%;;
817	esac
818	rm -f $name$unit
819	mknod $name$unit	c $chr $unit
820	chgrp operator $name$unit
821	chmod 640 $name$unit
822	;;
823
824cd*)
825	makedisk_minimal cd ${i#cd} %cd_blk% %cd_chr% %
826	;;
827
828mcd*)
829	makedisk_minimal mcd ${i#mcd} %mcd_blk% %mcd_chr%
830	;;
831
832gdrom*)
833	makedisk_minimal gdrom ${i#gdrom} %gdrom_blk% %gdrom_chr%
834	;;
835
836lpt*|lpa*)
837	case $i in
838	lpt*) name=lpt;	unit=${i#lpt};	chr=%lpt_chr%;	flags=0;;
839	lpa*) name=lpa;	unit=${i#lpa};	chr=%lpt_chr%;	flags=128;;
840	esac
841	rm -f $name$unit
842	mknod $name$unit	c $chr $(($unit + $flags))
843	;;
844
845bpf*|tun*)
846	case $i in
847	bpf*) name=bpf;	unit=${i#bpf};	chr=%bpf_chr%;;
848	tun*) name=tun;	unit=${i#tun};	chr=%tun_chr%;;
849	esac
850	rm -f $name$unit
851	mknod $name$unit	c $chr $unit
852	;;
853
854joy*)
855	case $i in
856	joy*) name=joy;	unit=${i#joy};	chr=%joy_chr%;;
857	esac
858	rm -f $name$unit
859	mknod $name$unit	c $chr $unit
860	;;
861
862ipl)
863	rm -f ipl ipnat ipstate ipauth
864	mknod ipl c %ipl_chr% 0
865	mknod ipnat c %ipl_chr% 1
866	mknod ipstate c %ipl_chr% 2
867	mknod ipauth c %ipl_chr% 3
868	chmod 600 ipl ipnat ipstate ipauth
869	;;
870
871pf)
872	rm -f pf
873	mknod pf c %pf_chr% 0
874	chmod 600 pf
875	;;
876
877crypto)
878	rm -f crypto
879	mknod crypto c %crypto_chr% 0
880	chmod 666 crypto
881	;;
882
883speaker)
884	rm -f speaker
885	mknod speaker c %spkr_chr% 0
886	;;
887
888lkm)
889	rm -f lkm
890	mknod lkm c %lkm_chr% 0
891	chgrp kmem lkm
892	chmod 640 lkm
893	;;
894
895audio*)
896	unit=${i#audio}
897	audio=audio$unit
898	sound=sound$unit
899	mixer=mixer$unit
900	major=%audio_chr%
901	audioctl=audioctl$unit
902	if [ "$unit" = "" ]; then unit=0; fi
903	rm -f $audio $sound $mixer $audioctl
904	mknod $sound    c $major $(($unit + 0))
905	mknod $audio    c $major $(($unit + 128))
906	mknod $mixer    c $major $(($unit + 16))
907	mknod $audioctl c $major $(($unit + 192))
908	chmod 666 $audio $sound $mixer $audioctl
909	;;
910
911rmidi*)
912	unit=${i#rmidi}
913	major=%midi_chr%
914	rmidi=rmidi$unit
915	rm -f $rmidi
916	mknod $rmidi c $major $unit
917	chmod 666 $rmidi
918	;;
919
920music*)
921	unit=${i#music}
922	music=music$unit
923	sequencer=sequencer$unit
924	major=%sequencer_chr%
925	if [ "$unit" = "" ]; then unit=0; fi
926	rm -f $sequencer $music
927	mknod $music     c $major $(($unit + 0))
928	mknod $sequencer c $major $(($unit + 128))
929	chmod 666 $music $sequencer
930	;;
931
932radio*)
933	unit=${i#radio}
934	radio=radio$unit
935	major=%radio_chr%
936	if [ "$unit" = "" ]; then unit=0; fi
937	rm -f $radio
938	mknod $radio c $major $unit
939	chmod 666 $radio
940	;;
941
942apm*)
943	rm -f apm apmctl
944	mknod apm c %apm_chr% 0
945	mknod apmctl c %apm_chr% 8
946	chmod 644 apm apmctl
947	;;
948
949apm*)
950	rm -f apm apmctl
951	mknod apm c %apmdev_chr% 0
952	mknod apmctl c %apmdev_chr% 8
953	chmod 644 apm apmctl
954	;;
955
956satlink*)
957	unit=${i#satlink}
958	rm -f satlink$unit
959	mknod satlink$unit c %satlink_chr% $unit
960	chmod 444 satlink$unit
961	;;
962
963random)
964	rm -f random urandom
965	mknod random c %rnd_chr% 0
966	mknod urandom c %rnd_chr% 1
967	chmod 444 random
968	chmod 644 urandom
969	;;
970
971cfs*)
972	unit=${i#cfs}
973	cfs=cfs$unit
974	major=%vcoda_chr%
975	rm -f $cfs
976	mknod $cfs c $major $unit
977	chmod 600 $cfs
978	;;
979
980sysmon)
981	major=%sysmon_chr%
982	rm -f sysmon
983	mknod sysmon c $major 0
984	chmod 644 sysmon
985
986	rm -f watchdog
987	mknod watchdog c $major 1
988	chmod 644 watchdog
989
990	rm -f power
991	mknod power c $major 2
992	chmod 640 power
993	;;
994
995scsibus*)
996	unit=${i#scsibus}
997	rm -f scsibus$unit
998	mknod scsibus$unit c %scsibus_chr% $unit
999	chmod 644 scsibus$unit
1000	;;
1001
1002bktr)
1003	makedev bktr0 bktr1
1004	ln -fs bktr0 bktr
1005	ln -fs tuner0 tuner
1006	ln -fs vbi0 vbi
1007	;;
1008
1009bktr*)
1010	major=%bktr_chr%
1011	unit=${i#bktr}
1012	rm -f bktr$unit tuner$unit vbi$unit
1013	mknod bktr$unit c $major $(($unit + 0))
1014	mknod tuner$unit c $major $(($unit + 16))
1015	mknod vbi$unit c $major $(($unit + 32))
1016	chmod 444 bktr$unit tuner$unit vbi$unit
1017	;;
1018
1019iop*)
1020	unit=${i#iop}
1021	rm -f iop$unit
1022	mknod iop$unit c %iop_chr% $unit
1023	chmod 600 iop$unit
1024	;;
1025
1026mlx*)
1027	unit=${i#mlx}
1028	rm -f mlx$unit
1029	mknod mlx$unit c %mlx_chr% $unit
1030	chmod 600 mlx$unit
1031	;;
1032
1033mly*)
1034	unit=${i#mly}
1035	rm -f mly$unit
1036	mknod mly$unit c %mly_chr% $unit
1037	chmod 600 mly$unit
1038	;;
1039
1040twe*)
1041	unit=${i#twe}
1042	rm -f twe$unit
1043	mknod twe$unit c %twe_chr% $unit
1044	chmod 600 twe$unit
1045	;;
1046
1047icp*)
1048	unit=${i#icp}
1049	rm -f icp$unit
1050	mknod icp$unit c %icp_chr% $unit
1051	chmod 600 icp$unit
1052	;;
1053
1054agp*)
1055	unit=${i#agp}
1056	rm -f agp$unit
1057	mknod agp$unit c %agp_chr% $unit
1058	if [ "$unit" = "0" ]; then ln -fs agp$unit agpgart; fi
1059	chmod 644 agp$unit
1060	;;
1061
1062pci*)
1063	unit=${i#pci}
1064	rm -f pci$unit
1065	mknod pci$unit c %pci_chr% $unit
1066	chmod 644 pci$unit
1067	;;
1068
1069dpti*)
1070	unit=${i#dpti}
1071	rm -f dpti$unit
1072	mknod dpti$unit c %dpti_chr% $unit
1073	chmod 600 dpti$unit
1074	;;
1075
1076dpt*)
1077	unit=${i#dpt}
1078	rm -f dpt$unit
1079	mknod dpt$unit c %dpt_chr% $unit
1080	chmod 600 dpt$unit
1081	;;
1082
1083altq)
1084	mkdir altq 2>/dev/null
1085	chmod 755 altq
1086	unit=0
1087	for dev in altq cbq wfq afm fifoq red rio localq hfsc \
1088	    cdnr blue priq; do
1089		rm -f altq/$dev
1090		mknod altq/$dev c %altq_chr% $unit
1091		chmod 644 altq/$dev
1092		unit=$(($unit + 1))
1093	done
1094	;;
1095
1096isdn)
1097	rm -f isdn
1098	mknod isdn c %isdn_chr% 0
1099	chmod 600 isdn
1100	;;
1101
1102isdnctl)
1103	rm -f isdnctl
1104	mknod isdnctl c %isdnctl_chr% 0
1105	chmod 600 isdnctl
1106	;;
1107
1108isdnbchan*)
1109	unit=${i#isdnbchan}
1110	rm -f isdnbchan$unit
1111	mknod isdnbchan$unit c %isdnbchan_chr% $unit
1112	chmod 600 isdnbchan$unit
1113	;;
1114
1115isdnteld*)
1116	unit=${i#isdnteld}
1117	rm -f isdnteld$unit
1118	mknod isdnteld$unit c %isdntel_chr% $(($unit + 64))
1119	chmod 600 isdnteld$unit
1120	;;
1121
1122isdntel*)
1123	unit=${i#isdntel}
1124	rm -f isdntel$unit
1125	mknod isdntel$unit c %isdntel_chr% $unit
1126	chmod 600 isdntel$unit
1127	;;
1128
1129isdntrc*)
1130	unit=${i#isdntrc}
1131	rm -f isdntrc$unit
1132	mknod isdntrc$unit c %isdntrc_chr% $unit
1133	chmod 600 isdntrc$unit
1134	;;
1135
1136vmegen)
1137	makedev vmegen0 vmegen1 vmegen2 vmegen3
1138	;;
1139
1140vmegen*)
1141	unit=${i#vmegen}
1142	rm -f vmegen$unit
1143	mknod vmegen$unit c %vmegeneric_chr% $(($unit * 16 + 0))
1144	chmod 600 vmegen$unit
1145	;;
1146
1147wsfont)
1148	rm -f wsfont
1149	mknod wsfont c %wsfont_chr% 0
1150	chmod 600 wsfont
1151	;;
1152
1153cir*)
1154	unit=${i#cir}
1155	cir=cir$unit
1156	major=%cir_chr%
1157	rm -f $cir
1158	mknod $cir c $major $unit
1159	chmod 666 $cir
1160	;;
1161
1162irframe*)
1163	unit=${i#irframe}
1164	irframe=irframe$unit
1165	major=%irframe_chr%
1166	rm -f $irframe
1167	mknod $irframe c $major $unit
1168	chmod 600 $irframe
1169	;;
1170
1171fcom*)
1172	unit=${i#fcom}
1173	fcom=fcom$unit
1174	rm -f $fcom
1175	mknod $fcom c %fcom_chr% $unit
1176	chown uucp $fcom
1177	chmod 600 $fcom
1178	;;
1179
1180beep)
1181	rm -f beep
1182	mknod beep c %beep_chr% 0
1183	;;
1184
1185openfirm)
1186	rm -f openfirm
1187	mknod openfirm c %openfirm_chr% 0
1188	chmod 444 openfirm
1189	;;
1190
1191nvram)
1192	rm -f nvram
1193	mknod nvram c %nvram_chr% 0
1194	chmod 644 nvram
1195	;;
1196
1197rtc)
1198	mknod rtc c %rtc_chr% 0
1199	chmod 644 rtc
1200	;;
1201
1202clockctl)
1203	rm -f clockctl
1204	mknod clockctl c %clockctl_chr% 0
1205	chgrp ntpd clockctl
1206	chmod 660 clockctl
1207	;;
1208
1209nsmb)
1210	makedev nsmb0 nsmb1 nsmb2 nsmb3
1211	;;
1212
1213nsmb*)
1214	unit=${i#nsmb}
1215	nsmb=nsmb$unit
1216	major=%nsmb_chr%
1217	rm -f $nsmb
1218	mknod $nsmb c $major $unit
1219	chmod 644 $nsmb
1220	;;
1221
1222systrace)
1223	rm -f systrace
1224	mknod systrace c %systrace_chr% 0
1225	chmod 644 systrace
1226	;;
1227
1228kttcp)
1229	rm -f kttcp
1230	mknod kttcp c %kttcp_chr% 0
1231	chmod 600 kttcp
1232	;;
1233
1234dmoverio)
1235	rm -f dmoverio
1236	mknod dmoverio c %dmoverio_chr% 0
1237	chmod 644 dmoverio
1238	;;
1239
1240veriexec)
1241	rm -f veriexec
1242	mknod veriexec c %veriexec_chr% 0
1243	chmod 644 veriexec
1244	;;
1245
1246ttyv*)
1247	chr=%pc_chr%; unit=${i#ttyv}
1248	rm -f ttyv$unit
1249	mknod ttyv$unit c $chr $unit
1250	;;
1251
1252ttyv*)
1253	chr=%physcon_chr%; unit=${i#ttyv}
1254	rm -f ttyv$unit
1255	mknod ttyv$unit c $chr $unit
1256	;;
1257
1258arcpp*)
1259	chr=%arcpp_chr%; unit=${i#arcpp}
1260	mkdev arcpp$unit c $chr $unit
1261	;;
1262
1263par*)
1264	unit=${i#par};	chr=%par_chr%
1265	rm -f par$unit
1266	case $unit in
1267	0)
1268		mknod par$unit	c $chr $unit
1269		;;
1270	*)
1271		echo bad unit for par in: $i
1272		;;
1273	esac
1274	;;
1275
1276ite*|ttye*)
1277	case $i in
1278	ite*)	unit=${i#ite};;
1279	ttye*)	unit=${i#ttye};;
1280	esac
1281	chr=%ite_chr%
1282	rm -f ttye$unit ite*
1283	mknod ttye$unit	c $chr $unit
1284	;;
1285
1286pms*)
1287	name=pms
1288	major=%opms_chr%
1289	unit=${i#pms}
1290	rm -f $name$unit
1291	mknod $name$unit c $major $unit
1292	;;
1293
1294qms*)
1295	name=qms
1296	major=%qms_chr%
1297	unit=${i#qms}
1298	rm -f $name$unit
1299	mknod $name$unit c $major $unit
1300	;;
1301
1302lms*)
1303	name=lms
1304	major=%lms_chr%
1305	unit=${i#lms}
1306	rm -f $name$unit
1307	mknod $name$unit c $major $unit
1308	;;
1309
1310mms*)
1311	major=%mms_chr%
1312	unit=${i#mms}
1313	rm -f $name$unit
1314	mknod $name$unit c $major $unit
1315	;;
1316
1317mouse-*)
1318	case $i in
1319	mouse-pms*) name=pms;	unit=${i#mouse-pms};;
1320	mouse-qms*) name=qms;	unit=${i#mouse-qms};;
1321	esac
1322	ln -fs $name$unit mouse
1323	;;
1324
1325kbd)
1326	rm -f kbd
1327	mknod kbd c %kbd_chr% 0
1328	;;
1329
1330kbdctl)
1331	rm -f kbdctl
1332	mknod kbdctl c %kbd_chr% 1
1333	;;
1334
1335vidcconsole0)
1336	mknod vidcconsole0 c %vidcconsole_chr% 0
1337	chmod 640 vidcconsole0
1338	;;
1339
1340view*)
1341	unit=${i#view};	chr=%view_chr%
1342	rm -f view$unit
1343	mknod view$unit	c $chr $unit
1344	chmod 666 view$unit
1345	;;
1346
1347mouse*)
1348	unit=${i#mouse};	chr=%ms_chr%
1349	rm -f mouse$unit
1350	case $unit in
1351	0|1)
1352		mknod mouse$unit c	$chr $unit
1353		chmod 666 mouse$unit
1354		if [ $unit = 0 ]
1355		then
1356			ln -fs mouse$unit mouse
1357		fi
1358		;;
1359	*)
1360		echo bad unit for mouse in: $i
1361		;;
1362	esac
1363	;;
1364
1365panel)
1366	rm -f panel0
1367	mknod panel0 c %panel_chr% 0
1368	chmod 660 panel0
1369	;;
1370
1371ipty)
1372	rm -f ttyp0 ttyp1 ptyp0 ptyp1
1373	mknod ttyp0 c %pts_chr% 0
1374	mknod ttyp1 c %pts_chr% 1
1375	mknod ptyp0 c %ptc_chr% 0
1376	mknod ptyp1 c %ptc_chr% 1
1377	chmod 666 ttyp0 ttyp1 ptyp0 ptyp1
1378	;;
1379
1380grf*)
1381	major=%grf_chr%
1382	unit=${i#grf}
1383	rm -f grf${unit}
1384	mknod grf${unit} c ${major} ${unit}
1385	chmod 666 grf${unit}
1386	;;
1387
1388etvme)
1389	rm -f etvme
1390	mknod etvme c %et_chr% 0
1391	chmod 600 etvme
1392	;;
1393
1394leo*)
1395	unit=${i#leo}
1396	rm -f leo$unit
1397	mknod leo$unit c %leo_chr% $unit
1398	chmod 600 leo$unit
1399	;;
1400
1401scif*)
1402	chr=%scif_chr%; unit=${i#scif}
1403	name=scif
1404	rm -f $name$unit
1405	mknod $name$unit c $chr $unit
1406	chown uucp $name$unit
1407	;;
1408
1409sci*)
1410	chr=%sci_chr%; unit=${i#sci}
1411	name=sci
1412	rm -f $name$unit
1413	mknod $name$unit c $chr $unit
1414	chown uucp $name$unit
1415	;;
1416
1417maple*)
1418	chr=%maple_chr%
1419	case $i in
1420	mapleA*) name="mapleA"; unit=0;;
1421	mapleB*) name="mapleB"; unit=1;;
1422	mapleC*) name="mapleC"; unit=2;;
1423	mapleD*) name="mapleD"; unit=3;;
1424	esac
1425	subunit=${i#$name}
1426	rm -f $name$subunit
1427	mknod $name$subunit c $chr $(($unit * 8 + 0$subunit))
1428	chmod 600 $name$subunit
1429	;;
1430
1431mmem*)
1432	name=mmem;	unit=${i#mmem};	chr=%mmem_chr%;	blk=%mmem_blk%
1433	rm -f $name$unit.* r$name$unit.*
1434	for pt in 0	# 1 2 3 4 ... 255
1435	do
1436	#mknod ${name}${unit}.${pt}a	b $blk $(($unit * 4096 + $pt * 16 + 0))
1437	mknod ${name}${unit}.${pt}c	b $blk $(($unit * 4096 + $pt * 16 + 2))
1438	#mknod r${name}${unit}.${pt}a	c $chr $(($unit * 4096 + $pt * 16 + 0))
1439	mknod r${name}${unit}.${pt}c	c $chr $(($unit * 4096 + $pt * 16 + 2))
1440	done
1441	chgrp operator $name$unit.* r$name$unit.*
1442	chmod 640 $name$unit.* r$name$unit.*
1443	;;
1444
1445mlcd*)
1446	name=mlcd;	unit=${i#mlcd};	chr=%mlcd_chr%
1447	rm -f $name$unit.*
1448	for pt in 0	# 1 2 3 4 ... 255
1449	do
1450	mknod ${name}${unit}.${pt}	c $chr $(($unit * 256 + $pt))
1451	done
1452	chgrp operator $name$unit.*
1453	chmod 640 $name$unit.*
1454	;;
1455
1456ixpcom*)
1457	unit=${i#ixpcom}
1458	rm -f ixpcom$unit
1459	mknod ixpcom$unit c %ixpcom_chr% $unit
1460	chown uucp ixpcom$unit
1461	;;
1462
1463ucbsnd)
1464	rm -f ucbsnd
1465	mknod ucbsnd c %ucbsnd_chr% 0
1466	chmod 666 ucbsnd
1467	;;
1468
1469ttyTX*)
1470	unit=${i#ttyTX}
1471	name=ttyTX0
1472	dname=dtyTX0
1473
1474	rm -f $name$unit $dname$unit
1475	mknod $name$unit c %txcom_chr% $(($unit + $dialin ))
1476	mknod $dname$unit c %txcom_chr% $(($unit + $dialout))
1477	chown uucp $name$unit $dname$unit
1478	;;
1479
1480adb)
1481	rm -f adb
1482	mknod adb c %aed_chr% 0
1483	chmod 666 adb
1484	;;
1485
1486asc*)
1487	unit=${i#asc}
1488	rm -f asc$unit
1489	mknod asc$unit c %asc_chr% $unit
1490	chmod 666 asc$unit
1491	;;
1492
1493bwtwo*)
1494	unit=${i#bwtwo}
1495	rm -f bwtwo$unit
1496	mknod bwtwo$unit c %bwtwo_chr% $unit
1497	chmod 666 bwtwo$unit
1498	;;
1499
1500cgtwo*)
1501	unit=${i#cgtwo}
1502	rm -f cgtwo$unit
1503	mknod cgtwo$unit c %cgtwo_chr% $unit
1504	chmod 666 cgtwo$unit
1505	;;
1506
1507cgthree*)
1508	unit=${i#cgthree}
1509	rm -f cgthree$unit
1510	mknod cgthree$unit c %cgthree_chr% $unit
1511	chmod 666 cgthree$unit
1512	;;
1513
1514cgfour*)
1515	unit=${i#cgfour}
1516	rm -f cgfour$unit
1517	mknod cgfour$unit c %cgfour_chr% $unit
1518	chmod 666 cgfour$unit
1519	;;
1520
1521cgsix*)
1522	unit=${i#cgsix}
1523	rm -f cgsix$unit
1524	mknod cgsix$unit c %cgsix_chr% $unit
1525	chmod 666 cgsix$unit
1526	;;
1527
1528cgeight*)
1529	unit=${i#cgeight}
1530	rm -f cgeight$unit
1531	mknod cgeight$unit c %cgeight_chr% $unit
1532	chmod 666 cgeight$unit
1533	;;
1534
1535tcx*)
1536	unit=${i#tcx}
1537	rm -f tcx$unit
1538	mknod tcx$unit c %tcx_chr% $unit
1539	chmod 666 tcx$unit
1540	;;
1541
1542xd*|xy*)
1543	case $i in
1544	xd*)	name=xd; unit=${i#xd}; blk=%xd_blk%;	chr=%xd_chr%;;
1545	xy*)	name=xy; unit=${i#xy}; blk=%xy_blk%;	chr=%xy_chr%;;
1546	esac
1547	%MKDISK% $name $unit $blk $chr
1548	;;
1549
1550magma*)
1551	unit=${i#magma}
1552	if [ 0$unit -gt 3 ]
1553	then
1554		echo "bad unit for $i: $unit"
1555		break
1556	fi
1557
1558	rm -f tty$unit[0-9a-f] bpp$unit[01]
1559	for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f
1560	do
1561		case $j in
1562		[0-9])	jn=$j ;;
1563		a)	jn=10 ;;
1564		b)	jn=11 ;;
1565		c)	jn=12 ;;
1566		d)	jn=13 ;;
1567		e)	jn=14 ;;
1568		f)	jn=15 ;;
1569		esac
1570		mknod tty$unit$j c %mtty_chr% $(($unit * 64 + $jn))
1571	done
1572
1573	mknod bpp${unit}0 c %mbpp_chr% $(($unit * 64 + 0))
1574	mknod bpp${unit}1 c %mbpp_chr% $(($unit * 64 + 1))
1575	;;
1576
1577clcd*)
1578	unit=${i#clcd}
1579	if [ 0$unit -gt 7 ]
1580	then
1581		echo "bad unit for $i: $unit"
1582		break
1583	fi
1584
1585	rm -f ttyA$unit[0-7] dtyA$unit[0-7]
1586	for j in 0 1 2 3 4 5 6 7
1587	do
1588		mknod ttyA$unit$j c %clcd_chr% $(($unit * 8 + $j + $dialin))
1589		mknod dtyA$unit$j c %clcd_chr% $(($unit * 8 + $j + $dialout))
1590	done
1591	chown uucp ttyA$unit[0-9a-f] dtyA$unit[0-9a-f]
1592
1593	;;
1594
1595bpp*)
1596	unit=${i#bpp}
1597	rm -f bpp$unit
1598	mknod bpp$unit c %bpp_chr% $(($unit + 0))
1599	chmod 600 bpp$unit
1600	;;
1601
1602tctrl*)
1603	unit=${i#tctrl}
1604	rm -f tctrl$unit
1605	mknod tctrl$unit c %tctrl_chr% $unit
1606	chmod 666 tctrl$unit
1607	;;
1608
1609bmd*)
1610	unit=${i#bmd}; blk=%bmd_blk%; chr=%bmd_chr%
1611	rm -f bmd${unit}? rbmd${unit}?
1612	mknod bmd${unit}a  b $blk $(($unit * 8 + 0))
1613	mknod bmd${unit}c  b $blk $(($unit * 8 + 2))
1614	mknod rbmd${unit}a c $chr $(($unit * 8 + 0))
1615	mknod rbmd${unit}c c $chr $(($unit * 8 + 2))
1616	chgrp operator bmd${unit}? rbmd${unit}?
1617	chmod 640 bmd${unit}? rbmd${unit}?
1618	;;
1619
1620sram)
1621	rm -f sram
1622	mknod sram c %sram_chr% 0
1623	chmod 644 sram
1624	;;
1625
1626pow*)
1627	unit=${i#pow}
1628	rm -f pow${unit}
1629	case $unit in
1630	0|1)
1631		mknod pow${unit} c %pow_chr% ${unit}
1632		chmod 644 pow${unit}
1633		if [ $unit = 0 ]
1634		then
1635			ln -fs pow${unit} pow
1636		fi
1637		;;
1638	*)
1639		echo bad unit for pow in: $i
1640		;;
1641	esac
1642	;;
1643
1644ttyS*)
1645	unit=${i#ttyS}
1646	rm -f ttyS$unit dtyS$unit
1647	mknod ttyS$unit c %sacom_chr% $(($unit + $dialin ))
1648	mknod dtyS$unit c %sacom_chr% $(($unit + $dialout))
1649	chown uucp ttyS$unit dtyS$unit
1650	;;
1651
1652midevend)
1653%MI_DEVICES_END%
1654local)
1655	if [ -f "$0.local" ]; then
1656		umask 0
1657		sh $0.local all
1658		umask 077
1659	fi
1660	;;
1661
1662*)
1663	echo $i: unknown device
1664	;;
1665
1666esac
1667done
1668
1669}
1670
1671# three variants of disk partitions - max 8, max 16, max 16 with highpartoffset
1672# hack; only the one used by port is retained in final MAKEDEV script
1673# routine is called as:
1674# makedisk name unit blk chr
1675makedisk_p8() {
1676	name="$1"; unit="$2"; blk="$3"; chr="$4"
1677
1678	rm -f $name$unit? r$name$unit?
1679	mknod ${name}${unit}a	b $blk $(($unit * 8 + 0))
1680	mknod ${name}${unit}b	b $blk $(($unit * 8 + 1))
1681	mknod ${name}${unit}c	b $blk $(($unit * 8 + 2))
1682	mknod ${name}${unit}d	b $blk $(($unit * 8 + 3))
1683	mknod ${name}${unit}e	b $blk $(($unit * 8 + 4))
1684	mknod ${name}${unit}f	b $blk $(($unit * 8 + 5))
1685	mknod ${name}${unit}g	b $blk $(($unit * 8 + 6))
1686	mknod ${name}${unit}h	b $blk $(($unit * 8 + 7))
1687	mknod r${name}${unit}a	c $chr $(($unit * 8 + 0))
1688	mknod r${name}${unit}b	c $chr $(($unit * 8 + 1))
1689	mknod r${name}${unit}c	c $chr $(($unit * 8 + 2))
1690	mknod r${name}${unit}d	c $chr $(($unit * 8 + 3))
1691	mknod r${name}${unit}e	c $chr $(($unit * 8 + 4))
1692	mknod r${name}${unit}f	c $chr $(($unit * 8 + 5))
1693	mknod r${name}${unit}g	c $chr $(($unit * 8 + 6))
1694	mknod r${name}${unit}h	c $chr $(($unit * 8 + 7))
1695	chgrp operator $name$unit? r$name$unit?
1696	chmod 640 $name$unit? r$name$unit?
1697}
1698makedisk_p16() {
1699	name="$1"; unit="$2"; blk="$3"; chr="$4"
1700
1701	rm -f $name$unit? r$name$unit?
1702	mknod ${name}${unit}a	b $blk $(($unit * 16 + 0))
1703	mknod ${name}${unit}b	b $blk $(($unit * 16 + 1))
1704	mknod ${name}${unit}c	b $blk $(($unit * 16 + 2))
1705	mknod ${name}${unit}d	b $blk $(($unit * 16 + 3))
1706	mknod ${name}${unit}e	b $blk $(($unit * 16 + 4))
1707	mknod ${name}${unit}f	b $blk $(($unit * 16 + 5))
1708	mknod ${name}${unit}g	b $blk $(($unit * 16 + 6))
1709	mknod ${name}${unit}h	b $blk $(($unit * 16 + 7))
1710	mknod ${name}${unit}i	b $blk $(($unit * 16 + 8))
1711	mknod ${name}${unit}j	b $blk $(($unit * 16 + 9))
1712	mknod ${name}${unit}k	b $blk $(($unit * 16 + 10))
1713	mknod ${name}${unit}l	b $blk $(($unit * 16 + 11))
1714	mknod ${name}${unit}m	b $blk $(($unit * 16 + 12))
1715	mknod ${name}${unit}n	b $blk $(($unit * 16 + 13))
1716	mknod ${name}${unit}o	b $blk $(($unit * 16 + 14))
1717	mknod ${name}${unit}p	b $blk $(($unit * 16 + 15))
1718	mknod r${name}${unit}a	c $chr $(($unit * 16 + 0))
1719	mknod r${name}${unit}b	c $chr $(($unit * 16 + 1))
1720	mknod r${name}${unit}c	c $chr $(($unit * 16 + 2))
1721	mknod r${name}${unit}d	c $chr $(($unit * 16 + 3))
1722	mknod r${name}${unit}e	c $chr $(($unit * 16 + 4))
1723	mknod r${name}${unit}f	c $chr $(($unit * 16 + 5))
1724	mknod r${name}${unit}g	c $chr $(($unit * 16 + 6))
1725	mknod r${name}${unit}h	c $chr $(($unit * 16 + 7))
1726	mknod r${name}${unit}i	c $chr $(($unit * 16 + 8))
1727	mknod r${name}${unit}j	c $chr $(($unit * 16 + 9))
1728	mknod r${name}${unit}k	c $chr $(($unit * 16 + 10))
1729	mknod r${name}${unit}l	c $chr $(($unit * 16 + 11))
1730	mknod r${name}${unit}m	c $chr $(($unit * 16 + 12))
1731	mknod r${name}${unit}n	c $chr $(($unit * 16 + 13))
1732	mknod r${name}${unit}o	c $chr $(($unit * 16 + 14))
1733	mknod r${name}${unit}p	c $chr $(($unit * 16 + 15))
1734	chgrp operator $name$unit? r$name$unit?
1735	chmod 640 $name$unit? r$name$unit?
1736}
1737makedisk_p16high() {
1738	highpartoffset=524280	# offset for partition 9 to 16
1739	name="$1"; unit="$2"; blk="$3"; chr="$4"
1740
1741	rm -f $name$unit? r$name$unit?
1742	mknod ${name}${unit}a	b $blk $(($unit * 8 + 0))
1743	mknod ${name}${unit}b	b $blk $(($unit * 8 + 1))
1744	mknod ${name}${unit}c	b $blk $(($unit * 8 + 2))
1745	mknod ${name}${unit}d	b $blk $(($unit * 8 + 3))
1746	mknod ${name}${unit}e	b $blk $(($unit * 8 + 4))
1747	mknod ${name}${unit}f	b $blk $(($unit * 8 + 5))
1748	mknod ${name}${unit}g	b $blk $(($unit * 8 + 6))
1749	mknod ${name}${unit}h	b $blk $(($unit * 8 + 7))
1750	mknod ${name}${unit}i	b $blk $(($unit * 8 + $highpartoffset + 8))
1751	mknod ${name}${unit}j	b $blk $(($unit * 8 + $highpartoffset + 9))
1752	mknod ${name}${unit}k	b $blk $(($unit * 8 + $highpartoffset + 10))
1753	mknod ${name}${unit}l	b $blk $(($unit * 8 + $highpartoffset + 11))
1754	mknod ${name}${unit}m	b $blk $(($unit * 8 + $highpartoffset + 12))
1755	mknod ${name}${unit}n	b $blk $(($unit * 8 + $highpartoffset + 13))
1756	mknod ${name}${unit}o	b $blk $(($unit * 8 + $highpartoffset + 14))
1757	mknod ${name}${unit}p	b $blk $(($unit * 8 + $highpartoffset + 15))
1758	mknod r${name}${unit}a	c $chr $(($unit * 8 + 0))
1759	mknod r${name}${unit}b	c $chr $(($unit * 8 + 1))
1760	mknod r${name}${unit}c	c $chr $(($unit * 8 + 2))
1761	mknod r${name}${unit}d	c $chr $(($unit * 8 + 3))
1762	mknod r${name}${unit}e	c $chr $(($unit * 8 + 4))
1763	mknod r${name}${unit}f	c $chr $(($unit * 8 + 5))
1764	mknod r${name}${unit}g	c $chr $(($unit * 8 + 6))
1765	mknod r${name}${unit}h	c $chr $(($unit * 8 + 7))
1766	mknod r${name}${unit}i	c $chr $(($unit * 8 + $highpartoffset + 8))
1767	mknod r${name}${unit}j	c $chr $(($unit * 8 + $highpartoffset + 9))
1768	mknod r${name}${unit}k	c $chr $(($unit * 8 + $highpartoffset + 10))
1769	mknod r${name}${unit}l	c $chr $(($unit * 8 + $highpartoffset + 11))
1770	mknod r${name}${unit}m	c $chr $(($unit * 8 + $highpartoffset + 12))
1771	mknod r${name}${unit}n	c $chr $(($unit * 8 + $highpartoffset + 13))
1772	mknod r${name}${unit}o	c $chr $(($unit * 8 + $highpartoffset + 14))
1773	mknod r${name}${unit}p	c $chr $(($unit * 8 + $highpartoffset + 15))
1774	chgrp operator $name$unit? r$name$unit?
1775	chmod 640 $name$unit? r$name$unit?
1776}
1777
1778# make only the very few basic disk device nodes - 'a' partition
1779# and raw partition
1780makedisk_minimal() {
1781	name=$1; unit=$2; blk=$3; chr=$4
1782	doff=%DISKMINOROFFSET%
1783	ro=%RAWDISK_OFF%; rn=%RAWDISK_NAME%
1784
1785	rm -f $name$unit? r$name$unit?
1786	mknod ${name}${unit}a		b $blk $(($unit * $doff + 0))
1787	mknod ${name}${unit}$rn		b $blk $(($unit * $doff + $ro))
1788	mknod r${name}${unit}a		c $chr $(($unit * $doff + 0))
1789	mknod r${name}${unit}$rn	c $chr $(($unit * $doff + $ro))
1790	chgrp operator $name$unit? r$name$unit?
1791	chmod 640 $name$unit? r$name$unit?
1792}
1793
1794makedev $*
1795