3 # Copyright (c) 1990 The Regents of the University of California.
6 # Written and contributed by W. Jolitz 12/90
8 # Redistribution and use in source and binary forms are permitted provided
9 # that: (1) source distributions retain this entire copyright notice and
10 # comment, and (2) distributions including binaries display the following
11 # acknowledgement: ``This product includes software developed by the
12 # University of California, Berkeley and its contributors'' in the
13 # documentation or other materials provided with the distribution and in
14 # all advertising materials mentioning features or use of this software.
15 # Neither the name of the University nor the names of its contributors may
16 # be used to endorse or promote products derived from this software without
17 # specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 # @(#)MAKEDEV 5.2 (Berkeley) 6/22/90
25 # Device "make" file. Valid arguments:
26 # all makes all known devices, standard number of units (or close)
27 # std standard devices
28 # jail suitable for a jail(8)
29 # local configuration specific devices
30 # mach-4 mach4&lites+devices for Mach's XFree86 distribution
31 # (see http://www.cs.hut.fi/lites.html for more info on LITES)
34 # wt* QIC-interfaced (e.g. not SCSI) 3M cartridge tape
35 # sa* SCSI Sequential Access Devices
38 # aac* Adaptec FSA RAID controllers
39 # aacd* Adaptec FSA RAID
40 # acd* ATAPI CD-ROM disks
42 # cd* SCSI CD-ROM disks
43 # da* SCSI Direct Access Devices
44 # fd* floppy disk drives (3 1/2", 5 1/4")
45 # fla* M-Systems DiskOnChip
46 # idad* Compaq Smart-2 RAID arrays
47 # mcd* Mitsumi CD-ROM disks
48 # md* Memory (or malloc) disk
49 # mlx* Mylex DAC960 RAID controllers
50 # mlxd* Mylex DAC960 RAID disk volumes
51 # mly* Mylex RAID controllers (newer models)
52 # scd* Sony CD-ROM disks
53 # wd* "Winchester" disk drives (ST506,IDE,ESDI,RLL,...)
54 # wfd* IDE floppy disk drives (LS-120)
57 # vty* virtual console devices for syscons/pcvt/codrv
60 # mse* Logitech and ATI Inport bus mouse
62 # jogdial Sony VAIO jog dial
63 # sysmouse Mousesystems mouse emulator for syscons
66 # refclock-* serial ports used by xntpd parse refclocks
69 # tty* general purpose serial ports
70 # cua* dialout serial ports
71 # ttyA* Specialix SI/XIO dialin ports ('*' = number of devices)
72 # cuaA* Specialix SI/XIO dialout ports
73 # ttyDXX Digiboard Xi - 16 dialin ports (dgb)
74 # cuaDXX Digiboard Xi - 16 dialout ports (dgb)
75 # ttyDX.X Digiboards (work in progress) - 16 dialin ports (digi)
76 # cuaDX.X Digiboards (work in progress) - 16 dialout ports (digi)
77 # ttyM* Digiboard Xem - 16 dialin ports (dgm)
78 # cuaM* Digiboard Xem - 16 dialout ports (dgm)
79 # ttyR* Rocketport dialin ports
80 # cuaR* Rocketport dialout ports
83 # pty* set of 32 master and slave pseudo terminals
84 # vty* virtual terminals using syscons/pcvt/codrv console
88 # ppi* Parallel port i/o
89 # pps* Pulse per second timing interface
90 # pcfclock* Parallel time sync interface
97 # usb* USB bus control device
98 # ugen* generic USB device
99 # uhid* Human Interface Device (HID)
103 # urio* Diamond Rio 500
104 # uscanner* USB scanners
105 # ucom* USB serial devices
107 # SCSI devices (other than CD-ROM, tape and disk):
108 # ch* SCSI Media-Changer (juke box) driver
109 # pt* Processor Type (HP scanner, as one example)
110 # pass* CAM Passthrough device
111 # ses* SES (SCSI Environmental Services) and
112 # SAF-TE (Scsi Accessable Fault-Tolerant Enclosures) device
114 # PC-CARD (previously called PCMCIA) support
115 # card* PC-CARD slots
118 # i4b isdnd call control device
119 # i4bctl debugging control device
120 # i4btrc* trace data interface(s), one per passive card
121 # i4btel* telephony interface(s)
122 # i4bteld* telephony dialout interface(s)
123 # i4brbch* raw b channel access device(s)
125 # Special purpose devices:
126 # acpi Advanced Configuration and Power Interface
127 # apm Advanced Power Management BIOS
128 # apmctl APM BIOS control device
130 # crypto crypto interface
132 # tw* xten power controller
133 # snd* various sound cards
134 # pcaudio PCM audio driver
135 # socksys iBCS2 socket system driver
136 # vat VAT compatibility audio driver (requires snd*)
137 # gsc Genius GS-4500 hand scanner
139 # tun* Tunneling IP device
140 # tap* Ethernet Tunneling device
141 # snp* tty snoop devices
142 # spigot Video Spigot video acquisition card
143 # ctx* Cortex-I video acquisition card
144 # meteor* Matrox Meteor video acquisition card (pci)
145 # bktr* Bt848 based video acquisition card (pci)
146 # labpc* National Instrument's Lab-PC and LAB-PC+
147 # perfmon CPU performance-monitoring counters
148 # pci PCI configuration-space access from user mode
149 # ipl ipfilter control devices (ipl, ipnat, ipstate, ipauth)
150 # kbd keyboard devices
151 # 3dfx* 3dfx voodoo device for glide (tdfx) (/dev/3dfx,3dfxN,voodoo)
152 # agpgart AGP interface
153 # cfs* Coda Distributed Filesystem
154 # nsmb* SMB/CIFS protocol interface
155 # elan-mmcr AMD Elan support (e.g. mmap MMCR)
158 if [ -n "$MAKEDEVPATH" ]; then
165 # Usage: die exitcode msg
171 # Convert integer to partition name
176 0) p=a;; 1) p=b;; 2) p=c;; 3) p=d;; 4) p=e;; 5) p=f;; 6) p=g;; 7) p=h;;
182 # Convert integer to slice name
194 # Convert disk (type, unit, slice, partition) to minor number
197 echo $(($1 << 25 | ($2 / 32) << 21 | ($2 % 32) << 3 | $3 << 16 | $4))
200 # Print the hexadecimal representation of a decimal value from 0 to 15.
204 if [ $1 -lt 10 ]; then
208 10) d=a;; 11) d=b;; 12) d=c;; 13) d=d;; 14) d=e;; 15) d=f;;
215 # Print the hexadecimal representation of an arbitrary decimal value.
223 dig=`hexdigit $(($val & 15))`
226 while [ $val -gt 0 ]; do
227 dig=`hexdigit $(($val & 15))`
234 # Override mknod(2) to add extra handling to it.
236 for i in `IFS=':'; echo $PATH`; do
237 if [ -x "${i}/mknod" ]; then
245 4) "$mknod" "$@" root:wheel || die 2 "$mknod $@ failed";;
246 5) "$mknod" "$@" || die 2 "$mknod $@ failed";;
247 *) die 2 "bad node: mknod $@";;
251 # Convert tape (ctrl, unit, mode, access) to minor number
254 echo $(($1 << 29 | ($2 / 16) << 16 | ($2 % 16) << 4 | $3 << 2 | $4))
257 # Convert the last character of a tty name to a minor number.
262 a) m=10;; b) m=11;; c) m=12;; d) m=13;; e) m=14;; f) m=15;; g) m=16;;
263 h) m=17;; i) m=18;; j) m=19;; k) m=20;; l) m=21;; m) m=22;; n) m=23;;
264 o) m=24;; p) m=25;; q) m=26;; r) m=27;; s) m=28;; t) m=29;; u) m=30;;
271 # Convert a unit number to a minor number.
274 echo $(((($1 >> 8) << 16) | ($1 % 256)))
277 # Zero-pad a value to the appropriate minimum length.
284 while [ ${#val} -lt $min ]; do
290 # Raw partition for disks
293 # Compatibility slice for disks
296 # Raw slice for disks
300 disk_umask=037 # allow group operator to read disks
301 tape_umask=017 # allow group operator to read/write tapes
308 sh $0 fd0 fd1 # floppy disk
309 sh $0 da0 da1 da2 da3 # SCSI disk
310 sh $0 ata # ATA control
311 sh $0 ad0 ad1 ad2 ad3 # ATA disk
312 sh $0 ar0 ar1 # ATA RAID disk
313 sh $0 acd0 acd0t0 afd0 ast0 # ATAPI devices
314 sh $0 wd0 wd1 wd2 wd3 # OLD disk
315 sh $0 wcd0 wfd0 wst0 # OLD ATAPI devs
316 sh $0 cd0 mcd0 scd0 # cdrom
318 sh $0 vty12 # virtual tty
319 sh $0 cuaa0 cuaa1 cuaa2 cuaa3 # serial tty
320 sh $0 pty0 # pseudo tty
321 sh $0 ttyd0 ttyd1 ttyd2 ttyd3 # serial tty
322 sh $0 kbd0 kbd1 # keyboard
323 sh $0 mse0 psm0 jogdial sysmouse # mouse
324 sh $0 pcaudio speaker # noise
325 sh $0 lpt0 lpt1 lpt2 # printer
326 sh $0 ppi0 ppi1 ppi2 # parallel port
327 sh $0 iic0 iic1 # I2C device
328 sh $0 smb0 smb1 # SMBus device
329 sh $0 usb usb0 uhid0 ums0 ulpt0 ugen0 # USB devices
330 sh $0 urio0 uscanner0 umodem0 # USB devices too
331 sh $0 bpf0 bpf1 bpf2 bpf3 # network
332 sh $0 ipl tun0 tun1 tun2 tun3 # network
333 sh $0 tap0 tap1 tap2 tap3 # network
334 sh $0 ch0 perfmon tw0 # miscellaneous
336 sh $0 apm apmctl card0 card1 card2 card3 # laptop
337 sh $0 pass4 xpt2 # CAM
338 sh $0 i4b i4bctl i4btrc0 i4btrc1 # ISDN
339 sh $0 i4btel0 i4btel1 i4bteld0 i4bteld1 # ISDN
340 sh $0 i4brbch0 i4brbch1 # ISDN
342 sh $0 nsmb0 # SMB/CIFS
343 sh $0 ti0 ti1 # ti(4)
344 sh $0 crypto # crypto
347 # a much restricted set of the above, to save precious i-nodes on the
351 sh $0 fd0 # floppy disk
352 sh $0 da0 # SCSI disk
354 sh $0 acd0 afd0 ast0 # ATAPI devices
356 sh $0 wcd0 wfd0 wst0 # OLD ATAPI devs
359 sh $0 vty2 # virtual tty
360 sh $0 cuaa0 # serial tty
361 sh $0 pty0 # pseudo tty
362 sh $0 ttyd0 # serial tty
363 sh $0 kbd0 # keyboard
364 sh $0 mse0 psm0 jogdial sysmouse # mouse
366 sh $0 ppi0 # parallel port
367 sh $0 iic0 # I2C device
368 sh $0 smb0 # SMBus device
369 sh $0 ums0 # USB devices
372 sh $0 ch0 # miscellaneous
374 sh $0 apm apmctl card0 # laptop
375 sh $0 pass1 xpt1 # CAM
376 sh $0 i4b i4bctl i4btrc0 i4btrc1 # ISDN
377 sh $0 i4btel0 i4bteld0 # ISDN
378 sh $0 i4brbch0 # ISDN
383 mknod console c 0 0; chmod 600 console
384 mknod kmem c 2 1 root:kmem; chmod 640 kmem
385 mknod mem c 2 0 root:kmem; chmod 640 mem
386 mknod null c 2 2; chmod 666 null
387 mknod random c 2 3; chmod 666 random
389 mknod zero c 2 12; chmod 666 zero
390 mknod io c 2 14; chmod 600 io
391 mknod tty c 1 0; chmod 666 tty
392 mknod klog c 7 0; chmod 600 klog
393 mknod pci c 78 0; chmod 644 pci
394 mknod mdctl c 95 0xffff00ff; chmod 600 mdctl
397 while [ $i -lt 64 ]; do
411 rm mem kmem pci io klog console # for security
412 ln -sf null mem # for libkvm (ab)users
413 ln -sf null kmem # --//--
422 mknod timezone c 26 0
425 # Create device files for new Archive/Wangtek QIC-02 tape driver (vak)
428 u=`expr $i : '..\(.*\)'`
429 if [ -z "${u}" ]; then u=0; fi
430 # default density, 512b blocks
431 mknod rwt${u} c 10 $(( 0 + $u)) root:operator
432 mknod nrwt${u} c 10 $(( 4 + $u)) root:operator
433 # default density, 1024b blocks
434 # mknod rWt${u} c 10 $((64 + $u)) root:operator
435 # mknod nrWt${u} c 10 $((68 + $u)) root:operator
436 mknod rwt${u}b c 10 $((16 + $u)) root:operator # 60 megabytes
437 mknod nrwt${u}b c 10 $((20 + $u)) root:operator
438 mknod rwt${u}c c 10 $((24 + $u)) root:operator # 120 megabytes
439 mknod nrwt${u}c c 10 $((28 + $u)) root:operator
440 mknod rwt${u}d c 10 $((32 + $u)) root:operator # 150 megabytes
441 mknod nrwt${u}d c 10 $((36 + $u)) root:operator
442 # mknod rwt${u}e c 10 $((40 + $u)) root:operator # 300 megabytes?
443 # mknod nrwt${u}e c 10 $((44 + $u)) root:operator
444 # mknod rwt${u}f c 10 $((48 + $u)) root:operator # 600 megabytes?
445 # mknod nrwt${u}f c 10 $((52 + $u)) root:operator
450 aacd*s*|ad*s*|ar*s*|afd*s*|amrd*s*|da*s*|fla*s*|idad*s*|md*s*|mlxd*s*|twed*s*|wd*s*|wfd*s*)
453 aacd*s*) name=aacd; chr=151;;
454 ad*s*) name=ad; chr=116;;
455 ar*s*) name=ar; chr=157;;
456 afd*s*) name=afd; chr=118;;
457 amrd*s*) name=amrd; chr=133;;
458 da*s*) name=da; chr=13;;
459 fla*s*) name=fla; chr=102;;
460 idad*s*) name=idad; chr=109;;
461 md*s*) name=md; chr=95;;
462 mlxd*s*) name=mlxd; chr=131;;
463 twed*s*) name=twed; chr=147;;
464 wd*s*) name=wd; chr=3;;
465 wfd*s*) name=wfd; chr=87;;
468 aacd*s*|amrd*s*|idad*s*|mlxd*s*|twed*s*)
469 unit=`expr $i : '....\([0-9]*\)s'`
470 slice=`expr $i : '....[0-9]*s\([0-9]*\)'`
471 part=`expr $i : '....[0-9]*s[0-9]*\(.*\)'`
473 afd*s*|fla*s*|wfd*s*)
474 unit=`expr $i : '...\([0-9]*\)s'`
475 slice=`expr $i : '...[0-9]*s\([0-9]*\)'`
476 part=`expr $i : '...[0-9]*s[0-9]*\(.*\)'`
479 unit=`expr $i : '..\([0-9]*\)s'`
480 slice=`expr $i : '..[0-9]*s\([0-9]*\)'`
481 part=`expr $i : '..[0-9]*s[0-9]*\(.*\)'`
485 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
490 slicename=`dkitos $slice`
491 minor=`dkminor 0 $unit $slice $dkrawpart`
492 mknod $name$unit$slicename c $chr $minor root:operator
493 ln -f $name$unit$slicename r$name$unit$slicename
497 0) slice=$oldslice ;;
499 for part in 0 1 2 3 4 5 6 7
501 minor=`dkminor 0 $unit $slice $part`
502 partname=`dkitop $part`
503 mknod $name$unit$slicename$partname \
504 c $chr $minor root:operator
505 ln -f $name$unit$slicename$partname \
506 r$name$unit$slicename$partname
512 echo bad partition for disk in: $i
517 echo bad slice for disk in: $i
522 echo bad unit for disk in: $i "(unit=$unit, slice=$slice, part=$part)"
530 unit=`expr $i : '..\(.*\)'`
534 mknod ${name}${unit} c $chr $(($unit * 64)) root:operator
535 # Fake BSD partitions
536 for i in a b c d e f g h
538 ln -f ${name}${unit} ${name}${unit}$i
542 echo bad unit for disk in: $i
550 mknod ata c 159 0 root:operator
555 aacd*|ad*|ar*|afd*|amrd*|da*|fla*|idad*|md*|mlxd*|twed*|wd*|wfd*)
558 aacd*) name=aacd; chr=151;;
559 ad*) name=ad; chr=116;;
560 ar*) name=ar; chr=157;;
561 afd*) name=afd; chr=118;;
562 amrd*) name=amrd; chr=133;;
563 da*) name=da; chr=13;;
564 fla*) name=fla; chr=102;;
565 idad*) name=idad; chr=109;;
566 md*) name=md; chr=95;;
567 mlxd*) name=mlxd; chr=131;;
568 twed*) name=twed; chr=147;;
569 wd*) name=wd; chr=3;;
570 wfd*) name=wfd; chr=87;;
573 aacd*|amrd*|idad*|mlxd*|twed*)
574 unit=`expr $i : '....\(.*\)'`
577 unit=`expr $i : '...\(.*\)'`
580 unit=`expr $i : '..\(.*\)'`
584 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
585 for slicepartname in s0h s1h s2 s3 s4
587 sh $0 $name$unit$slicepartname
591 echo bad unit for disk in: $i
601 unit=`expr $i : '...\(.*\)'`
603 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
604 for part in 0 1 2 3 4 5 6 7
606 minor=`dkminor 0 $unit 0 $part`
607 partname=`dkitop $part`
608 mknod $name$unit$partname c $chr $minor root:operator
609 ln -f $name$unit$partname r$name$unit$partname
613 echo bad unit for disk in: $i
619 # SCSI processor type driver
623 unit=`expr $i : 'pt\([0-9][0-9]*\)'`
624 if [ -z "${unit}" ]; then
627 unit=$(($unit + 1 - 1))
628 mknod ${name}${unit} c $chr `unit2minor $unit`
631 # SCSI SES/SAF-TE type driver
635 unit=`expr $i : 'ses\([0-9][0-9]*\)'`
636 if [ -z "${unit}" ]; then
639 unit=$(($unit + 1 - 1))
640 mknod ${name}${unit} c $chr `unit2minor $unit`
642 # SCSI target mode sample driver
646 unit=`expr $i : 'targ\([0-9][0-9]*\)'`
647 if [ -z "${unit}" ]; then
650 unit=$(($unit + 1 - 1))
651 mknod ${name}${unit} c $chr `unit2minor $unit`
652 mknod ${name}.ctl c $chr 0xffff00ff
655 # CAM transport layer device
657 # This major number is temporary
660 units=`expr $i : 'xpt\(.*\)'`
661 if [ -z "${units}" ]; then
665 while [ $i -lt $units ]; do
667 rm -rf $dname r$dname
668 mknod $dname c $chr `unit2minor $i` root:operator
673 # CAM passthrough device
675 # This major number is temporary
678 units=`expr $i : 'pass\(.*\)'`
679 if [ -z "${units}" ]; then
683 while [ $i -lt $units ]; do
685 rm -rf $dname r$dname
686 mknod $dname c $chr `unit2minor $i` root:operator
691 class=`expr $i : 'pty\(.*\)'`
694 1) offset=32 name=q;;
695 2) offset=64 name=r;;
696 3) offset=96 name=s;;
697 # Note that xterm (at least) only look at p-s.
698 4) offset=128 name=P;;
699 5) offset=160 name=Q;;
700 6) offset=192 name=R;;
701 7) offset=224 name=S;;
702 # This still leaves [tuTU].
703 *) echo bad unit for pty in: $i;;
709 while [ $i -lt 32 ]; do
710 # This was an awk substr() before.
711 c=$(echo 0123456789abcdefghijklmnopqrstuv |
712 dd bs=1 skip=$i count=1 2>/dev/null)
713 mknod tty$name$c c 5 $(($offset + $i))
714 mknod pty$name$c c 6 $(($offset + $i))
724 unit=`expr $i : '..\(.*\)'`
728 [0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9])
729 mknod sa${unit}.ctl c $chr `saminor 1 ${unit} 0 0`
730 ln -f sa${unit}.ctl rsa${unit}.ctl
733 mknod sa${unit}.${m} c $chr \
734 `saminor 0 ${unit} ${m} 0` root:operator
735 ln -f sa${unit}.${m} rsa${unit}.${m}
736 mknod nsa${unit}.${m} c $chr \
737 `saminor 0 ${unit} ${m} 1` root:operator
738 ln -f nsa${unit}.${m} nrsa${unit}.${m}
739 mknod esa${unit}.${m} c $chr \
740 `saminor 0 ${unit} ${m} 2` root:operator
741 ln -f esa${unit}.${m} ersa${unit}.${m}
743 ln -f sa${unit}.0 sa${unit}
744 ln -f sa${unit}.0 rsa${unit}.0
745 ln -f sa${unit}.0 rsa${unit}
746 ln -f nsa${unit}.0 nsa${unit}
747 ln -f nsa${unit}.0 nrsa${unit}.0
748 ln -f nsa${unit}.0 nrsa${unit}
749 ln -f esa${unit}.0 esa${unit}
750 ln -f esa${unit}.0 ersa${unit}.0
751 ln -f esa${unit}.0 ersa${unit}
754 echo bad unit for tape in: $i
762 unit=`expr $i : '..\(.*\)'`
764 ch*) name=ch; chr=17;;
768 mknod ${name}${unit} c $chr $unit root:operator
771 echo bad unit for media changer in: $i
779 unit=`expr $i : '...\(.*\)'`
783 mknod ast${unit} c $chr $(($unit * 8 + 0)) root:operator
785 mknod nast${unit} c $chr $(($unit * 8 + 1)) root:operator
786 chmod 640 nast${unit}
789 echo bad unit for tape in: $i
797 units=`expr $i : '...\(.*\)t'`;
798 tracks=`expr $i : '.*t\(.*\)'`;
801 if [ -z "${units}" ]; then
804 if [ -z "${tracks}" ]; then
807 if [ "${units}" -le 31 -a "${tracks}" -le 169 ]; then
809 while [ $i -le $units ]; do
813 while [ $j -le ${tracks} ]; do
814 mknod ${dname}t$j c $chr \
815 $((($i * 8) + (65536 * $j))) \
822 echo "$i is invalid -- can't have more than 32 cd devices or 169 tracks"
830 acd*) units=`expr $i : '...\(.*\)'`; name=acd; chr=117;;
831 cd*) units=`expr $i : '..\(.*\)'`; name=cd; chr=15;;
832 mcd*) units=`expr $i : '...\(.*\)'`; name=mcd; chr=29;;
833 scd*) units=`expr $i : '...\(.*\)'`; name=scd; chr=45;;
835 if [ -z "${units}" ]; then
838 if [ "${units}" -le 31 ]; then
840 while [ $i -le $units ]; do
842 rm -rf ${dname}[!t]* r${dname}*
843 mknod ${dname}a c $chr $(($i * 8)) root:operator
844 mknod ${dname}c c $chr $(($i * 8 + 2)) root:operator
845 ln -f ${dname}a r${dname}a
846 ln -f ${dname}c r${dname}c
850 echo "$i is invalid -- can't have more than 32 cd devices"
857 unit=`expr $i : '...\(.*\)'`
861 mknod wcd${unit}a c $chr $(($unit * 8 + 0)) root:operator
862 mknod wcd${unit}c c $chr $(($unit * 8 + 2)) root:operator
863 ln -f wcd${unit}a rwcd${unit}a
864 ln -f wcd${unit}c rwcd${unit}c
865 chmod 640 wcd${unit}[a-h] rwcd${unit}[a-h]
868 echo bad unit for disk in: $i
876 unit=`expr $i : '...\(.*\)'`
880 mknod rwst${unit} c $chr $(($unit * 8 + 0)) root:operator
881 chmod 640 rwst${unit}
888 unit=`expr $i : 'iic\(.*\)'`
889 mknod iic$unit c 105 `unit2minor $unit`
893 unit=`expr $i : 'smb\(.*\)'`
894 mknod smb$unit c 106 `unit2minor $unit`
898 unit=`expr $i : 'pcfclock\(.*\)'`
899 mknod pcfclock$unit c 140 `unit2minor $unit`
903 unit=`expr $i : 'ppi\(.*\)'`
904 mknod ppi$unit c 82 `unit2minor $unit`
908 unit=`expr $i : 'pps\(.*\)'`
909 mknod pps$unit c 89 `unit2minor $unit`
913 mknod usb$unit c 108 255 root:operator
919 unit=`expr $i : 'usb\(.*\)'`
920 mknod usb$unit c 108 `unit2minor $unit` root:operator
926 unit=`expr $i : 'uhid\(.*\)'`
927 mknod uhid$unit c 122 `unit2minor $unit` root:operator
933 unit=`expr $i : 'ums\(.*\)'`
934 mknod ums$unit c 111 `unit2minor $unit` root:operator
939 unit=`expr $i : 'ulpt\(.*\)'`
940 minor=`unit2minor $unit`
941 mknod ulpt$unit c 113 $minor
942 minor=`unit2minor $(($unit + 64))`
943 mknod unlpt$unit c 113 $minor # and the 'no prime' version
948 unit=`expr $i : 'ugen\([0-9][0-9]*\)'`
949 endpoint=`expr $i : 'ugen.*\.\([0-9][0-9]*\)'`
950 if [ -z "${unit}" ]; then
951 echo $i - Invalid unit number
953 if [ -z "${endpoint}" ]; then # ugen0 & ugen0.1 - ugen0.15
954 mknod ugen$unit c 114 \
955 `unit2minor $(($unit * 16))` root:operator
957 while [ $i -lt 16 ]; do
958 mknod ugen$unit.$i c 114 \
959 `unit2minor $(($unit * 16 + $i))` root:operator
963 minor=`unit2minor $(($unit * 16 + $endpoint))`
964 mknod ugen$unit.$endpoint c 114 $minor root:operator
971 unit=`expr $i : 'urio\(.*\)'`
972 mknod urio$unit c 143 `unit2minor $unit` root:operator
978 unit=`expr $i : 'ucom\(.*\)'`
979 minor=`unit2minor $(($unit + 128))`
980 mknod ucom$unit c 138 $minor uucp:dialer
986 unit=`expr $i : 'uscanner\(.*\)'`
987 mknod uscanner$unit c 156 `unit2minor $unit` root:operator
993 unit=`expr $i : 'umodem\(.*\)'`
994 mknod umodem$unit c 124 `unit2minor $unit` uucp:dialer
999 unit=`expr $i : 'lpt\(.*\)'`
1000 mknod lpt$unit c 16 `unit2minor $unit`
1001 mknod lpctl$unit c 16 `unit2minor $(($unit + 128))`
1004 # Use this to create virtual consoles for syscons, pcvt or codrv
1006 # use as MAKEDEV vtyNN to create NN entries
1009 units=`expr $i : 'vty\(.*\)'`
1011 while [ $i -lt $units ]; do
1012 mknod ttyv$(hexprint $i) c $chr `unit2minor $i`
1015 ln -fs ttyv0 vga # XXX X still needs this pccons relic
1019 units=`expr $i : 'nmdm\(.*\)'`
1022 while [ $i -lt $units ]; do
1023 minor=`unit2minor $i`
1024 minor=$(($minor + $minor))
1025 mknod nmdm${i}A c $chr $minor
1026 mknod nmdm${i}B c $chr $(($minor + 1))
1032 units=`expr $i : 'bpf\(.*\)$'`
1034 while [ $unit -le $units ]; do
1035 mknod bpf$unit c 23 `unit2minor $unit`
1041 mknod speaker c 26 0
1046 unit_low=`expr $i : 'cua.*\(.\)$'`
1053 unit_high=`expr $i : 'cuaa\(.\).$'`
1054 m_high=`ttyminor $unit_high`
1057 unit=$unit_high$unit_low
1058 m=$(($m_high << 16 | `ttyminor $unit_low`))
1059 mknod cuaa$unit c 28 $(($m | 128)) uucp:dialer
1060 mknod cuaia$unit c 28 $(($m | 32 | 128)) uucp:dialer
1061 mknod cuala$unit c 28 $(($m | 64 | 128)) uucp:dialer
1065 tty?|tty0?|ttyd?|ttyd??)
1066 unit_low=`expr $i : 'tty.*\(.\)$'`
1073 unit_high=`expr $i : 'ttyd\(.\).$'`
1074 m_high=`ttyminor $unit_high`
1077 unit=$unit_high$unit_low
1078 m=$(($m_high << 16 | `ttyminor $unit_low`))
1079 mknod ttyd$unit c 28 $m
1080 mknod ttyid$unit c 28 $(($m | 32))
1081 mknod ttyld$unit c 28 $(($m | 64))
1086 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1087 g h i j k l m n o p q r s t u v"
1089 card=`expr $i : 'cua.*\(.\)$'`
1090 for unit in $portlist
1092 minor=`ttyminor $unit`
1093 minor=$(($card * 65536 + $minor))
1095 mknod cuac$name c $major $(($minor + 128)) uucp:dialer
1096 mknod cuaic$name c $major $(($minor + 32 + 128)) uucp:dialer
1097 mknod cualc$name c $major $(($minor + 64 + 128)) uucp:dialer
1103 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1104 g h i j k l m n o p q r s t u v"
1106 card=`expr $i : 'tty.*\(.\)$'`
1107 for unit in $portlist
1109 minor=`ttyminor $unit`
1110 minor=$(($card * 65536 + $minor))
1112 mknod ttyc$name c $major $minor
1113 mknod ttyic$name c $major $(($minor + 32))
1114 mknod ttylc$name c $major $(($minor + 64))
1118 # RISCom8 'rc' driver entries
1122 unit=`expr $i : 'cua.*\(.\)$'`
1124 mknod cuam$unit c 63 $(($m + 128)) uucp:dialer
1129 unit=`expr $i : 'tty.*\(.\)$'`
1131 mknod ttym$unit c 63 $m
1135 # Note: these are 'base 1' to match the numbers on the panels, and to match
1136 # the manual that comes with the system.
1139 units=`expr $i : 'ttyA\(.*\)$'`
1141 while [ $port -le $units ]; do
1142 minor=$(($port - 1))
1143 name=$(zeropad 2 $port)
1144 mknod ttyA$name c $major $minor
1145 mknod ttyiA$name c $major $(($minor + 65536))
1146 mknod ttylA$name c $major $(($minor + 131072))
1149 # For the user-mode control program, 'sicontrol'
1150 mknod si_control c 68 262144
1156 units=`expr $i : 'cuaA\(.*\)$'`
1158 while [ $port -le $units ]; do
1159 minor=$(($port - 1))
1160 name=$(zeropad 2 $port)
1161 mknod cuaA$name c $major $(($minor + 128)) uucp:dialer
1162 mknod cuaiA$name c $major $(($minor + 128 + 65536)) \
1164 mknod cualA$name c $major $(($minor + 128 + 131072)) \
1171 # Alpha AS8[24]00 (TurboLaser) console.
1173 unit=`expr $i : 'zs.*\(.\)$'`
1175 mknod zs$unit c 135 $m
1178 # Digiboard PC/?? 16 port card.
1179 # The current scheme of minor numbering is:
1181 # unused{14} CARD{2} major{8} CALLOUT{1} LOCK{1} INIT{1} PORT{5}
1183 # CARD bitfield in future versions may be extended to 3 bits.
1188 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1190 card=`expr $i : 'tty.*\(.\)$'`
1191 for unit in $portlist
1193 minor=`ttyminor $unit`
1194 minor=$(($card * 65536 + $minor))
1196 mknod ttyD$name c $major $minor
1197 mknod ttyiD$name c $major $(($minor + 32))
1198 mknod ttylD$name c $major $(($minor + 64))
1201 # Also create devices for the digi driver
1204 card=`expr $i : 'tty.*\(.\)$'`
1206 mknod digi$card.ctl c $major $(($card * 65536 + 8388608)) uucp:dialer
1208 while [ $unit -lt 16 ]
1210 base=$(($card * 65536 + $unit))
1213 mknod ttyD$name c $major $base
1214 mknod ttyiD$name c $major $(($base + 1048576))
1215 mknod ttylD$name c $major $(($base + 2097152))
1223 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1225 card=`expr $i : 'cua.*\(.\)$'`
1226 for unit in $portlist
1228 minor=`ttyminor $unit`
1229 minor=$(($card * 65536 + $minor))
1231 mknod cuaD$name c $major $(($minor + 128)) uucp:dialer
1232 mknod cuaiD$name c $major $(($minor + 32 + 128)) uucp:dialer
1233 mknod cualD$name c $major $(($minor + 64 + 128)) uucp:dialer
1236 # Also create devices for the digi driver
1238 card=`expr $i : 'cua.*\(.\)$'`
1240 mknod digi$card.ctl c $major $(($card * 65536 + 8388608)) uucp:dialer
1242 while [ $unit -lt 16 ]
1244 base=$(($card * 65536 + $unit))
1247 mknod cuaD$name c $major $(($base + 4194304)) uucp:dialer
1248 mknod cuaiD$name c $major $(($base + 5242880)) uucp:dialer
1249 mknod cualD$name c $major $(($base + 6291456)) uucp:dialer
1255 # Digiboard Xem - superceeded by the digi device above
1258 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1259 modulelist="a b c d"
1261 card=`expr $i : 'tty.*\(.\)$'`
1262 for unit in $modulelist
1264 moduleminor=`ttyminor $unit`
1265 moduleminor=$(($moduleminor % 10 * 16))
1268 for unit in $portlist
1270 minor=`ttyminor $unit`
1271 minor=$(($card * 65536 + $minor + $moduleminor))
1272 name=$card$modulename$unit
1274 mknod ttyM$name c $major $minor
1275 mknod ttyiM$name c $major $(($minor + 64))
1276 mknod ttylM$name c $major $(($minor + 128))
1283 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1284 modulelist="a b c d"
1286 card=`expr $i : 'cua.*\(.\)$'`
1287 for unit in $modulelist
1289 moduleminor=`ttyminor $unit`
1290 moduleminor=$(($moduleminor % 10 * 16))
1293 for unit in $portlist
1295 minor=`ttyminor $unit`
1296 minor=$(($card * 65536 + $minor + $moduleminor))
1297 name=$card$modulename$unit
1299 mknod cuaM$name c $major $(($minor + 262144)) \
1301 mknod cuaiM$name c $major $(($minor + 64 + 262144)) \
1303 mknod cualM$name c $major $(($minor + 128 + 262144)) \
1313 MINOR=$(($BOARD * 65536))
1315 dmesg | while read first rest; do
1323 rm -f ttyR* ttyiR* ttylR*
1324 for i in $controllers; do
1326 dmesg | while read first foo bar ports rest; do
1334 echo -n "Creating $ndevices devices for $i: "
1336 while [ $dev -lt $ndevices ]; do
1337 mknod ttyR$Rnum c $major $MINOR
1338 mknod ttyiR$Rnum c $major $(($MINOR + 32))
1339 mknod ttylR$Rnum c $major $(($MINOR + 64))
1341 MINOR=$(($MINOR + 1))
1344 BOARD=$(($BOARD + 1))
1345 MINOR=$(($BOARD * 65536))
1353 MINOR=$(($BOARD * 65536))
1355 dmesg | while read first rest; do
1363 rm -f cuaR* cuaiR* cualR*
1364 for i in $controllers; do
1366 dmesg | while read first foo bar ports rest; do
1374 echo -n "Creating $ndevices devices for $i: "
1376 while [ $dev -lt $ndevices ]; do
1377 mknod cuaR$Rnum c $major $(($MINOR + 128)) uucp:dialer
1378 mknod cuaiR$Rnum c $major $(($MINOR + 128 + 32)) \
1380 mknod cualR$Rnum c $major $(($MINOR + 128 + 64)) \
1383 MINOR=$(($MINOR + 1))
1386 BOARD=$(($BOARD + 1))
1387 MINOR=$(($BOARD * 65536))
1393 unit=`expr $i : 'mse\(.*\)'`
1395 # non-blocking for X11
1396 mknod mse$unit c $chr `unit2minor $(($unit * 2 + 1))`
1400 unit=`expr $i : 'psm\(.*\)'`
1402 # non-blocking for X11
1403 mknod psm$unit c $chr `unit2minor $(($unit * 2 + 1))`
1407 name=`expr $i : 'mouse\(.*\)'`
1408 if [ ! -c $name ]; then
1409 $0 $name # make the appropriate device
1415 mknod pcaudio c 24 0
1416 mknod pcaudioctl c 24 128
1420 mknod socksys c 41 0
1423 chmod 666 socksys nfsd spx
1428 # changes from Linux voxware
1429 # minor Linux FreeBSD
1430 # 8 sequencer2 (aka music0) music0
1431 # 17 patmgr0 sequencer1
1432 # 33 patmgr1 sequencer2
1435 unit=`expr $i : 'snd\(.*\)'`
1438 # XXX write this less verbosely, like std
1439 snd_security_hole=0 # XXX
1440 umask $snd_security_hole
1442 ln -fs mixer$unit mixer
1443 ln -fs sequencer$unit sequencer
1445 ln -fs audio$unit audio
1446 ln -fs dspW$unit dspW
1447 ln -fs music$unit music
1450 mknod mixer$unit c $chr `unit2minor $(($unit * 16 + 0))`
1451 mknod sequencer$unit c $chr `unit2minor $(($unit * 16 + 1))`
1452 mknod midi$unit c $chr `unit2minor $(($unit * 16 + 2))`
1453 mknod dsp$unit c $chr `unit2minor $(($unit * 16 + 3))`
1454 mknod audio$unit c $chr `unit2minor $(($unit * 16 + 4))`
1455 mknod dspW$unit c $chr `unit2minor $(($unit * 16 + 5))`
1456 mknod sndstat c $chr 6
1457 # minor number 7 is unused
1458 mknod music$unit c $chr `unit2minor $(($unit * 16 + 8))`
1459 mknod pss$unit c $chr `unit2minor $(($unit * 16 + 9))`
1460 # minor number 10 is unused
1461 mknod midistat c $chr 11
1462 # minor numbers 12-15 are unused
1467 mknod vatio c 25 128
1472 unit=`expr $i : 'gsc\(.*\)'`
1473 mknod gsc${unit} c 47 `unit2minor $unit`
1474 mknod gsc${unit}p c 47 `unit2minor $(($unit + 8))`
1475 mknod gsc${unit}d c 47 `unit2minor $(($unit + 32))`
1476 mknod gsc${unit}pd c 47 `unit2minor $(($unit + 40))`
1477 chmod 666 gsc${unit}*
1481 mknod acpi c 152 0 root:operator
1486 mknod apm c 39 0 root:operator
1491 mknod apmctl c 39 8 root:operator
1496 unit=`expr $i : 'card\(.*\)'`
1498 mknod card$unit c $chr `unit2minor $unit`
1502 ti*) unit=`expr $i : 'ti\(.*\)'`
1504 mknod ti$unit c $chr `unit2minor $unit`
1510 *0) unit=0;; *1) unit=1;; *2) unit=2;; *3) unit=3;;
1511 *4) unit=4;; *5) unit=5;; *6) unit=6;; *7) unit=7;;
1512 *8) unit=8;; *9) unit=9;; *a) unit=10;; *b) unit=11;;
1513 *c) unit=12;; *d) unit=13;; *e) unit=14;; *f) unit=15;;
1516 ttyy?) unit=$(($unit + 16));;
1517 ttyz?) unit=$(($unit + 32));;
1523 mknod cronyx c 42 63
1527 mknod joy0 c 51 0 root:operator
1528 mknod joy1 c 51 1 root:operator
1538 unit=`expr $i : 'ctx\(.*\)'`
1539 mknod ctx$unit c 40 `unit2minor $unit`
1544 unit=`expr $i : 'meteor\(.*\)'`
1545 mknod meteor$unit c 67 `unit2minor $unit`
1546 chmod 444 meteor$unit
1550 unit=`expr $i : 'bktr\(.*\)'`
1551 mknod bktr$unit c 92 `unit2minor $unit`
1552 mknod tuner$unit c 92 `unit2minor $((16 + $unit))`
1553 mknod vbi$unit c 92 `unit2minor $((32 + $unit))`
1554 chmod 444 bktr$unit tuner$unit vbi$unit
1558 units=`expr $i : 'tun\(.*\)$'`
1560 while [ $unit -le $units ]; do
1561 mknod tun$unit c 52 `unit2minor $unit`
1567 units=`expr $i : 'tap\(.*\)$'`
1569 while [ $unit -le $units ]; do
1570 mknod tap$unit c 149 `unit2minor $unit` root:network
1576 mknod sysmouse c 12 128
1577 mknod consolectl c 12 255
1581 mknod jogdial c 160 0
1585 unit=`expr $i : 'snp\(.*\)'`
1586 mknod snp$unit c 53 `unit2minor $unit`
1589 # dufault@hda.com: If I do much more work on other A-D boards
1590 # then eventually we'll have a "ad" and "dio" interface and some of these
1591 # "labpcaio" ones will be gone.
1592 # labpcaio: D-A and A-D.
1593 # labpcdio: Digital in and Digital out.
1600 unit=`expr $i : 'labpcaio\(.*\)'`
1601 all="0 1 2 3 4 5 6 7"
1606 unit=`expr $i : 'labpcdio\(.*\)'`
1611 die 3 "Don't know LabPC type $i"
1614 if [ -z "${unit}" ]; then
1619 mknod $name$unit c 66 $(($offset + $unit))
1624 mknod $name$i c 66 $(($offset + $i))
1628 echo "No such LabPC unit: $unit"
1635 mknod perfmon c 2 32 root:kmem
1642 mknod ipstate c 79 2
1647 unit=`expr $i : 'kbd\(.*\)'`
1649 mknod kbd$unit c $chr `unit2minor $unit`
1661 unit=`expr $i : 'i4brbch\(.*\)'`
1662 mknod i4brbch$unit c 57 `unit2minor $unit`
1667 unit=`expr $i : 'i4bteld\(.*\)'`
1668 mknod i4bteld$unit c 56 `unit2minor $(($offset + $unit))`
1672 unit=`expr $i : 'i4btel\(.*\)'`
1673 mknod i4btel$unit c 56 `unit2minor $unit`
1677 unit=`expr $i : 'i4btrc\(.*\)'`
1678 mknod i4btrc$unit c 59 `unit2minor $unit`
1682 unit=`expr $i : 'aac\(.*\)'`
1683 mknod aac$unit c 150 `unit2minor $unit`
1684 ln -fs aac$unit afa$unit
1685 ln -fs aac$unit hpn$unit
1689 unit=`expr $i : 'mlx\(.*\)'`
1690 mknod mlx$unit c 130 `unit2minor $unit`
1694 unit=`expr $i : 'mlx\(.*\)'`
1695 mknod mlx$unit c 158 `unit2minor $unit`
1699 unit=`expr $i : 'amr\(.*\)'`
1700 mknod amr$unit c 132 `unit2minor $unit`
1704 unit=`expr $i : 'ciss\(.*\)'`
1705 mknod ciss$unit c 166 `unit2minor $unit`
1709 unit=`expr $i : '3dfx\(.*\)'`
1710 mknod 3dfx$unit c 107 `unit2minor $unit`
1711 ln -sf 3dfx$unit 3dfx
1712 ln -sf 3dfx$unit voodoo
1716 mknod agpgart c 148 0
1720 unit=`expr $i : 'twe\(.*\)'`
1721 mknod twe$unit c 146 `unit2minor $unit`
1725 unit=`expr $i : 'tw\(.*\)'`
1726 mknod tw$unit c 19 `unit2minor $unit` root:operator
1730 unit=`expr $i : 'cfs\(.*\)'`
1731 mknod cfs$unit c 93 $unit root:operator
1735 unit=`expr $i : 'nsmb\(.*\)'`
1736 mknod nsmb$unit c 144 $unit
1740 mknod elan-mmcr c 100 0 # XXX local major
1745 mknod crypto c 70 0 root:operator
1750 umask 0 # XXX should be elsewhere
1756 echo $i - no such device name