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