Subject: Re: MAKEDEV.awk expert, help?
To: Jun-ichiro itojun Hagino <itojun@itojun.org>
From: Jaromir Dolecek <jdolecek@NetBSD.org>
List: tech-kern
Date: 02/11/2004 22:23:42
Jun-ichiro itojun Hagino wrote:
> 	on i386, MAKEDEV.awk does not generate altq) entry, and "MAKEDEV all"
> 	fails.  MAKEDEV.awk expert please take a look at PR 24376?

Strange, it works just fine for me, the generated MAKEDEV does have
altq entry. For reference, mine MAKEDEV looks like:

#!/bin/sh -
#
# Generated from:
#	NetBSD: MAKEDEV.awk,v 1.12 2004/01/14 20:37:51 jdolecek Exp 
#	NetBSD: MAKEDEV.tmpl,v 1.21 2004/02/03 21:43:43 jdolecek Exp 
#	NetBSD: etc.i386/MAKEDEV.conf,v 1.2 2003/10/19 19:07:27 jdolecek Exp 
#
# Copyright (c) 2003 The NetBSD Foundation, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
#        This product includes software developed by the NetBSD
#        Foundation, Inc. and its contributors.
# 4. Neither the name of The NetBSD Foundation nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#
###########################################################################
#
#
# Device "make" file.  Valid special arguments:
#	all	makes all known devices, including local devices.
#		Tries to make the 'standard' number of each type.
#	init	A set of devices that is used for MFS /dev by init.
#		May be equal to "all".
#	floppy	devices to be put on install floppies
#	ramdisk	devices to be put into INSTALL kernel ramdisks.
#	std	standard devices
#	local	configuration specific devices
#	wscons	make wscons devices
#	usbs	make USB devices
#	isdns	make ISDN devices
#

PATH=/sbin:/usr/sbin:/bin:/usr/bin:/rescue


usage()
{
	cat 1>&2 << _USAGE_
Usage: ${0##*/} [-f] [-m mknod] [-s]  special [...]
	Create listed special devices.  Options:
	-f		Force permissions to be updated on existing devices.
	-m mknod	Name of mknod(8) program.  [\$TOOL_MKNOD or mknod]
	-s		Generate mtree(8) specfile instead of creating devices.

_USAGE_
	exit 1
}

do_force=false
do_specfile=false
while getopts fm:s ch; do
	case ${ch} in
	f)	do_force=true ;;
	m)	TOOL_MKNOD=${OPTARG} ;;
	s)	do_specfile=true ;;
	*)	usage ;;
	esac
done
shift $((${OPTIND} - 1))
[ $# -gt 0 ] || usage


MKNOD="${TOOL_MKNOD:-mknod} -F netbsd"
if ! $do_force; then
	MKNOD="${MKNOD} -r"
fi

u_root="0"
u_uucp="66"
g_kmem="2"
g_ntpd="15"
g_operator="5"
g_wheel="0"
dialin=0
dialout=524288
callunit=262144

# only allow read&write for owner by default
umask 077

# Check if we have fdesc mounted
if [ -d fd ]; then
        case "`df fd`" in
        *fdesc*)	nofdesc=false;;
        *)		nofdesc=true;;
        esac
else
        nofdesc=true
fi


if $do_specfile; then
	echo ". type=dir"
fi


#
# functions available to create nodes:
#
# mkdev name [b|c] major minor [mode{=600} [gid{=0} [uid{=0}]]]
#	create device node `name' with the appropriate permissions
#
# lndev src target
#	create a symlink from src to target
#
# makedir dir mode
#	create directory with appropriate mode
#

mkdev()
{
	if $do_specfile; then
		case $2 in
		b)	type=block ;;
		c)	type=char ;;
		esac
		echo "./$1 type=${type} device=netbsd,$3,$4 mode=${5:-600} gid=${6:-$g_wheel} uid=${7:-$u_root}"
	else
		${MKNOD} -m ${5:-600} -g \#${6:-$g_wheel} -u \#${7:-$u_root} $1 $2 $3 $4
	fi
}

lndev()
{
	if $do_specfile; then
		echo "./$2 type=link link=$1 mode=0700 gid=$g_wheel uid=$u_root"
	else
		ln -f -s $1 $2
	fi
}

makedir()
{
	if $do_specfile; then
		echo "./$1 type=dir mode=$2 gid=$g_wheel uid=$u_root"
	else
		mkdir $1 2>/dev/null
		chmod $2 $1
	fi
}

warn()
{
	echo 1>&2 "$0: $*"
}



# makedev special [...]
#	the main loop
#

makedev()
{

for i
do

case $i in

# As of 2003-04-17, the "init" case must not create more than 890 entries.
init)
	makedev std wscons wt0 fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 sd4
	makedev tty0 tty1
	makedev st0 st1 ch0 cd0 cd1 mcd0 vnd0
	makedev bpf0
	makedev ccd0 md0 ch0 random
	makedev cgd0 cgd1
	makedev iop0 mlx0 mly0 dpti0 dpt0 twe0 icp0
	makedev ed0 ed1
	makedev raid0
	makedev ld0 ld1 ld2 ld3
	makedev usbs
	makedev ipty
	makedev local
	;;

all_md)
	makedev init
	makedev tty2 tty3
	makedev lpa0 lpa1 lpa2
	makedev lpt0 lpt1 lpt2
	makedev ss0 uk0 uk1
	makedev speaker joy0 joy1
	makedev apm satlink0
	makedev audio
	makedev radio
	makedev isdns
	makedev music rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7
	makedev scsibus0 scsibus1 scsibus2 scsibus3
	makedev sysmon
	makedev bktr
	makedev ttyCZ0 ttyCY0
	makedev agp0
	makedev pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7
	makedev altq
	makedev cir0 cir1 irframe0 irframe1
	makedev dmoverio
	makedev kttcp
	makedev nsmb
	;;

floppy)
	makedev std wt0 fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3 sd4 st0 st1
	makedev tty0 tty1 tty2 cd0 cd1 mcd0 ttyv0 opty ld0 ld1 ld2 ld3 ed0 ed1
	;;

ramdisk)
	makedev floppy md0
	;;

all)
	makedev all_md
	makedev std fd pty0
	makedev ccd0 ccd1 ccd2 ccd3
	makedev cgd0 cgd1 cgd2 cgd3
	makedev fss0 fss1 fss2 fss3
	makedev md0 md1
	makedev raid0 raid1 raid2 raid3 raid4 raid5 raid6 raid7
	makedev vnd0 vnd1 vnd2 vnd3
	makedev bpf0 bpf1 bpf2 bpf3 bpf4 bpf5 bpf6 bpf7
	makedev tun0 tun1 tun2 tun3
	makedev ipl crypto random systrace
	makedev lkm clockctl
	makedev local
	;;

init)
	# unless overridden by MD entry, this is equal to 'all'
	makedev all
	;;

audio)
	makedev audio0 audio1 audio2 audio3
	lndev sound0 sound
	lndev audio0 audio
	lndev mixer0 mixer
	lndev audioctl0 audioctl
	;;

radio)
	makedev radio0 radio1
	lndev radio0 radio
	;;

ramdisk)
	makedev floppy md0
	;;

usbs)
	makedev usb usb0 usb1 usb2 usb3 usb4 usb5 usb6 usb7
	makedev uhid0 uhid1 uhid2 uhid3
	makedev ulpt0 ulpt1
	makedev ttyU0 ttyU1
	makedev urio0
	makedev uscanner0 uscanner1
	makedev ugen0
	;;

isdns)
	makedev isdn isdnctl isdnbchan0 isdnbchan1 isdntel0 isdntel1 isdnteld0 isdnteld1 isdntrc0 isdntrc1
	;;

std)
	mkdev		console	c 0 0	600
	mkdev		constty	c 0 1	600
	mkdev		drum	c 4 0	640 $g_kmem
	mkdev		kmem	c 2 1	640 $g_kmem
	mkdev		mem	c 2 0	640 $g_kmem
	mkdev		null	c 2 2	666
	mkdev		zero	c 2 12	666
	mkdev		klog	c 7 0	600
	mkdev		ksyms	c 101 0	444
	if $nofdesc; then
		mkdev	tty	c 1 0		666
		mkdev	stdin	c 22 0	666
		mkdev	stdout	c 22 1	666
		mkdev	stderr	c 22 2	666
	fi
	;;

usb*)
	unit=${i#usb}
	if [ "$unit" = "" ]; then
		unit=255
		usb=usb
	else
		usb=usb$unit
	fi
	mkdev $usb c 55 $unit
	;;

uhid*)
	unit=${i#uhid}
	mkdev uhid$unit c 56 $unit 666
	;;

ulpt*)
	unit=${i#ulpt}
	mkdev ulpt$unit c 57 $unit
	mkdev ulpn$unit c 57 $(($unit + 64))
	;;

urio*)
	unit=${i#urio}
	mkdev urio$unit c 70 $unit 666
	;;

uscanner*)
	unit=${i#uscanner}
	mkdev uscanner$unit c 75 $unit
	;;

ttyU*)
	unit=${i#ttyU}
	mkdev ttyU$unit c 66 $(($unit + $dialin  )) "" "" $u_uucp
	mkdev dtyU$unit c 66 $(($unit + $dialout )) "" "" $u_uucp
	mkdev ctyU$unit c 66 $(($unit + $callunit)) "" "" $u_uucp
	;;

ugen*)
	unit=${i#ugen}
	for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
	do
		mkdev ugen$unit.$j c 64 $(($unit * 16 + ${j#0}))
	done
	;;

wscons)
	makedev ttyE0 ttyE1 ttyE2 ttyE3 ttyE4 ttyE5 ttyE6 ttyE7
	makedev wsmouse0 wsmouse1 wsmouse2 wsmouse3
	makedev wskbd0 wskbd1 wskbd2 wskbd3
	makedev wsmux0 wsmux1 wsmux2 wsmux3
	makedev wsmouse wskbd
	makedev ttyEcfg ttyEstat
	makedev wsfont
	;;

wsmouse)
	mkdev wsmouse c 65 0
	;;

wskbd)
	mkdev wskbd c 65 1
	;;

wsmux*)
	unit=${i#wsmux}
	mkdev wsmux$unit    c 65 $unit
	mkdev wsmuxctl$unit c 65 $(($unit + 128)) 200
	;;

ttyEstat)
	mkdev ttyEstat c 47 254
	;;

ttyEcfg)
	mkdev ttyEcfg c 47 255
	;;

ttyE*)
	unit=${i#ttyE}
	mkdev ttyE$unit c 47 $unit
	;;

wsmouse*)
	unit=${i#wsmouse}
	mkdev wsmouse$unit c 49 $unit
	;;

wskbd*)
	unit=${i#wskbd}
	mkdev wskbd$unit c 48 $unit
	;;

fd)
	if $nofdesc; then
		makedir fd 755
		n=0
		while [ $n -lt 64 ]
		do
			mkdev fd/$n c 22 $n 666
			n=$(($n + 1))
		done
	fi
	;;

wt*)
	case $i in
	wt*) name=wt;  unit=${i#wt};	chr=10;	blk=3;;
	esac
	for sub in $unit $(($unit+8)) $(($unit+16))
	do
		mkdev $name$sub		b $blk $(($sub + 0)) 660 $g_operator
		mkdev n$name$sub	b $blk $(($sub + 4)) 660 $g_operator
		mkdev r$name$sub	c $chr $(($sub + 0)) 660 $g_operator
		mkdev nr$name$sub	c $chr $(($sub + 4)) 660 $g_operator
	done
	;;

md*)
	makedisk_minimal md ${i#md} 17 24
	;;

fss*)
	case $i in
	fss*) name=fss; unit=${i#fss};	blk=163;	chr=163
	esac
	mkdev $name$unit	b $blk $unit 660 $g_operator
	mkdev r$name$unit	c $chr $unit 660 $g_operator
	;;

ss*)
	case $i in
	ss*) name=ss;	unit=${i#ss};	chr=19;;
	esac
	mkdev $name$unit	c $chr $(($unit * 16 + 0)) 640 $g_operator
	mkdev n$name$unit	c $chr $(($unit * 16 + 1)) 640 $g_operator
	mkdev en$name$unit	c $chr $(($unit * 16 + 3)) 640 $g_operator
	;;

ccd*|cgd*|raid*|vnd*)
	case $i in
	ccd*)	name=ccd;	unit=${i#ccd};	blk=16;	chr=18;;
	cgd*)	name=cgd;	unit=${i#cgd};	blk=21;	chr=93;;
	raid*)	name=raid;	unit=${i#raid}; blk=18; chr=62;;
	vnd*)	name=vnd;	unit=${i#vnd};	blk=14;	chr=41;;
	esac
	makedisk_p16high $name $unit $blk $chr
	;;

sd*)
	name=sd; unit=${i#sd};	blk=4;	chr=13
	makedisk_p16high $name $unit $blk $chr
	;;

wd*)
	name=wd; unit=${i#wd}; blk=0; chr=3
	makedisk_p16high $name $unit $blk $chr
	;;

fd*)
	name=fd; unit=${i#fd}; blk=2; chr=9
	makedisk_p16high $name $unit $blk $chr
	;;

ld*)
	name=ld; unit=${i#ld}; blk=19; chr=69
	makedisk_p16high $name $unit $blk $chr
	;;

ed*)
	name=ed; unit=${i#ed}; blk=20; chr=79
	makedisk_p16high $name $unit $blk $chr
	;;

ttyCY*)
	name=tyCY; chr=38; off=32; fmt="%03d"
	unit=${i#t${name}}
	minor=$(($unit * $off))
	eminor=$(($minor + $off))
	while [ $minor -lt $eminor ]
	do
		nminor=$(printf $fmt $minor)
		mkdev t$name$nminor c $chr $(($minor + $dialin )) "" "" $u_uucp
		mkdev d$name$nminor c $chr $(($minor + $dialout)) "" "" $u_uucp
		minor=$(($minor + 1))
	done
	;;

ttyCZ*)
	name=tyCZ; chr=73; off=64; fmt="%04d"
	unit=${i#t${name}}
	minor=$(($unit * $off))
	eminor=$(($minor + $off))
	while [ $minor -lt $eminor ]
	do
		nminor=$(printf $fmt $minor)
		mkdev t$name$nminor c $chr $(($minor + $dialin )) "" "" $u_uucp
		mkdev d$name$nminor c $chr $(($minor + $dialout)) "" "" $u_uucp
		minor=$(($minor + 1))
	done
	;;


tty0*|tty1*|tty[0-9])
	unit=${i#tty}
	ounit=$(printf "%02d" $unit)
	mkdev tty$ounit c 8 $(($unit + $dialin )) "" "" $u_uucp
	mkdev dty$ounit c 8 $(($unit + $dialout)) "" "" $u_uucp
	;;

ttyC*)
		# some archs call com_chr ttyC traditionally
	unit=${i#ttyC}; name=ttyC; dname=dtyC; chr=8
	mkdev  $name$unit c $chr $(($unit + $dialin )) "" "" $u_uucp
	mkdev $dname$unit c $chr $(($unit + $dialout)) "" "" $u_uucp
	;;

opty)
	for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f
	do
		case $j in
		[0-9])	jn=$j ;;
		a)	jn=10 ;;
		b)	jn=11 ;;
		c)	jn=12 ;;
		d)	jn=13 ;;
		e)	jn=14 ;;
		f)	jn=15 ;;
		esac
		mkdev ttyp$j c 5 $jn 666
		mkdev ptyp$j c 6 $jn 666
	done
	;;

pty*)
	class=${i#pty}
	set -- p q r s t u v w x y z P Q R S T
	if [ "$class" -ge $# ]; then
		warn "$i: pty unit must be between 0 and 15"
		continue
	fi
	shift $class
	name=$1
	if [ "$name" = v ]; then
		warn "$i: pty unit conflicts with console ttyv0 device"
		continue
	fi
	jn=0
	unit=$(($class * 16))
	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
	while
		shift
		j=$1
		[ -n "$j" ]
	do
		if [ $j = g ]; then
			unit=$(($unit + $class * 30 + 256 - 16))
		fi
		mkdev tty$name$j c 5 $unit 666
		mkdev pty$name$j c 6 $unit 666
		unit=$(($unit + 1))
	done
	;;

st*)
	case $i in
	st*) name=st;	unit=${i#st};	chr=14;	blk=5;;
	esac
	mkdev $name$unit	b $blk $(($unit * 16 + 0)) 660 $g_operator
	mkdev n$name$unit	b $blk $(($unit * 16 + 1)) 660 $g_operator
	mkdev e$name$unit	b $blk $(($unit * 16 + 2)) 660 $g_operator
	mkdev en$name$unit	b $blk $(($unit * 16 + 3)) 660 $g_operator
	mkdev r$name$unit	c $chr $(($unit * 16 + 0)) 660 $g_operator
	mkdev nr$name$unit	c $chr $(($unit * 16 + 1)) 660 $g_operator
	mkdev er$name$unit	c $chr $(($unit * 16 + 2)) 660 $g_operator
	mkdev enr$name$unit	c $chr $(($unit * 16 + 3)) 660 $g_operator
	;;

ses*|ch*|uk*)
	case $i in
	ch*)	name=ch;	unit=${i#ch};	chr=17;;
	uk*)	name=uk;	unit=${i#uk};	chr=20;;
	ses*)	name=ses;	unit=${i#ses};	chr=74;;
	esac
	mkdev $name$unit c $chr $unit 640 $g_operator
	;;

cd*)
	makedisk_minimal cd ${i#cd} 6 15 %
	;;

mcd*)
	makedisk_minimal mcd ${i#mcd} 7 39
	;;

lpt*|lpa*)
	case $i in
	lpt*) name=lpt;	unit=${i#lpt};	chr=16;	flags=0;;
	lpa*) name=lpa;	unit=${i#lpa};	chr=16;	flags=128;;
	esac
	mkdev $name$unit c $chr $(($unit + $flags))
	mkdev lpt${unit}ctl c $chr $(($unit + 256))
	;;

bpf*|tun*)
	case $i in
	bpf*) name=bpf;	unit=${i#bpf};	chr=23;;
	tun*) name=tun;	unit=${i#tun};	chr=40;;
	esac
	mkdev $name$unit c $chr $unit
	;;

joy*)
	case $i in
	joy*) name=joy;	unit=${i#joy};	chr=26;;
	esac
	mkdev $name$unit c $chr $unit
	;;

ipl)
	mkdev ipl	c 44 0
	mkdev ipnat	c 44 1
	mkdev ipstate	c 44 2
	mkdev ipauth	c 44 3
	;;

pf)
	mkdev pf c 161 0
	;;

crypto)
	mkdev crypto c 160 0 666
	;;

speaker)
	mkdev speaker c 27 0
	;;

lkm)
	mkdev lkm c 28 0 640 $g_kmem
	;;

audio*)
	unit=${i#audio}
	audio=audio$unit
	sound=sound$unit
	mixer=mixer$unit
	audioctl=audioctl$unit
	: ${unit:-0}
	mkdev $sound    c 42 $(($unit + 0))	666
	mkdev $audio    c 42 $(($unit + 128))	666
	mkdev $mixer    c 42 $(($unit + 16))	666
	mkdev $audioctl c 42 $(($unit + 192))	666
	;;

rmidi*)
	unit=${i#rmidi}
	mkdev rmidi$unit c 58 $unit 666
	;;

music*)
	unit=${i#music}
	: ${unit:-0}
	mkdev music$unit     c 59 $(($unit + 0))	666
	mkdev sequencer$unit c 59 $(($unit + 128))	666
	;;

radio*)
	unit=${i#radio}
	: ${unit:-0}
	mkdev radio$unit c 87 $unit 666
	;;

apm)
	mkdev apm	c 21 0 644
	mkdev apmctl	c 21 8 644
	;;

satlink*)
	unit=${i#satlink}
	mkdev satlink$unit c 45 $unit 444
	;;

random)
	mkdev random	c 46 0 444
	mkdev urandom	c 46 1 644
	;;

cfs*)
	unit=${i#cfs}
	mkdev cfs$unit c 60 $unit
	;;

sysmon)
	mkdev sysmon	c 67 0 644
	mkdev watchdog	c 67 1 644
	mkdev power	c 67 2 640
	;;

scsibus*)
	unit=${i#scsibus}
	mkdev scsibus$unit c 61 $unit 644
	;;

bktr)
	makedev bktr0 bktr1
	lndev	bktr0	bktr
	lndev	tuner0	tuner
	lndev	vbi0	vbi
	;;

bktr*)
	unit=${i#bktr}
	mkdev bktr$unit		c 71 $(($unit + 0))	444
	mkdev tuner$unit	c 71 $(($unit + 16))	444
	mkdev vbi$unit		c 71 $(($unit + 32))	444
	;;

iop*)
	unit=${i#iop}
	mkdev iop$unit c 76 $unit
	;;

mlx*)
	unit=${i#mlx}
	mkdev mlx$unit c 78 $unit
	;;

mly*)
	unit=${i#mly}
	mkdev mly$unit c 80 $unit
	;;

twe*)
	unit=${i#twe}
	mkdev twe$unit c 97 $unit
	;;

icp*)
	unit=${i#icp}
	mkdev icp$unit c 102 $unit
	;;

agp*)
	unit=${i#agp}
	mkdev agp$unit c 82 $unit 644
	if [ "$unit" = "0" ]; then
		lndev agp$unit agpgart
	fi
	;;

pci*)
	unit=${i#pci}
	mkdev pci$unit c 83 $unit 644
	;;

dpti*)
	unit=${i#dpti}
	mkdev dpti$unit c 84 $unit
	;;

dpt*)
	unit=${i#dpt}
	mkdev dpt$unit c 96 $unit
	;;

altq)
	makedir altq 755
	unit=0
	for dev in altq cbq wfq afm fifoq red rio localq hfsc cdnr blue priq
	do
		mkdev altq/$dev c 77 $unit 644
		unit=$(($unit + 1))
	done
	;;

isdn)
	mkdev isdn c 50 0
	;;

isdnctl)
	mkdev isdnctl c 51 0
	;;

isdnbchan*)
	unit=${i#isdnbchan}
	mkdev isdnbchan$unit c 52 $unit
	;;

isdnteld*)
	unit=${i#isdnteld}
	mkdev isdnteld$unit c 54 $(($unit + 64))
	;;

isdntel*)
	unit=${i#isdntel}
	mkdev isdntel$unit c 54 $unit
	;;

isdntrc*)
	unit=${i#isdntrc}
	mkdev isdntrc$unit c 53 $unit
	;;

vmegen)
	makedev vmegen0 vmegen1 vmegen2 vmegen3
	;;

vmegen*)
	unit=${i#vmegen}
	mkdev vmegen$unit c 68 $(($unit * 16 + 0))
	;;

wsfont)
	mkdev wsfont c 81 0
	;;

cir*)
	unit=${i#cir}
	mkdev cir$unit c 86 $unit 666
	;;

irframe*)
	unit=${i#irframe}
	mkdev irframe$unit c 85 $unit
	;;

clockctl)
	mkdev clockctl c 89 0 660 $g_ntpd
	;;

nsmb)
	makedev nsmb0 nsmb1 nsmb2 nsmb3
	;;

nsmb*)
	unit=${i#nsmb}
	mkdev nsmb$unit c 98 $unit 644
	;;

systrace)
	mkdev systrace c 90 0 644
	;;

kttcp)
	mkdev kttcp c 91 0
	;;

dmoverio)
	mkdev dmoverio c 92 0 644
	;;

ttyv*)
	unit=${i#ttyv}
	mkdev ttyv$unit c 12 $unit
	;;

# arm, acorn32
mouse-*)
	case $i in
	mouse-pms*) name=pms ;;
	mouse-qms*) name=qms ;;
	esac
	unit=${i#mouse-${name}}
	lndev $name$unit mouse
	;;

ipty)
	mkdev ttyp0 c 5 0 666
	mkdev ttyp1 c 5 1 666
	mkdev ptyp0 c 6 0 666
	mkdev ptyp1 c 6 1 666
	;;

local)
	if [ -f "$0.local" ]; then
		umask 0
		sh $0.local all
		umask 077
	fi
	;;

*)
	warn "$i: unknown device"
	;;

esac
done

}


# three variants of disk partitions - max 8, max 16, max 16 with highpartoffset
# hack; only the one used by port is retained in final MAKEDEV script
# routine is called as:
# makedisk name unit blk chr
makedisk_p8()
{
	name="$1"; unit="$2"; blk="$3"; chr="$4"

	mkdev ${name}${unit}a	b $blk $(($unit * 8 + 0))	640 $g_operator
	mkdev ${name}${unit}b	b $blk $(($unit * 8 + 1))	640 $g_operator
	mkdev ${name}${unit}c	b $blk $(($unit * 8 + 2))	640 $g_operator
	mkdev ${name}${unit}d	b $blk $(($unit * 8 + 3))	640 $g_operator
	mkdev ${name}${unit}e	b $blk $(($unit * 8 + 4))	640 $g_operator
	mkdev ${name}${unit}f	b $blk $(($unit * 8 + 5))	640 $g_operator
	mkdev ${name}${unit}g	b $blk $(($unit * 8 + 6))	640 $g_operator
	mkdev ${name}${unit}h	b $blk $(($unit * 8 + 7))	640 $g_operator
	mkdev r${name}${unit}a	c $chr $(($unit * 8 + 0))	640 $g_operator
	mkdev r${name}${unit}b	c $chr $(($unit * 8 + 1))	640 $g_operator
	mkdev r${name}${unit}c	c $chr $(($unit * 8 + 2))	640 $g_operator
	mkdev r${name}${unit}d	c $chr $(($unit * 8 + 3))	640 $g_operator
	mkdev r${name}${unit}e	c $chr $(($unit * 8 + 4))	640 $g_operator
	mkdev r${name}${unit}f	c $chr $(($unit * 8 + 5))	640 $g_operator
	mkdev r${name}${unit}g	c $chr $(($unit * 8 + 6))	640 $g_operator
	mkdev r${name}${unit}h	c $chr $(($unit * 8 + 7))	640 $g_operator
}

makedisk_p16()
{
	name="$1"; unit="$2"; blk="$3"; chr="$4"

	mkdev ${name}${unit}a	b $blk $(($unit * 16 + 0))	640 $g_operator
	mkdev ${name}${unit}b	b $blk $(($unit * 16 + 1))	640 $g_operator
	mkdev ${name}${unit}c	b $blk $(($unit * 16 + 2))	640 $g_operator
	mkdev ${name}${unit}d	b $blk $(($unit * 16 + 3))	640 $g_operator
	mkdev ${name}${unit}e	b $blk $(($unit * 16 + 4))	640 $g_operator
	mkdev ${name}${unit}f	b $blk $(($unit * 16 + 5))	640 $g_operator
	mkdev ${name}${unit}g	b $blk $(($unit * 16 + 6))	640 $g_operator
	mkdev ${name}${unit}h	b $blk $(($unit * 16 + 7))	640 $g_operator
	mkdev ${name}${unit}i	b $blk $(($unit * 16 + 8))	640 $g_operator
	mkdev ${name}${unit}j	b $blk $(($unit * 16 + 9))	640 $g_operator
	mkdev ${name}${unit}k	b $blk $(($unit * 16 + 10))	640 $g_operator
	mkdev ${name}${unit}l	b $blk $(($unit * 16 + 11))	640 $g_operator
	mkdev ${name}${unit}m	b $blk $(($unit * 16 + 12))	640 $g_operator
	mkdev ${name}${unit}n	b $blk $(($unit * 16 + 13))	640 $g_operator
	mkdev ${name}${unit}o	b $blk $(($unit * 16 + 14))	640 $g_operator
	mkdev ${name}${unit}p	b $blk $(($unit * 16 + 15))	640 $g_operator
	mkdev r${name}${unit}a	c $chr $(($unit * 16 + 0))	640 $g_operator
	mkdev r${name}${unit}b	c $chr $(($unit * 16 + 1))	640 $g_operator
	mkdev r${name}${unit}c	c $chr $(($unit * 16 + 2))	640 $g_operator
	mkdev r${name}${unit}d	c $chr $(($unit * 16 + 3))	640 $g_operator
	mkdev r${name}${unit}e	c $chr $(($unit * 16 + 4))	640 $g_operator
	mkdev r${name}${unit}f	c $chr $(($unit * 16 + 5))	640 $g_operator
	mkdev r${name}${unit}g	c $chr $(($unit * 16 + 6))	640 $g_operator
	mkdev r${name}${unit}h	c $chr $(($unit * 16 + 7))	640 $g_operator
	mkdev r${name}${unit}i	c $chr $(($unit * 16 + 8))	640 $g_operator
	mkdev r${name}${unit}j	c $chr $(($unit * 16 + 9))	640 $g_operator
	mkdev r${name}${unit}k	c $chr $(($unit * 16 + 10))	640 $g_operator
	mkdev r${name}${unit}l	c $chr $(($unit * 16 + 11))	640 $g_operator
	mkdev r${name}${unit}m	c $chr $(($unit * 16 + 12))	640 $g_operator
	mkdev r${name}${unit}n	c $chr $(($unit * 16 + 13))	640 $g_operator
	mkdev r${name}${unit}o	c $chr $(($unit * 16 + 14))	640 $g_operator
	mkdev r${name}${unit}p	c $chr $(($unit * 16 + 15))	640 $g_operator
}

makedisk_p16high()
{
	ho=524280	# offset for partition 9 to 16
	name="$1"; unit="$2"; blk="$3"; chr="$4"

	mkdev ${name}${unit}a	b $blk $(($unit * 8 + 0))	640 $g_operator
	mkdev ${name}${unit}b	b $blk $(($unit * 8 + 1))	640 $g_operator
	mkdev ${name}${unit}c	b $blk $(($unit * 8 + 2))	640 $g_operator
	mkdev ${name}${unit}d	b $blk $(($unit * 8 + 3))	640 $g_operator
	mkdev ${name}${unit}e	b $blk $(($unit * 8 + 4))	640 $g_operator
	mkdev ${name}${unit}f	b $blk $(($unit * 8 + 5))	640 $g_operator
	mkdev ${name}${unit}g	b $blk $(($unit * 8 + 6))	640 $g_operator
	mkdev ${name}${unit}h	b $blk $(($unit * 8 + 7))	640 $g_operator
	mkdev ${name}${unit}i	b $blk $(($unit * 8 + $ho + 8))	640 $g_operator
	mkdev ${name}${unit}j	b $blk $(($unit * 8 + $ho + 9))	640 $g_operator
	mkdev ${name}${unit}k	b $blk $(($unit * 8 + $ho + 10)) 640 $g_operator
	mkdev ${name}${unit}l	b $blk $(($unit * 8 + $ho + 11)) 640 $g_operator
	mkdev ${name}${unit}m	b $blk $(($unit * 8 + $ho + 12)) 640 $g_operator
	mkdev ${name}${unit}n	b $blk $(($unit * 8 + $ho + 13)) 640 $g_operator
	mkdev ${name}${unit}o	b $blk $(($unit * 8 + $ho + 14)) 640 $g_operator
	mkdev ${name}${unit}p	b $blk $(($unit * 8 + $ho + 15)) 640 $g_operator
	mkdev r${name}${unit}a	c $chr $(($unit * 8 + 0))	640 $g_operator
	mkdev r${name}${unit}b	c $chr $(($unit * 8 + 1))	640 $g_operator
	mkdev r${name}${unit}c	c $chr $(($unit * 8 + 2))	640 $g_operator
	mkdev r${name}${unit}d	c $chr $(($unit * 8 + 3))	640 $g_operator
	mkdev r${name}${unit}e	c $chr $(($unit * 8 + 4))	640 $g_operator
	mkdev r${name}${unit}f	c $chr $(($unit * 8 + 5))	640 $g_operator
	mkdev r${name}${unit}g	c $chr $(($unit * 8 + 6))	640 $g_operator
	mkdev r${name}${unit}h	c $chr $(($unit * 8 + 7))	640 $g_operator
	mkdev r${name}${unit}i	c $chr $(($unit * 8 + $ho + 8))	640 $g_operator
	mkdev r${name}${unit}j	c $chr $(($unit * 8 + $ho + 9))	640 $g_operator
	mkdev r${name}${unit}k	c $chr $(($unit * 8 + $ho + 10)) 640 $g_operator
	mkdev r${name}${unit}l	c $chr $(($unit * 8 + $ho + 11)) 640 $g_operator
	mkdev r${name}${unit}m	c $chr $(($unit * 8 + $ho + 12)) 640 $g_operator
	mkdev r${name}${unit}n	c $chr $(($unit * 8 + $ho + 13)) 640 $g_operator
	mkdev r${name}${unit}o	c $chr $(($unit * 8 + $ho + 14)) 640 $g_operator
	mkdev r${name}${unit}p	c $chr $(($unit * 8 + $ho + 15)) 640 $g_operator
}

# make only the very few basic disk device nodes - 'a' partition
# and raw partition
makedisk_minimal()
{
	name=$1; unit=$2; blk=$3; chr=$4
	doff=8
	ro=3
	rn=d

	mkdev ${name}${unit}a	b $blk $(($unit * $doff + 0))	640 $g_operator
	mkdev ${name}${unit}$rn	b $blk $(($unit * $doff + $ro))	640 $g_operator
	mkdev r${name}${unit}a	c $chr $(($unit * $doff + 0))	640 $g_operator
	mkdev r${name}${unit}$rn c $chr $(($unit * $doff + $ro)) 640 $g_operator
}

makedev $*

-- 
Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.cz/
-=- We should be mindful of the potential goal, but as the Buddhist -=-
-=- masters say, ``You may notice during meditation that you        -=-
-=- sometimes levitate or glow.   Do not let this distract you.''   -=-