Support enabling daemons in base and pkgsrc like NetBSD and FreeBSD, ie:
[dragonfly.git] / etc / MAKEDEV
blobe702fbdbf687b157c24421756c7072c784817d27
1 #!/bin/sh -
3 # Copyright (c) 1990 The Regents of the University of California.
4 # All rights reserved.
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
23 # $FreeBSD: src/etc/MAKEDEV,v 1.243.2.57 2003/02/10 11:35:53 simokawa Exp $
24 # $DragonFly: src/etc/MAKEDEV,v 1.22 2006/08/25 22:37:08 swildner Exp $
26 # Device "make" file. Valid arguments:
27 # all makes all known devices, standard number of units (or close)
28 # std standard devices
29 # jail suitable for a jail(8)
30 # local configuration specific devices
31 # mach-4 mach4&lites+devices for Mach's XFree86 distribution
32 # (see http://www.cs.hut.fi/lites.html for more info on LITES)
34 # Tapes:
35 # ast* ATAPI tape drives
36 # wt* QIC-interfaced (e.g. not SCSI) 3M cartridge tape
37 # sa* SCSI Sequential Access Devices
39 # Disks:
40 # aac* Adaptec FSA RAID controllers
41 # aacd* Adaptec FSA RAID
42 # acd* ATAPI CD-ROM disks
43 # ad* ATA disks
44 # afd* ATAPI floppy disks
45 # amrd* AMI MegaRAID
46 # cd* SCSI CD-ROM disks
47 # da* SCSI Direct Access Devices
48 # fd* floppy disk drives (3 1/2", 5 1/4")
49 # fla* M-Systems DiskOnChip
50 # idad* Compaq Smart-2 RAID arrays
51 # ips* IBM ServeRAID controller
52 # ipsd* IBM ServeRAID
53 # mcd* Mitsumi CD-ROM disks
54 # md* Memory (or malloc) disk
55 # mlx* Mylex DAC960 RAID controllers
56 # mlxd* Mylex DAC960 RAID disk volumes
57 # pst* Promise SuperTrak RAID disks
58 # scd* Sony CD-ROM disks
59 # vn* vnode disks
61 # Console ports:
62 # vty* virtual console devices for syscons
64 # Pointing devices:
65 # mse* Logitech and ATI Inport bus mouse
66 # psm* PS/2 mouse
67 # jogdial Sony VAIO Jogdial
68 # sysmouse Mousesystems mouse emulator for syscons
70 # Time devices:
71 # refclock-* serial ports used by xntpd parse refclocks
73 # Terminal ports:
74 # tty* general purpose serial ports
75 # cua* dialout serial ports
76 # ttyA* Specialix SI/XIO dialin ports ('*' = number of devices)
77 # cuaA* Specialix SI/XIO dialout ports
78 # ttyD* Digiboard - 16 dialin ports
79 # cuaD* Digiboard - 16 dialout ports
80 # ttyE* Stallion EasyIO (stl) dialin ports
81 # cuaE* Stallion EasyIO (stl) dialout ports
82 # ttyF* Stallion Brumby (stli) dialin ports
83 # cuaF* Stallion Brumby (stli) dialout ports
84 # ttyR* Rocketport dialin ports
85 # cuaR* Rocketport dialout ports
87 # stlN Stallion EasyIO board N dialin and dialout
88 # stliN Stallion Brumby board N dialin and dialout
90 # Pseudo terminals:
91 # pty* set of 32 master and slave pseudo terminals
92 # vty* virtual terminals using syscons console
94 # Parallel port:
95 # lpt* Printer
96 # ppi* Parallel port i/o
97 # pps* Pulse per second timing interface
98 # pcfclock* Parallel time sync interface
100 # I2C and SMBus:
101 # iic* I2C devices
102 # smb* SMBUS devices
104 # USB devices:
105 # usb* USB bus control device
106 # ucom* USB serial devices
107 # ugen* generic USB device
108 # uhid* Human Interface Device (HID)
109 # ulpt* printer
110 # umodem* modems
111 # ums* mouse
112 # urio* Diamond Rio 500
113 # uscanner* USB scanners
115 # SCSI devices (other than CD-ROM, tape and disk):
116 # ch* SCSI Media-Changer (juke box) driver
117 # pt* Processor Type (HP scanner, as one example)
118 # pass* CAM Passthrough device
119 # ses* SES (SCSI Environmental Services) and
120 # SAF-TE (Scsi Accessable Fault-Tolerant Enclosures) device
122 # PC-CARD (previously called PCMCIA) support
123 # card* PC-CARD slots
125 # ISDN devices:
126 # i4b isdnd call control device
127 # i4bctl debugging control device
128 # i4btrc* trace data interface(s), one per passive card
129 # i4btel* telephony interface(s)
130 # i4bteld* telephony dialout interface(s)
131 # i4brbch* raw b channel access device(s)
133 # Special purpose devices:
134 # acpi ACPI control device
135 # apm Advanced Power Management BIOS
136 # apmctl APM BIOS control device
137 # bpf* packet filter
138 # crypto crypto interface
139 # speaker pc speaker
140 # tw* xten power controller
141 # snd* various sound cards
142 # pcaudio PCM audio driver
143 # socksys iBCS2 socket system driver
144 # vat VAT compatibility audio driver (requires snd*)
145 # gsc Genius GS-4500 hand scanner
146 # joy pc joystick
147 # tun* Tunneling IP device
148 # tap* Ethernet Tunneling device
149 # snp* tty snoop devices
150 # spigot Video Spigot video acquisition card
151 # ctx* Cortex-I video acquisition card
152 # meteor* Matrox Meteor video acquisition card (pci)
153 # bktr* Bt848 based video acquisition card (pci)
154 # labpc* National Instrument's Lab-PC and LAB-PC+
155 # perfmon CPU performance-monitoring counters
156 # pci PCI configuration-space access from user mode
157 # ipl ipfilter control devices (ipl, ipnat, ipstate, ipauth)
158 # kbd keyboard devices
159 # elan-mmcr AMD Elan support (e.g. mmap MMCR)
160 # agpgart AGP interface
161 # nsmb* SMB/CIFS protocol interface
162 # pf PF packet filter
164 ##############################################################################
166 # To override the default ownership and/or permissions, you now have the
167 # /etc/devices.conf file (create it if it's not there). Entries in this file
168 # should look like:
170 # ad0s1c root:staff 666 # Override ad0s1c
171 # ad0* root:wheel 641 # Override the entire ad0 family
172 # sa0.ctl heinz:ketchup 444 # Override device control node
173 # sa*.ctl heinz:ketchup 666 # Override all sa* control nodes
174 # fd/4 ihate:floppies 000 # Override /dev/fd/4
176 # See the devices.conf(5) man page for further information.
178 # J.Anslik (joerg@anslik.de)
180 ##############################################################################
184 #-----------------------------------------------------------------------------
185 # Where all device special files are built.
186 #-----------------------------------------------------------------------------
188 DEVDIR=dev
191 #-----------------------------------------------------------------------------
192 # File containing local ownership and permissions override entries.
193 #-----------------------------------------------------------------------------
195 DEVPERMS_LOCAL="/etc/devices.conf"
198 #-----------------------------------------------------------------------------
199 # Some useful programs.
200 #-----------------------------------------------------------------------------
202 cut=/usr/bin/cut
203 grep=/usr/bin/grep
204 mknod=/sbin/mknod
205 sed=/usr/bin/sed
206 tr=/usr/bin/tr
209 #-----------------------------------------------------------------------------
210 # Set up a default search path.
211 #-----------------------------------------------------------------------------
213 if [ -n "$MAKEDEVPATH" ]
214 then
215 PATH="$MAKEDEVPATH"
216 else
217 PATH=/sbin:/bin
221 #-----------------------------------------------------------------------------
222 # Print error message $2 and exit this script, returning $1.
223 #-----------------------------------------------------------------------------
225 die()
227 echo $2
229 exit $1
233 #-----------------------------------------------------------------------------
234 # Convert integer to partition name.
235 #-----------------------------------------------------------------------------
237 dkitop()
239 local p
241 case $1 in
242 0) p=a;; 1) p=b;; 2) p=c;; 3) p=d;;
243 4) p=e;; 5) p=f;; 6) p=g;; 7) p=h;;
244 8) p=i;; 9) p=j;; 10) p=k;; 11) p=l;;
245 12) p=m;; 13) p=n;; 14) p=o;; 15) p=p;;
246 *) p="?";;
247 esac
249 echo $p
253 #-----------------------------------------------------------------------------
254 # Convert integer to slice name.
255 #-----------------------------------------------------------------------------
257 dkitos()
259 local s
261 case $1 in
262 0|1) s="" ;;
263 *) s=s$(($1-1)) ;;
264 esac
266 echo $s
269 #-----------------------------------------------------------------------------
270 # Convert disk|type|unit|slice|partition to minor number.
271 #-----------------------------------------------------------------------------
273 dkminor()
275 echo $(($1 << 25 | ($2 / 32) << 21 | \
276 ($2 % 32) << 3 | $3 << 16 | \
277 ($4 & 7) | ($4 & 8) << 17))
281 #-----------------------------------------------------------------------------
282 # Create the device node.
283 #-----------------------------------------------------------------------------
285 mknod() {
287 local dev=$1
288 local unit=$2
290 #---------------------------------------------------------------------
291 # Remove old device node, if any.
292 #---------------------------------------------------------------------
294 rm -f "$dev$unit" || exit 1
297 #---------------------------------------------------------------------
298 # Supply default ownership and/or permissions according to the
299 # number of parameters passed to this function.
300 #---------------------------------------------------------------------
302 case $# in
303 5) owner=root:wheel; perms=600;;
304 6) owner=$6; perms=600;;
305 7) owner=$6; perms=$7;;
306 *) die 2 "Bad call: mknod $@";;
307 esac
310 #---------------------------------------------------------------------
311 # Get rid of first two parameters (no longer needed)
312 #---------------------------------------------------------------------
314 shift; shift
317 #---------------------------------------------------------------------
318 # If there's a /etc/devices.conf file, check for local overrides.
319 #---------------------------------------------------------------------
321 if [ -s $DEVPERMS_LOCAL ]
322 then
323 #-------------------------------------------------------------
324 # Temporarily prepend the device portion with a subdir name
325 # if we're not in $DEVDIR. We need to do this to distinguish
326 # between device nodes that live in /dev, and device nodes
327 # that live in /dev/subdir, like /dev/fd. This way, we can
328 # have "fd*" entries in the permission files, as well as
329 # "fd/*" stuff.
330 #-------------------------------------------------------------
332 tmpdev=$dev
333 pwd=`/usr/bin/basename $PWD`
335 [ "$pwd" = "$DEVDIR" ] || dev="${pwd}/$dev"
338 #-------------------------------------------------------------
339 # Check /etc/devices.conf for local overrides
340 #-------------------------------------------------------------
342 match=`$grep ^$dev$unit[[:space:]] $DEVPERMS_LOCAL | \
343 $sed 's/\*/\\\*/'`
345 [ "$match" ] ||
346 if [ `expr "$unit" : '\(.*\)\.ctl$'` ]
347 then
348 match=`$grep ^$dev\\\*\\\.ctl[[:space:]] \
349 $DEVPERMS_LOCAL | $sed 's/\*/\\\*/'`
350 else
351 match=`$grep ^$dev\\\*[[:space:]] $DEVPERMS_LOCAL | \
352 $sed 's/\*/\\\*/'`
355 if [ "$match" ]
356 then
357 # Separate each field by one space character...
358 match=`echo $match | $tr -s "[:space:]" " "`
360 # ...and extract owenership and permissions.
361 owner=`echo $match | $cut -d' ' -f2`
362 perms=`echo $match | $cut -d' ' -f3`
365 #-------------------------------------------------------------
366 # Restore "plain" device name (no prepending subdir name).
367 #-------------------------------------------------------------
369 dev=$tmpdev
372 #---------------------------------------------------------------------
373 # Finally, set ownership and permissions.
374 #---------------------------------------------------------------------
376 $mknod $dev$unit $1 $2 $3 $owner
377 chmod $perms $dev$unit
381 #-----------------------------------------------------------------------------
382 # Convert tape (ctrl, unit, mode, access) to device minor number.
383 #-----------------------------------------------------------------------------
385 saminor()
387 echo $(($1 << 29 | ($2 / 16) << 16 | ($2 % 16) << 4 | $3 << 2 | $4))
391 #-----------------------------------------------------------------------------
392 # Convert the last character of a tty name to a device minor number.
393 #-----------------------------------------------------------------------------
395 ttyminor()
397 case $1 in
398 [0-9]) m=$1;;
399 a) m=10;; b) m=11;; c) m=12;; d) m=13;;
400 e) m=14;; f) m=15;; g) m=16;; h) m=17;;
401 i) m=18;; j) m=19;; k) m=20;; l) m=21;;
402 m) m=22;; n) m=23;; o) m=24;; p) m=25;;
403 q) m=26;; r) m=27;; s) m=28;; t) m=29;;
404 u) m=30;; v) m=31;;
405 *) m="?";;
406 esac
408 echo $m
412 #-----------------------------------------------------------------------------
413 # Convert a unit number to a device minor number.
414 #-----------------------------------------------------------------------------
416 unit2minor()
418 echo $(((($1 >> 8) << 16) | ($1 % 256)))
422 #-----------------------------------------------------------------------------
423 # Stallion devices need some (weird) special treatment.
424 #-----------------------------------------------------------------------------
426 stallion()
428 major=$1
429 letter=$2
430 card=$3
431 iscallout=$4
433 port=0
434 maxport=8
435 pref=tty
436 owner=
437 minorbase=0
439 if [ $iscallout -gt 0 ]
440 then
441 pref=cua
442 owner=uucp:dialer
443 minorbase=128
446 case "$card" in
447 [0-7]);;
448 *) die 1 "Invalid stl card number $card";;
449 esac
451 # Make the mem interface for extracting stats & loading microcode.
452 # 0x1000000 + card number
453 mknod staliomem $card c $major 0x0100000$card
455 while [ $port -lt $maxport ]
457 minor=$(($minorbase + $card * 1048576 + $port))
459 [ $port -lt 32 ] || minor=$(($minor + 65504))
461 unit=$(($card * 64 + $port))
463 mknod ${pref}${letter} $unit c $major $minor $owner
464 mknod ${pref}i${letter} $unit c $major $(($minor + 32)) $owner
465 mknod ${pref}l${letter} $unit c $major $(($minor + 64)) $owner
467 port=$(($port + 1))
468 done
472 #-----------------------------------------------------------------------------
473 # Do it.
474 #-----------------------------------------------------------------------------
476 for i in $*; do
477 case $i in
479 all)
480 sh MAKEDEV std # standard
481 sh MAKEDEV fd0 fd1 # bdev, floppy disk
482 sh MAKEDEV da0 da1 da2 da3 da4 da5 da6 da7 # bdev, SCSI disk
483 sh MAKEDEV da8 da9 da10 da11 da12 da13 da14 # bdev, SCSI disk
484 sh MAKEDEV da15 # bdev, SCSI disk
485 sh MAKEDEV ata # cdev, ATA control
486 sh MAKEDEV ad0 ad1 ad2 ad3 ad4 ad5 ad6 ad7 # bdev, ATA disk
487 sh MAKEDEV ar0 ar1 # bdev, ATA RAID disk
488 sh MAKEDEV acd0 afd0 ast0 # bdev, ATAPI devices
489 sh MAKEDEV vn0 # bdev, virtual disk
490 sh MAKEDEV cd0 mcd0 scd0 # bdev, cdrom
491 sh MAKEDEV sa0 wt0 # bdev, tape
492 sh MAKEDEV vty12 # cdev, virtual tty
493 sh MAKEDEV cuaa0 cuaa1 cuaa2 cuaa3 # cdev, serial tty
494 sh MAKEDEV pty0 # cdev, pseudo tty
495 sh MAKEDEV ttyd0 ttyd1 ttyd2 ttyd3 # cdev, serial tty
496 sh MAKEDEV kbd0 kbd1 # cdev, keyboard
497 sh MAKEDEV mse0 psm0 jogdial sysmouse # cdev, mouse
498 sh MAKEDEV pcaudio speaker snd0 # cdev, noise
499 sh MAKEDEV ipsd0 # cdev, ServeRAID disk
500 sh MAKEDEV lpt0 lpt1 lpt2 # cdev, printer
501 sh MAKEDEV ppi0 ppi1 ppi2 # cdev, parallel port
502 sh MAKEDEV iic0 iic1 # cdev, I2C device
503 sh MAKEDEV smb0 smb1 # cdev, SMBus device
504 sh MAKEDEV usb usb0 uhid0 ums0 ulpt0 ugen0 # cdev, USB devices
505 sh MAKEDEV usb1 uhid1 ums1 ulpt1 ugen1 # cdev, USB devices
506 sh MAKEDEV usb2 usb3 usb4 usb5 # cdev, USB devices
507 sh MAKEDEV urio0 uscanner0 umodem0 # cdev, USB devices too
508 sh MAKEDEV bpf0 bpf1 bpf2 bpf3 # cdev, network
509 sh MAKEDEV ipl tun0 tun1 tun2 tun3 # cdev, network
510 sh MAKEDEV tap0 tap1 tap2 tap3 # cdev, network
511 sh MAKEDEV ch0 perfmon tw0 # cdev, miscellaneous
512 sh MAKEDEV acpi # cdev, laptop
513 sh MAKEDEV apm apmctl card0 card1 card2 card3 # cdev, laptop
514 sh MAKEDEV pass4 xpt2 # cdev, CAM
515 sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN
516 sh MAKEDEV i4btel0 i4btel1 i4bteld0 i4bteld1 # cdev, ISDN
517 sh MAKEDEV i4brbch0 i4brbch1 # cdev, ISDN
518 sh MAKEDEV agpgart # cdev, AGP
519 sh MAKEDEV nsmb0 # cdev, SMB/CIFS
520 sh MAKEDEV twed0 # 3ware
521 sh MAKEDEV crypto # cdev, crypto
522 sh MAKEDEV fw0 # cdev, firewire
523 sh MAKEDEV dcons # cdev, dcons
524 sh MAKEDEV pf # pf
528 #-----------------------------------------------------------------------------
529 # A much restricted set of the above, to save precious i-nodes on the
530 # fixit floppy
531 #-----------------------------------------------------------------------------
533 fixit)
534 sh MAKEDEV std # standard
535 sh MAKEDEV fd0 # bdev, floppy disk
536 sh MAKEDEV da0 # bdev, SCSI disk
537 sh MAKEDEV ad0 # bdev, ATA disk
538 sh MAKEDEV acd0 afd0 ast0 # bdev, ATAPI devices
539 sh MAKEDEV vn0 # bdev, virtual disk
540 sh MAKEDEV cd0 # bdev, cdrom
541 sh MAKEDEV sa0 # bdev, tape
542 sh MAKEDEV vty2 # cdev, virtual tty
543 sh MAKEDEV cuaa0 # cdev, serial tty
544 sh MAKEDEV pty0 # cdev, pseudo tty
545 sh MAKEDEV ttyd0 # cdev, serial tty
546 sh MAKEDEV kbd0 # cdev, keyboard
547 sh MAKEDEV mse0 psm0 sysmouse # cdev, mouse
548 sh MAKEDEV lpt0 # cdev, printer
549 sh MAKEDEV ppi0 # cdev, parallel port
550 sh MAKEDEV iic0 # cdev, I2C device
551 sh MAKEDEV smb0 # cdev, SMBus device
552 sh MAKEDEV ums0 # cdev, USB devices
553 sh MAKEDEV tun0 # cdev, network
554 sh MAKEDEV tap0 # cdev, network
555 sh MAKEDEV ch0 # cdev, miscellaneous
556 sh MAKEDEV apm apmctl card0 # cdev, laptop
557 sh MAKEDEV pass1 xpt1 # cdev, CAM
558 sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN
559 sh MAKEDEV i4btel0 i4bteld0 # cdev, ISDN
560 sh MAKEDEV i4brbch0 # cdev, ISDN
561 rm -f fd/[1-9]?
564 #-----------------------------------------------------------------------------
565 # Basic device node set.
566 #-----------------------------------------------------------------------------
568 std)
569 mknod console "" c 0 0
570 mknod kmem "" c 2 1 root:kmem 640
571 mknod mem "" c 2 0 root:kmem 640
572 mknod null "" c 2 2 root:wheel 666
573 mknod random "" c 2 3 root:wheel 644
574 mknod urandom "" c 2 4 root:wheel 644
575 mknod zero "" c 2 12 root:wheel 666
576 mknod io "" c 2 14
577 mknod tty "" c 1 0 root:wheel 666
578 mknod klog "" c 7 0
579 mknod stdin "" c 22 0 root:wheel 666
580 mknod stdout "" c 22 1 root:wheel 666
581 mknod stderr "" c 22 2 root:wheel 666
582 mknod pci "" c 78 0 root:wheel 644
585 #---------------------------------------------------------------------
586 # Create floppy disk nodes in /dev/fd
587 #---------------------------------------------------------------------
589 mkdir -p fd
591 (cd fd &&
592 i=0 &&
593 while [ $i -lt 64 ]
595 mknod $i "" c 22 $i root:wheel 666
597 i=$(($i + 1))
598 done)
600 chmod 555 fd
603 #-----------------------------------------------------------------------------
605 jail)
606 sh MAKEDEV std pty0
608 rm mem kmem pci io klog console
610 ln -sf null mem
611 ln -sf null kmem
612 ln -sf null console
615 #-----------------------------------------------------------------------------
617 mach-4)
618 mknod iopl "" c 22 0
619 mknod kbd "" c 23 0
620 mknod mouse "" c 24 0
621 mknod time "" c 25 0
622 mknod timezone "" c 26 0
625 #-----------------------------------------------------------------------------
627 wt*)
628 u=`expr $i : '..\(.*\)'`
630 [ "$u" ] || u=0
632 # Default density, 512b blocks
633 mknod rwt $u c 10 $((0 + $u)) root:operator 660
634 mknod nrwt $u c 10 $((4 + $u)) root:operator 660
636 # Default density, 1024b blocks
637 # mknod rWt $u c 10 $((64 + $u)) root:operator 660
638 # mknod nrWt $u c 10 $((68 + $u)) root:operator 660
639 mknod rwt ${u}b c 10 $((16 + $u)) root:operator 660 # 60 MB
640 mknod nrwt ${u}b c 10 $((20 + $u)) root:operator 660
641 mknod rwt ${u}c c 10 $((24 + $u)) root:operator 660 # 120 MB
642 mknod nrwt ${u}c c 10 $((28 + $u)) root:operator 660
643 mknod rwt ${u}d c 10 $((32 + $u)) root:operator 660 # 150 MB
644 mknod nrwt ${u}d c 10 $((36 + $u)) root:operator 660
645 # mknod rwt ${u}e c 10 $((40 + $u)) root:operator 660 # 300 MB?
646 # mknod nrwt ${u}e c 10 $((44 + $u)) root:operator 660
647 # mknod rwt ${u}f c 10 $((48 + $u)) root:operator 660 # 600 MB?
648 # mknod nrwt ${u}f c 10 $((52 + $u)) root:operator 660
651 #-----------------------------------------------------------------------------
653 aacd*s*|ad*s*|ar*s*|afd*s*|amrd*s*|da*s*|fla*s*|idad*s*|ipsd*s*|md*s*|mlxd*s*|pst*s*|twed*s*|vn*s*)
654 case $i in
655 aacd*s*) name=aacd; chr=151;;
656 ad*s*) name=ad; chr=116;;
657 ar*s*) name=ar; chr=157;;
658 afd*s*) name=afd; chr=118;;
659 amrd*s*) name=amrd; chr=133;;
660 da*s*) name=da; chr=13;;
661 fla*s*) name=fla; chr=102;;
662 idad*s*) name=idad; chr=109;;
663 ipsd*s*) name=ipsd; chr=176;;
664 md*s*) name=md; chr=95;;
665 mlxd*s*) name=mlxd; chr=131;;
666 pst*s*) name=pst; chr=168;;
667 twed*s*) name=twed; chr=147;;
668 vn*s*) name=vn; chr=43;;
669 esac
671 case $i in
672 aacd*s*|amrd*s*|idad*s*|ipsd*s*|mlxd*s*|twed*s*)
673 unit=`expr $i : '....\([0-9]*\)s'`
674 slice=`expr $i : '....[0-9]*s\([0-9]*\)'`
675 part=`expr $i : '....[0-9]*s[0-9]*\(.*\)'`
678 afd*s*|fla*s*|pst*s*|wfd*s*)
679 unit=`expr $i : '...\([0-9]*\)s'`
680 slice=`expr $i : '...[0-9]*s\([0-9]*\)'`
681 part=`expr $i : '...[0-9]*s[0-9]*\(.*\)'`
684 unit=`expr $i : '..\([0-9]*\)s'`
685 slice=`expr $i : '..[0-9]*s\([0-9]*\)'`
686 part=`expr $i : '..[0-9]*s[0-9]*\(.*\)'`
688 esac
690 case $unit in
691 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
692 case $slice in
693 [0-9]|[1-2][0-9]|30)
694 oldslice=$slice
695 slice=$(($slice+1))
696 slicename=`dkitos $slice`
697 minor=`dkminor 0 $unit $slice 2`
698 mknod $name $unit$slicename c $chr $minor \
699 root:operator 640
700 rm -f r$name$unit$slicename
702 case $part in [a-h])
703 [ $oldslice -ne 0 ]|| slice=$oldslice
705 for part in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
707 minor=`dkminor 0 $unit $slice $part`
708 partname=`dkitop $part`
709 mknod $name $unit$slicename$partname \
710 c $chr $minor root:operator 640
711 rm -f r$name$unit$slicename$partname
712 done
715 "") ;;
716 *) echo bad partition for disk in: $i
718 esac
721 echo bad slice for disk in: $i
723 esac
726 echo bad unit for disk in: $i "(unit=$unit, slice=$slice, part=$part)"
728 esac
731 #-----------------------------------------------------------------------------
733 fd*)
734 unit=`expr $i : '..\(.*\)'`
735 name=fd; chr=9
737 case $unit in
738 0|1|2|3)
739 mknod $name $unit c $chr $(($unit * 64)) root:operator 640
740 rm -f r$name$unit
741 # Fake BSD partitions
742 for i in a b c d e f g h
744 ln -f $name$unit $name$unit$i
745 rm -f r$name$unit r$name$unit$i
746 done
747 # User-readable and programmer-readable name sets
749 mknod $name ${unit}.1720 c $chr $(($unit * 64 + 1)) \
750 root:operator 640
751 rm -f r${name}${unit}.1720
752 # ln -f $name${unit}.1720 ${name}${unit}135hs21
753 # rm -f r$name${unit}135hs21
755 mknod $name ${unit}.1480 c $chr $(($unit * 64 + 2)) \
756 root:operator 640
757 rm -f r$name${unit}.1480
758 # ln -f $name${unit}.1480 ${name}${unit}135hs18
759 # rm -f r$name${unit}135hs18
760 # ln -f $name${unit}.1480 ${name}${unit}96hs18
761 # rm -f r$name${unit}96hs18
763 mknod $name ${unit}.1440 c $chr $(($unit * 64 + 3)) \
764 root:operator 640
765 rm -f r$name${unit}.1440
766 # ln -f $name${unit}.1440 $name${unit}135
767 # rm -f r$name${unit}135
768 # ln -f $name${unit}.1440 $name${unit}135ds18
769 # rm -f r$name${unit}135ds18
770 # ln -f $name${unit}.1440 $name${unit}96ds18
771 # rm -f r$name${unit}96ds18
773 mknod $name ${unit}.1200 c $chr $(($unit * 64 + 4)) \
774 root:operator 640
775 rm -f r$name${unit}.1200
776 # ln -f $name${unit}.1200 $name${unit}96
777 # rm -f r$name${unit}96
778 # ln -f $name${unit}.1200 $name${unit}96ds15
779 # rm -f r$name${unit}96ds15
780 # ln -f $name${unit}.1200 $name${unit}135ds15
781 # rm -f r$name${unit}135ds15
783 mknod $name ${unit}.820 c $chr $(($unit * 64 + 5)) \
784 root:operator 640
785 rm -f r$name${unit}.820
786 # ln -f $name${unit}.820 $name${unit}96hs10
787 # rm -f r$name${unit}96hs10
788 # ln -f $name${unit}.820 $name${unit}135hs10
789 # rm -f r$name${unit}135hs10
791 mknod $name ${unit}.800 c $chr $(($unit * 64 + 6)) \
792 root:operator 640
793 rm -f r$name${unit}.800
794 # ln -f $name${unit}.800 $name${unit}96ds10
795 # rm -f r$name${unit}96ds10
796 # ln -f $name${unit}.800 $name${unit}135ds10
797 # rm -f r$name${unit}135ds10
799 mknod $name ${unit}.720 c $chr $(($unit * 64 + 7)) \
800 root:operator 640
801 rm -f r$name${unit}.720
802 # ln -f $name${unit}.720 $name${unit}96ds9
803 # rm -f r$name${unit}96ds9
804 # ln -f $name${unit}.720 $name${unit}135ds9
805 # rm -f r$name${unit}135ds9
807 mknod $name ${unit}.360 c $chr $(($unit * 64 + 8)) \
808 root:operator 640
809 rm -f r$name${unit}.360
810 # ln -f $name${unit}.360 $name${unit}48
811 # rm -f r$name${unit}48
812 # ln -f $name${unit}.360 $name${unit}48ds9
813 # rm -f r$name${unit}48ds9
815 mknod $name ${unit}.640 c $chr $(($unit * 64 + 9)) \
816 root:operator 640
817 rm -f r$name${unit}.640
818 # ln -f $name${unit}.640 $name${unit}96ds8
819 # rm -f r$name${unit}96ds8
820 # ln -f $name${unit}.640 $name${unit}135ds8
821 # rm -f r$name${unit}135ds8
823 mknod $name ${unit}.1232 c $chr $(($unit * 64 + 10)) \
824 root:operator 640
825 rm -f r$name${unit}.1232
826 # ln -f $name${unit}.1232 $name${unit}96ds8
827 # rm -f r$name${unit}96ds8
828 # ln -f $name${unit}.1232 $name${unit}135ds8
829 # rm -f r$name${unit}135ds8
832 echo bad unit for disk in: $i
834 esac
837 #-----------------------------------------------------------------------------
839 aacd*|ad*|ar*|afd*|amrd*|da*|fla*|idad*|ipsd*|md*|mlxd*|pst*|twed*|vn*)
840 case $i in
841 aacd*) name=aacd; chr=151;;
842 ad*) name=ad; chr=116;;
843 ar*) name=ar; chr=157;;
844 afd*) name=afd; chr=118;;
845 amrd*) name=amrd; chr=133;;
846 da*) name=da; chr=13;;
847 fla*) name=fla; chr=102;;
848 idad*) name=idad; chr=109;;
849 ipsd*) name=ipsd; chr=176;;
850 md*) name=md; chr=95;;
851 mlxd*) name=mlxd; chr=131;;
852 pst*) name=pst; chr=168;;
853 twed*) name=twed; chr=147;;
854 vn*) name=vn; chr=43;;
855 esac
857 case $i in
858 aacd*|amrd*|idad*|ipsd*|mlxd*|twed*)
859 unit=`expr $i : '....\(.*\)'`
861 afd*|fla*|pst*|wfd*)
862 unit=`expr $i : '...\(.*\)'`
865 unit=`expr $i : '..\(.*\)'`
867 esac
869 case $unit in
870 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
871 for slicepartname in s0h s1h s2 s3 s4
873 sh MAKEDEV $name$unit$slicepartname
874 done
877 echo bad unit for disk in: $i
879 esac
882 #-----------------------------------------------------------------------------
884 ccd*)
885 name=ccd
886 chr=74
887 unit=`expr $i : '...\(.*\)'`
889 case $unit in
890 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
891 for part in 0 1 2 3 4 5 6 7
893 minor=`dkminor 0 $unit 0 $part`
894 partname=`dkitop $part`
895 mknod $name $unit$partname c $chr $minor \
896 root:operator 640
897 rm -f r$name$unit$partname
898 done
902 echo bad unit for disk in: $i
904 esac
907 #-----------------------------------------------------------------------------
909 pt[0-9]*)
910 chr=61
911 name=pt
912 unit=`expr $i : 'pt\([0-9][0-9]*\)'`
914 [ "$unit" ] || unit=0
916 unit=$(($unit + 1 - 1))
917 mknod $name $unit c $chr `unit2minor $unit`
920 #-----------------------------------------------------------------------------
922 ses[0-9]*)
923 chr=110
924 name=ses
925 unit=`expr $i : 'ses\([0-9][0-9]*\)'`
927 [ "$unit" ] || unit=0
929 unit=$(($unit + 1 - 1))
930 mknod $name $unit c $chr `unit2minor $unit`
933 #-----------------------------------------------------------------------------
935 targ[0-9]*)
936 chr=65
937 name=targ
938 unit=`expr $i : 'targ\([0-9][0-9]*\)'`
940 [ "$unit" ] || unit=0
942 unit=$(($unit + 1 - 1))
944 mknod $name $unit c $chr `unit2minor $unit`
945 mknod ${name}.ctl "" c $chr 0xffff00ff
948 #-----------------------------------------------------------------------------
950 # CAM transport layer device
951 xpt*)
952 # This major number is temporary
953 chr=104
954 name=xpt
955 units=`expr $i : 'xpt\(.*\)'`
957 [ "$units" ] || units=1
960 while [ $i -lt $units ]
962 rm -rf $name$i
964 mknod $name $i c $chr `unit2minor $i` root:operator
966 i=$(($i + 1))
967 done
970 #-----------------------------------------------------------------------------
972 pass*)
973 # This major number is temporary
974 chr=31
975 name=pass
976 units=`expr $i : 'pass\(.*\)'`
978 [ "$units" ] || units=1
981 while [ $i -lt $units ]
983 rm -rf $name$i
985 mknod $name $i c $chr `unit2minor $i` root:operator
987 i=$(($i + 1))
988 done
991 #-----------------------------------------------------------------------------
993 pty*)
994 class=`expr $i : 'pty\(.*\)'`
995 case $class in
996 0) offset=0 name=p;;
997 1) offset=32 name=q;;
998 2) offset=64 name=r;;
999 3) offset=96 name=s;;
1000 4) offset=128 name=P;; # Note that xterm (at least) only look at p-s.
1001 5) offset=160 name=Q;;
1002 6) offset=192 name=R;;
1003 7) offset=224 name=S;;
1004 *) echo bad unit for pty in: $i;;
1005 esac
1007 case $class in
1008 0|1|2|3|4|5|6|7)
1010 while [ $i -lt 32 ]
1012 c=$(echo 0123456789abcdefghijklmnopqrstuv |
1013 dd bs=1 skip=$i count=1 2>/dev/null)
1015 mknod tty$name $c c 5 $(($offset + $i)) root:wheel 666
1016 mknod pty$name $c c 6 $(($offset + $i)) root:wheel 666
1018 i=$(($i + 1))
1019 done
1021 esac
1024 #-----------------------------------------------------------------------------
1026 sa*)
1027 unit=`expr $i : '..\(.*\)'`
1028 chr=14
1030 case $unit in
1031 [0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9])
1032 mknod sa ${unit}.ctl c $chr `saminor 1 ${unit} 0 0` \
1033 root:wheel 660
1034 ln -f sa${unit}.ctl rsa${unit}.ctl
1036 for m in 0 1 2 3
1038 mknod sa ${unit}.$m c $chr \
1039 `saminor 0 $unit $m 0` root:operator 660
1040 ln -f sa${unit}.$m rsa${unit}.$m
1042 mknod nsa ${unit}.$m c $chr \
1043 `saminor 0 $unit $m 1` root:operator 660
1044 ln -f nsa${unit}.$m nrsa${unit}.$m
1046 mknod esa ${unit}.$m c $chr \
1047 `saminor 0 $unit $m 2` root:operator 660
1048 ln -f esa${unit}.$m ersa${unit}.$m
1049 done
1051 ln -f sa${unit}.0 sa$unit
1052 ln -f sa${unit}.0 rsa${unit}.0
1053 ln -f sa${unit}.0 rsa$unit
1054 ln -f nsa${unit}.0 nsa$unit
1055 ln -f nsa${unit}.0 nrsa${unit}.0
1056 ln -f nsa${unit}.0 nrsa$unit
1057 ln -f esa${unit}.0 esa$unit
1058 ln -f esa${unit}.0 ersa${unit}.0
1059 ln -f esa${unit}.0 ersa$unit
1062 echo bad unit for tape in: $i
1064 esac
1067 #-----------------------------------------------------------------------------
1069 ch*)
1070 unit=`expr $i : '..\(.*\)'`
1072 case $i in
1073 ch*) name=ch; chr=17;;
1074 esac
1076 case $unit in
1077 0|1|2|3|4|5|6)
1078 mknod $name $unit c $chr $unit root:operator 640
1081 echo bad unit for media changer in: $i
1083 esac
1086 #-----------------------------------------------------------------------------
1088 ata)
1089 mknod ata "" c 159 0 root:operator
1092 #-----------------------------------------------------------------------------
1094 ast*)
1095 unit=`expr $i : '...\(.*\)'`
1096 chr=119
1098 case $unit in
1099 0|1|2|3)
1100 mknod ast $unit c $chr $(($unit * 8 + 0)) root:operator 640
1101 mknod nast $unit c $chr $(($unit * 8 + 1)) root:operator 640
1104 echo bad unit for tape in: $i
1106 esac
1109 #-----------------------------------------------------------------------------
1111 acd*t*)
1112 units=`expr $i : '...\(.*\)t'`;
1113 tracks=`expr $i : '.*t\(.*\)'`;
1114 name=acd;
1115 chr=117;
1117 [ "$units" ] || units=0
1118 [ "$tracks" ] || tracks=100
1120 if [ "$units" -le 31 -a "$tracks" -le 169 ]
1121 then
1123 while [ $i -le $units ]
1125 dname=$name$i
1126 rm -rf ${dname}t*
1129 while [ $j -le $tracks ]
1131 mknod ${dname}t $j c $chr \
1132 $((($i * 8) + (65536 * $j))) \
1133 root:operator 640
1135 j=$(($j + 1))
1136 done
1138 i=$(($i + 1))
1139 done
1140 else
1141 echo "$i is invalid -- can't have more than 32 cd devices or 169 tracks"
1145 #-----------------------------------------------------------------------------
1147 acd*|cd*|mcd*|scd*)
1148 case $i in
1149 acd*) units=`expr $i : '...\(.*\)'`; name=acd; chr=117;;
1150 cd*) units=`expr $i : '..\(.*\)'` ; name=cd; chr=15;;
1151 mcd*) units=`expr $i : '...\(.*\)'`; name=mcd; chr=29;;
1152 scd*) units=`expr $i : '...\(.*\)'`; name=scd; chr=45;;
1153 esac
1155 [ "$units" ] || units=0
1157 if [ "$units" -le 31 ]
1158 then
1160 while [ $i -le $units ]
1162 dname=$name$i
1163 rm -rf ${dname}*
1164 mknod $name ${i}a c $chr $(($i * 8)) root:operator 640
1166 case $name in
1167 acd) ln -f ${dname}a ${dname}c;;
1168 *) mknod $name ${i}c c $chr $(($i * 8 + 2)) \
1169 root:operator 640;;
1170 esac
1172 rm -f r${dname}a
1173 rm -f r${dname}c
1175 i=$(($i + 1))
1176 done
1177 else
1178 echo "$i is invalid -- can't have more than 32 cd devices"
1182 #-----------------------------------------------------------------------------
1184 iic*)
1185 unit=`expr $i : 'iic\(.*\)'`
1187 mknod iic $unit c 105 `unit2minor $unit`
1190 #-----------------------------------------------------------------------------
1192 smb*)
1193 unit=`expr $i : 'smb\(.*\)'`
1195 mknod smb $unit c 106 `unit2minor $unit`
1198 #-----------------------------------------------------------------------------
1200 pcfclock*)
1201 unit=`expr $i : 'pcfclock\(.*\)'`
1203 mknod pcfclock $unit c 140 `unit2minor $unit`
1206 #-----------------------------------------------------------------------------
1208 ppi*)
1209 unit=`expr $i : 'ppi\(.*\)'`
1211 mknod ppi $unit c 82 `unit2minor $unit`
1214 #-----------------------------------------------------------------------------
1216 pps*)
1217 unit=`expr $i : 'pps\(.*\)'`
1219 mknod pps $unit c 89 `unit2minor $unit`
1222 #-----------------------------------------------------------------------------
1224 usb)
1225 mknod usb "" c 108 255 root:operator 0660
1228 #-----------------------------------------------------------------------------
1230 usb*)
1231 unit=`expr $i : 'usb\(.*\)'`
1233 mknod usb $unit c 108 `unit2minor $unit` root:operator 660
1236 #-----------------------------------------------------------------------------
1238 ucom*)
1239 unit=`expr $i : 'ucom\(.*\)'`
1241 minor=$(($unit + 128))
1242 minor=`unit2minor $(($unit + 128))`
1244 mknod ucom $unit c 138 $minor uucp:dialer 660
1247 #-----------------------------------------------------------------------------
1249 uhid*)
1250 unit=`expr $i : 'uhid\(.*\)'`
1252 mknod uhid $unit c 122 `unit2minor $unit` root:operator 660
1255 #-----------------------------------------------------------------------------
1257 ums*)
1258 unit=`expr $i : 'ums\(.*\)'`
1260 mknod ums $unit c 111 `unit2minor $unit` root:operator 660
1263 #-----------------------------------------------------------------------------
1265 ulpt*)
1266 unit=`expr $i : 'ulpt\(.*\)'`
1268 minor=`unit2minor $unit`
1269 mknod ulpt $unit c 113 $minor
1271 minor=`unit2minor $(($unit + 64))`
1272 mknod unlpt $unit c 113 $minor # and the 'no prime' version
1275 #-----------------------------------------------------------------------------
1277 ugen*)
1278 unit=`expr $i : 'ugen\([0-9][0-9]*\)'`
1279 endpoint=`expr $i : 'ugen.*\.\([0-9][0-9]*\)'`
1281 [ "$unit" ] || echo $i - Invalid unit number
1283 if [ -z "${endpoint}" ] # ugen0 & ugen0.1 - ugen0.15
1284 then
1285 mknod ugen $unit c 114 `unit2minor $(($unit * 16))` \
1286 root:operator 660
1288 while [ $i -lt 16 ]
1290 mknod ugen $unit.$i c 114 `unit2minor \
1291 $(($unit * 16 + $i))` root:operator 660
1293 i=$(($i + 1))
1294 done
1295 else
1296 minor=`unit2minor $(($unit * 16 + $endpoint))`
1297 mknod ugen $unit.$endpoint c 114 $minor root:operator 660
1301 #-----------------------------------------------------------------------------
1303 urio*)
1304 unit=`expr $i : 'urio\(.*\)'`
1306 mknod urio $unit c 143 `unit2minor $unit` root:operator 660
1309 #-----------------------------------------------------------------------------
1311 uscanner*)
1312 unit=`expr $i : 'uscanner\(.*\)'`
1314 mknod uscanner $unit c 156 `unit2minor $unit` root:operator 660
1317 #-----------------------------------------------------------------------------
1319 umodem*)
1320 unit=`expr $i : 'umodem\(.*\)'`
1322 mknod umodem $unit c 124 `unit2minor $unit` uucp:dialer 660
1325 #-----------------------------------------------------------------------------
1327 lpt*)
1328 unit=`expr $i : 'lpt\(.*\)'`
1330 mknod lpt $unit c 16 `unit2minor $unit`
1331 mknod lpctl $unit c 16 `unit2minor $(($unit + 128))`
1334 #-----------------------------------------------------------------------------
1336 vty*)
1337 chr=12
1338 units=`expr $i : 'vty\(.*\)'`
1341 while [ $i -lt $units ]
1343 mknod ttyv $(printf %01x $i) c $chr `unit2minor $i`
1345 i=$(($i + 1))
1346 done
1348 ln -fs ttyv0 vga
1351 #-----------------------------------------------------------------------------
1353 nmdm*)
1354 units=`expr $i : 'nmdm\(.*\)'`
1355 chr=18
1358 while [ $i -lt $units ]
1360 minor=`unit2minor $i`
1361 minor=$(($minor + $minor))
1362 mknod nmdm ${i}A c $chr $minor
1363 mknod nmdm ${i}B c $chr $(($minor + 1))
1365 i=$(($i + 1))
1366 done
1369 #-----------------------------------------------------------------------------
1371 bpf*)
1372 nbpf=`expr $i : 'bpf\(.*\)$'`
1374 unit=0
1375 while [ $unit -le $nbpf ]
1377 mknod bpf $unit c 23 `unit2minor $unit`
1379 unit=$(($unit + 1))
1380 done
1383 #-----------------------------------------------------------------------------
1385 speaker)
1386 mknod speaker "" c 26 0
1389 #-----------------------------------------------------------------------------
1391 cua?|cuaa?|cuaa??)
1392 unit_low=`expr $i : 'cua.*\(.\)$'`
1394 case $i in
1395 cua?|cuaa?)
1396 unit_high=""
1397 m_high=0
1399 cuaa??)
1400 unit_high=`expr $i : 'cuaa\(.\).$'`
1401 m_high=`ttyminor $unit_high`
1403 esac
1405 unit=$unit_high$unit_low
1406 m=$(($m_high << 16 | `ttyminor $unit_low`))
1408 mknod cuaa $unit c 28 $(($m | 128)) uucp:dialer 660
1409 mknod cuaia $unit c 28 $(($m | 32 | 128)) uucp:dialer 660
1410 mknod cuala $unit c 28 $(($m | 64 | 128)) uucp:dialer 660
1413 #-----------------------------------------------------------------------------
1415 crypto)
1416 mknod crypto "" c 70 0 root:operator 666
1419 #-----------------------------------------------------------------------------
1422 mknod pf "" c 73 0 root:operator 600
1425 #-----------------------------------------------------------------------------
1427 fw?)
1428 unit=`expr $i : 'fw\(.\)$'`
1430 for sub in 0 1 2 3
1432 minor=$(($unit << 16 | $sub))
1433 mknod fw $unit.$sub c 127 $minor root:operator 660
1434 mknod fwmem $unit.$sub c 127 $((1<<24 | $minor)) \
1435 root:operator 660
1436 done
1438 ln -sf fw$unit.0 fw$unit
1439 ln -sf fwmem$unit.0 fwmem$unit
1442 #-----------------------------------------------------------------------------
1444 dcons)
1445 mknod dcons "" c 184 0 root:wheel 600
1448 #-----------------------------------------------------------------------------
1450 tty?|tty0?|ttyd?|ttyd??)
1451 unit_low=`expr $i : 'tty.*\(.\)$'`
1453 case $i in
1454 tty?|tty0?|ttyd?)
1455 unit_high=""
1456 m_high=0
1458 ttyd??)
1459 unit_high=`expr $i : 'ttyd\(.\).$'`
1460 m_high=`ttyminor $unit_high`
1462 esac
1464 unit=$unit_high$unit_low
1465 m=$(($m_high << 16 | `ttyminor $unit_low`))
1467 mknod ttyd $unit c 28 $m
1468 mknod ttyid $unit c 28 $(($m | 32))
1469 mknod ttyld $unit c 28 $(($m | 64))
1472 #-----------------------------------------------------------------------------
1474 cuac?)
1475 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1476 g h i j k l m n o p q r s t u v"
1477 major=48
1478 card=`expr $i : 'cua.*\(.\)$'`
1480 for unit in $portlist
1482 minor=`ttyminor $unit`
1483 minor=$(($card * 65536 + $minor))
1484 name=$card$unit
1486 mknod cuac $name c $major $(($minor + 128)) uucp:dialer 660
1487 mknod cuaic $name c $major $(($minor + 32 + 128)) \
1488 uucp:dialer 660
1489 mknod cualc $name c $major $(($minor + 64 + 128)) \
1490 uucp:dialer 660
1491 done
1494 #-----------------------------------------------------------------------------
1496 ttyc?)
1497 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1498 g h i j k l m n o p q r s t u v"
1499 major=48
1500 card=`expr $i : 'tty.*\(.\)$'`
1502 for unit in $portlist
1504 minor=`ttyminor $unit`
1505 minor=$(($card * 65536 + $minor))
1506 name=$card$unit
1508 mknod ttyc $name c $major $minor
1509 mknod ttyic $name c $major $(($minor + 32))
1510 mknod ttylc $name c $major $(($minor + 64))
1511 done
1514 #-----------------------------------------------------------------------------
1516 cuam?)
1517 unit=`expr $i : 'cua.*\(.\)$'`
1519 m=`ttyminor $unit`
1521 mknod cuam $unit c 63 $(($m + 128)) uucp:dialer 660
1524 #-----------------------------------------------------------------------------
1526 ttym?)
1527 unit=`expr $i : 'tty.*\(.\)$'`
1529 m=`ttyminor $unit`
1531 mknod ttym $unit c 63 $m
1534 #-----------------------------------------------------------------------------
1536 ttyA*)
1537 major=68
1538 nports=`expr $i : 'ttyA\(.*\)$'`
1539 port=1
1541 while [ $port -le $nports ]
1543 minor=$(($port - 1))
1544 name=$(printf %02d $port)
1546 mknod ttyA $name c $major $minor
1547 mknod ttyiA $name c $major $(($minor + 65536))
1548 mknod ttylA $name c $major $(($minor + 131072))
1550 port=$(($port + 1))
1551 done
1553 # For the user-mode control program, 'sicontrol'
1554 mknod si_control "" c 68 262144
1557 #-----------------------------------------------------------------------------
1559 cuaA*)
1560 major=68
1561 nports=`expr $i : 'cuaA\(.*\)$'`
1562 port=1
1564 while [ $port -le $nports ]
1566 minor=$(($port - 1))
1567 name=$(printf %02d $port)
1569 mknod cuaA $name c $major $(($minor + 128)) uucp:dialer 660
1570 mknod cuaiA $name c $major $(($minor + 128 + 65536)) \
1571 uucp:dialer 660
1572 mknod cualA $name c $major $(($minor + 128 + 131072)) \
1573 uucp:dialer 660
1575 port=$(($port + 1))
1576 done
1579 #-----------------------------------------------------------------------------
1581 ttyD?)
1582 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1583 major=58
1584 card=`expr $i : 'tty.*\(.\)$'`
1586 for unit in $portlist
1588 minor=`ttyminor $unit`
1589 minor=$(($card * 65536 + $minor))
1590 name=$card$unit
1592 mknod ttyD $name c $major $minor
1593 mknod ttyiD $name c $major $(($minor + 32))
1594 mknod ttylD $name c $major $(($minor + 64))
1595 done
1598 #-----------------------------------------------------------------------------
1600 cuaD?)
1601 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1602 major=58
1603 card=`expr $i : 'cua.*\(.\)$'`
1605 for unit in $portlist
1607 minor=`ttyminor $unit`
1608 minor=$(($card * 65536 + $minor))
1609 name=$card$unit
1611 mknod cuaD $name c $major $(($minor + 128)) uucp:dialer 660
1612 mknod cuaiD $name c $major $(($minor + 32 + 128)) \
1613 uucp:dialer 660
1614 mknod cualD $name c $major $(($minor + 64 + 128)) \
1615 uucp:dialer 660
1616 done
1619 #-----------------------------------------------------------------------------
1621 ttyE*)
1622 stallion 72 E `expr $i : 'tty.*\(.\)$'` 0
1624 cuaE*)
1625 stallion 72 E `expr $i : 'cua.*\(.\)$'` 1
1627 stl*)
1628 card=`expr $i : 'stl\(.\)$'`
1629 stallion 72 E $card 0
1630 stallion 72 E $card 1
1633 ttyF*)
1634 stallion 75 F `expr $i : 'tty.*\(.\)$'` 0
1636 cuaF*)
1637 stallion 75 F `expr $i : 'cua.*\(.\)$'` 1
1639 stli*)
1640 card=`expr $i : 'stl\(.\)$'`
1641 stallion 75 F $card 0
1642 stallion 75 F $card 1
1645 ttyM*)
1646 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1647 modulelist="a b c d"
1648 major=101
1649 card=`expr $i : 'tty.*\(.\)$'`
1651 for unit in $modulelist
1653 moduleminor=`ttyminor $unit`
1654 moduleminor=$(($moduleminor % 10 * 16))
1655 modulename=$unit
1657 for unit in $portlist
1659 minor=`ttyminor $unit`
1660 minor=$(($card * 65536 + $minor + $moduleminor))
1661 name=$card$modulename$unit
1663 rm -f tty*M$name
1665 mknod ttyM $name c $major $minor
1666 mknod ttyiM $name c $major $(($minor + 64))
1667 mknod ttylM $name c $major $(($minor + 128))
1668 done
1669 done
1672 cuaM?)
1673 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1674 modulelist="a b c d"
1675 major=101
1676 card=`expr $i : 'cua.*\(.\)$'`
1678 for unit in $modulelist
1680 moduleminor=`ttyminor $unit`
1681 moduleminor=$(($moduleminor % 10 * 16))
1682 modulename=$unit
1684 for unit in $portlist
1686 minor=`ttyminor $unit`
1687 minor=$(($card * 65536 + $minor + $moduleminor))
1688 name=$card$modulename$unit
1690 rm -f cua*M$name
1692 mknod cuaM $name c $major $(($minor + 262144)) \
1693 uucp:dialer 660
1694 mknod cuaiM $name c $major $(($minor + 64 + 262144)) \
1695 uucp:dialer 660
1696 mknod cualM $name c $major $(($minor + 128 + 262144)) \
1697 uucp:dialer 660
1698 done
1699 done
1702 ttyR?)
1703 major=81
1704 BOARD=1; Rnum=0
1705 MINOR=$(($BOARD * 65536))
1706 controllers=$(
1707 dmesg | while read first rest
1709 case "$first" in
1710 RocketPort[0-4]) echo "$first"
1712 esac
1713 done)
1715 rm -f ttyR* ttyiR* ttylR*
1717 for i in $controllers
1719 ndevices=$(
1720 dmesg | while read first bar ports rest
1722 case "$first" in
1723 $i*) echo "$ports"
1725 esac
1726 done)
1728 echo -n "Creating $ndevices devices for $i: "
1729 dev=0
1731 while [ $dev -lt $ndevices ]
1733 mknod ttyR $Rnum c $major $MINOR
1734 mknod ttyiR $Rnum c $major $(($MINOR + 32))
1735 mknod ttylR $Rnum c $major $(($MINOR + 64))
1737 Rnum=$(($Rnum + 1))
1738 MINOR=$(($MINOR + 1))
1740 dev=$(($dev + 1))
1741 done
1743 BOARD=$(($BOARD + 1))
1744 MINOR=$(($BOARD * 65536))
1745 echo " "
1746 done
1749 cuaR?)
1750 major=81
1751 BOARD=1; Rnum=0
1752 MINOR=$(($BOARD * 65536))
1753 controllers=$(
1754 dmesg | while read first rest
1756 case "$first" in
1757 RocketPort[0-4]) echo "$first"
1759 esac
1760 done)
1762 rm -f cuaR* cuaiR* cualR*
1764 for i in $controllers
1766 ndevices=$(
1767 dmesg | while read first bar ports rest
1769 case "$first" in
1770 $i*) echo "$ports"
1772 esac
1773 done)
1775 echo -n "Creating $ndevices devices for $i: "
1776 dev=0
1778 while [ $dev -lt $ndevices ]
1780 mknod cuaR $Rnum c $major $(($MINOR + 128)) \
1781 uucp:dialer 660
1782 mknod cuaiR $Rnum c $major $(($MINOR + 128 + 32)) \
1783 uucp:dialer 660
1784 mknod cualR $Rnum c $major $(($MINOR + 128 + 64)) \
1785 uucp:dialer 660
1787 Rnum=$(($Rnum + 1))
1788 MINOR=$(($MINOR + 1))
1790 dev=$(($dev + 1))
1791 done
1793 BOARD=$(($BOARD + 1))
1794 MINOR=$(($BOARD * 65536))
1795 echo " "
1796 done
1799 #-----------------------------------------------------------------------------
1801 mse*)
1802 unit=`expr $i : 'mse\(.*\)'`
1803 chr=27
1805 # Non-blocking for X11
1806 mknod mse $unit c $chr `unit2minor $(($unit * 2 + 1))`
1809 #-----------------------------------------------------------------------------
1811 psm*)
1812 unit=`expr $i : 'psm\(.*\)'`
1813 chr=21
1815 # Non-blocking for X11
1816 mknod psm $unit c $chr `unit2minor $(($unit * 2 + 1))`
1819 #-----------------------------------------------------------------------------
1821 mouse*)
1822 name=`expr $i : 'mouse\(.*\)'`
1824 [ -c $name ] || $0 $name # Make the appropriate device
1826 ln -fs $name mouse
1829 #-----------------------------------------------------------------------------
1831 pcaudio)
1832 mknod pcaudio "" c 24 0
1833 mknod pcaudioctl "" c 24 128
1836 #-----------------------------------------------------------------------------
1838 socksys)
1839 mknod socksys "" c 41 0 root:wheel 666
1840 mknod spx "" c 41 1 root:wheel 666
1842 ln -fs socksys nfsd
1845 #-----------------------------------------------------------------------------
1847 snd*)
1849 unit=`expr $i : 'snd\(.*\)'`
1850 chr=30
1852 ln -fs mixer$unit mixer
1853 ln -fs sequencer$unit sequencer
1854 ln -fs dsp$unit dsp
1855 ln -fs audio$unit audio
1856 ln -fs dspW$unit dspW
1857 ln -fs music$unit music
1858 ln -fs pss$unit pss
1859 ln -fs dsp$unit.0 dsp$unit
1860 ln -fs audio$unit.0 audio$unit
1861 ln -fs dspW$unit.0 dspW$unit
1863 mknod mixer $unit c $chr `unit2minor $(($unit * 16 + 0))` \
1864 root:wheel 666
1865 mknod sequencer $unit c $chr `unit2minor $(($unit * 16 + 1))` \
1866 root:wheel 666
1867 mknod midi $unit c $chr `unit2minor $(($unit * 16 + 2))` \
1868 root:wheel 666
1870 for chn in 0 1 2 3
1872 minor=$(($chn * 65536 + $unit * 16))
1874 mknod dsp $unit.$chn c $chr $(($minor + 3)) root:wheel 666
1875 mknod audio $unit.$chn c $chr $(($minor + 4)) root:wheel 666
1876 mknod dspW $unit.$chn c $chr $(($minor + 5)) root:wheel 666
1877 done
1879 mknod sndstat "" c $chr 6 root:wheel 666
1880 mknod music $unit c $chr `unit2minor $(($unit * 16 + 8))` root:wheel 666
1881 mknod pss $unit c $chr `unit2minor $(($unit * 16 + 9))` root:wheel 666
1884 #-----------------------------------------------------------------------------
1886 vat)
1887 mknod vatio "" c 25 128 root:wheel 660
1890 #-----------------------------------------------------------------------------
1892 gsc*)
1893 unit=`expr $i : 'gsc\(.*\)'`
1895 mknod gsc $unit c 47 `unit2minor $unit` root:wheel 666
1896 mknod gsc ${unit}p c 47 `unit2minor $(($unit + 8))` root:wheel 666
1897 mknod gsc ${unit}d c 47 `unit2minor $(($unit + 32))` root:wheel 666
1898 mknod gsc ${unit}pd c 47 `unit2minor $(($unit + 40))` root:wheel 666
1901 #-----------------------------------------------------------------------------
1903 acpi)
1904 mknod acpi "" c 152 0 root:operator 664
1907 #-----------------------------------------------------------------------------
1909 apm)
1910 mknod apm "" c 39 0 root:operator 664
1913 #-----------------------------------------------------------------------------
1915 apmctl)
1916 mknod apmctl "" c 39 8 root:operator 660
1919 #-----------------------------------------------------------------------------
1921 card*)
1922 unit=`expr $i : 'card\(.*\)'`
1923 chr=50
1925 mknod card $unit c $chr `unit2minor $unit` root:wheel 644
1928 #-----------------------------------------------------------------------------
1930 ttyx?|ttyy?|ttyz?)
1931 case $i in
1932 *0) unit=0;; *1) unit=1;; *2) unit=2;; *3) unit=3;;
1933 *4) unit=4;; *5) unit=5;; *6) unit=6;; *7) unit=7;;
1934 *8) unit=8;; *9) unit=9;; *a) unit=10;; *b) unit=11;;
1935 *c) unit=12;; *d) unit=13;; *e) unit=14;; *f) unit=15;;
1936 esac
1938 case $i in
1939 ttyy?) unit=$(($unit + 16));;
1940 ttyz?) unit=$(($unit + 32));;
1941 esac
1943 mknod $i "" c 42 $unit
1946 #-----------------------------------------------------------------------------
1948 cronyx)
1949 mknod cronyx "" c 42 63
1952 #-----------------------------------------------------------------------------
1954 joy)
1955 mknod joy 0 c 51 0 root:operator 640
1956 mknod joy 1 c 51 1 root:operator 640
1959 #-----------------------------------------------------------------------------
1961 spigot)
1962 mknod spigot "" c 11 0 root:wheel 444
1965 #-----------------------------------------------------------------------------
1967 ctx?)
1968 unit=`expr $i : 'ctx\(.*\)'`
1970 mknod ctx $unit c 40 `unit2minor $unit` root:wheel 444
1973 #-----------------------------------------------------------------------------
1975 meteor?)
1976 unit=`expr $i : 'meteor\(.*\)'`
1978 mknod meteor $unit c 67 `unit2minor $unit` root:wheel 444
1981 #-----------------------------------------------------------------------------
1983 bktr?)
1984 unit=`expr $i : 'bktr\(.*\)'`
1986 mknod bktr $unit c 92 `unit2minor $unit` root:wheel 444
1987 mknod tuner $unit c 92 `unit2minor $((16 + $unit))` root:wheel 444
1988 mknod vbi $unit c 92 `unit2minor $((32 + $unit))` root:wheel 444
1991 #-----------------------------------------------------------------------------
1993 tun*)
1994 ntun=`expr $i : 'tun\(.*\)$'`
1995 unit=0
1997 while [ $unit -le $ntun ]
1999 mknod tun $unit c 52 `unit2minor $unit`
2001 unit=$(($unit + 1))
2002 done
2005 #-----------------------------------------------------------------------------
2007 tap*)
2008 ntap=`expr $i : 'tap\(.*\)$'`
2009 unit=0
2011 while [ $unit -le $ntap ]
2013 mknod tap $unit c 149 `unit2minor $unit` root:network
2015 unit=$(($unit + 1))
2016 done
2019 #-----------------------------------------------------------------------------
2021 sysmouse)
2022 mknod sysmouse "" c 12 128
2023 mknod consolectl "" c 12 255
2026 #-----------------------------------------------------------------------------
2028 jogdial)
2029 mknod jogdial "" c 160 0
2032 #-----------------------------------------------------------------------------
2034 snp?)
2035 unit=`expr $i : 'snp\(.*\)'`
2037 mknod snp $unit c 53 `unit2minor $unit`
2040 #-----------------------------------------------------------------------------
2042 labpc*)
2043 case $i in
2044 labpcaio*)
2045 name=labpcaio
2046 unit=`expr $i : 'labpcaio\(.*\)'`
2047 all="0 1 2 3 4 5 6 7"
2048 offset=0
2051 labpcdio*)
2052 name=labpcdio
2053 unit=`expr $i : 'labpcdio\(.*\)'`
2054 all="0 1 2 3"
2055 offset=8
2059 die 3 "Don't know LabPC type $i"
2061 esac
2063 [ "${unit}" ] || unit=all
2065 case $unit in
2066 0|1|2|3|4|5|6|7)
2067 mknod $name $unit c 66 $(($offset + $unit)) \
2068 root:wheel 660
2071 all)
2072 for i in $all
2074 mknod $name $i c 66 $(($offset + $i)) \
2075 root:wheel 660
2076 done
2080 echo "No such LabPC unit: $unit"
2082 esac
2085 #-----------------------------------------------------------------------------
2087 perfmon)
2088 mknod perfmon "" c 2 32 root:kmem 640
2091 #-----------------------------------------------------------------------------
2093 ipl)
2094 mknod ipl "" c 79 0
2095 mknod ipnat "" c 79 1
2096 mknod ipstate "" c 79 2
2097 mknod ipauth "" c 79 3
2100 #-----------------------------------------------------------------------------
2102 elan*)
2103 mknod elan-mmcr "" c 100 0 root:wheel 600
2106 #-----------------------------------------------------------------------------
2108 kbd*)
2109 unit=`expr $i : 'kbd\(.*\)'`
2110 chr=112
2112 mknod kbd $unit c $chr `unit2minor $unit`
2115 #-----------------------------------------------------------------------------
2117 i4b)
2118 mknod i4b "" c 60 0
2121 i4bctl)
2122 mknod i4bctl "" c 55 0
2125 i4brbch*)
2126 unit=`expr $i : 'i4brbch\(.*\)'`
2128 mknod i4brbch $unit c 57 `unit2minor $unit`
2131 i4bteld*)
2132 offset=64
2133 unit=`expr $i : 'i4bteld\(.*\)'`
2135 mknod i4bteld $unit c 56 `unit2minor $(($offset + $unit))`
2138 i4btel*)
2139 unit=`expr $i : 'i4btel\(.*\)'`
2141 mknod i4btel $unit c 56 `unit2minor $unit`
2144 i4btrc*)
2145 unit=`expr $i : 'i4btrc\(.*\)'`
2147 mknod i4btrc $unit c 59 `unit2minor $unit`
2150 #-----------------------------------------------------------------------------
2152 aac*)
2153 unit=`expr $i : 'aac\(.*\)'`
2155 mknod aac $unit c 150 `unit2minor $unit`
2157 ln -fs aac$unit afa$unit
2158 ln -fs aac$unit hpn$unit
2161 #-----------------------------------------------------------------------------
2163 mlx*)
2164 unit=`expr $i : 'mlx\(.*\)'`
2166 mknod mlx $unit c 130 `unit2minor $unit`
2169 #-----------------------------------------------------------------------------
2171 amr*)
2172 unit=`expr $i : 'amr\(.*\)'`
2174 mknod amr $unit c 132 `unit2minor $unit`
2177 #-----------------------------------------------------------------------------
2179 ips*)
2180 unit=`expr $i : 'ips\(.*\)'`
2182 mknod mlx $unit c 175 `unit2minor $unit`
2185 #-----------------------------------------------------------------------------
2187 ciss*)
2188 unit=`expr $i : 'ciss\(.*\)'`
2190 mknod ciss $unit c 166 `unit2minor $unit`
2193 #-----------------------------------------------------------------------------
2195 agpgart)
2196 mknod agpgart "" c 148 0
2199 #-----------------------------------------------------------------------------
2201 twe*)
2202 unit=`expr $i : 'twe\(.*\)'`
2204 mknod twe $unit c 146 `unit2minor $unit`
2207 #-----------------------------------------------------------------------------
2209 tw*)
2210 unit=`expr $i : 'tw\(.*\)'`
2212 mknod tw $unit c 19 `unit2minor $unit` root:operator
2215 #-----------------------------------------------------------------------------
2217 nsmb*)
2218 unit=`expr $i : 'nsmb\(.*\)'`
2220 mknod nsmb $unit c 144 $unit
2223 #-----------------------------------------------------------------------------
2225 local)
2226 umask 0
2227 sh MAKEDEV.local
2228 umask 77
2231 #-----------------------------------------------------------------------------
2234 echo $i - no such device name
2237 esac
2238 done