Merge commit 'chlamydia/master'
[dragonfly.git] / etc / MAKEDEV
blobdfe9967fa2ac1e1f7f307fafb7f3dfe42b087351
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.43 2008/11/19 07:46:05 hasso 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 # ccd* CCD disks
47 # cd* SCSI CD-ROM disks
48 # da* SCSI Direct Access Devices
49 # fd* floppy disk drives (3 1/2", 5 1/4")
50 # idad* Compaq Smart-2 RAID arrays
51 # ips* IBM ServeRAID controller
52 # ipsd* IBM ServeRAID
53 # md* Memory (or malloc) disk
54 # mlx* Mylex DAC960 RAID controllers
55 # mlxd* Mylex DAC960 RAID disk volumes
56 # pst* Promise SuperTrak RAID disks
57 # vn* vnode disks
58 # vkd* virtual kernel disk
60 # Console ports:
61 # vty* virtual console devices for syscons
63 # Pointing devices:
64 # mse* Logitech and ATI Inport bus mouse
65 # psm* PS/2 mouse
66 # jogdial Sony VAIO Jogdial
67 # sysmouse Mousesystems mouse emulator for syscons
69 # Terminal ports:
70 # tty* general purpose serial ports
71 # cua* dialout serial ports
72 # ttyA* Specialix SI/XIO dialin ports ('*' = number of devices)
73 # cuaA* Specialix SI/XIO dialout ports
74 # ttyD* Digiboard - 16 dialin ports
75 # cuaD* Digiboard - 16 dialout ports
76 # ttyE* Stallion EasyIO (stl) dialin ports
77 # cuaE* Stallion EasyIO (stl) dialout ports
78 # ttyF* Stallion Brumby (stli) dialin ports
79 # cuaF* Stallion Brumby (stli) dialout ports
80 # ttyR* Rocketport dialin ports
81 # cuaR* Rocketport dialout ports
83 # stlN Stallion EasyIO board N dialin and dialout
84 # stliN Stallion Brumby board N dialin and dialout
86 # Pseudo terminals:
87 # pty* set of 32 master and slave pseudo terminals
88 # vty* virtual terminals using syscons console
90 # Parallel port:
91 # lpt* Printer
92 # ppi* Parallel port i/o
93 # pps* Pulse per second timing interface
94 # pcfclock* Parallel time sync interface
96 # I2C and SMBus:
97 # iic* I2C devices
98 # smb* SMBUS devices
100 # USB devices:
101 # usb* USB bus control device
102 # ucom* USB serial devices
103 # ugen* generic USB device
104 # uhid* Human Interface Device (HID)
105 # ulpt* printer
106 # umodem* modems
107 # ums* mouse
108 # urio* Diamond Rio 500
109 # uscanner* USB scanners
111 # SCSI devices (other than CD-ROM, tape and disk):
112 # ch* SCSI Media-Changer (juke box) driver
113 # pt* Processor Type (HP scanner, as one example)
114 # pass* CAM Passthrough device
115 # ses* SES (SCSI Environmental Services) and
116 # SAF-TE (SCSI Accessible Fault-Tolerant Enclosures) device
118 # PC-CARD (previously called PCMCIA) support
119 # card* PC-CARD slots
121 # ISDN devices:
122 # i4b isdnd call control device
123 # i4bctl debugging control device
124 # i4btrc* trace data interface(s), one per passive card
125 # i4btel* telephony interface(s)
126 # i4bteld* telephony dialout interface(s)
127 # i4brbch* raw b channel access device(s)
129 # Special purpose devices:
130 # acpi ACPI control device
131 # apm Advanced Power Management BIOS
132 # apmctl APM BIOS control device
133 # bpf* packet filter
134 # crypto crypto interface
135 # speaker pc speaker
136 # tw* xten power controller
137 # snd* various sound cards
138 # pcaudio PCM audio driver
139 # socksys iBCS2 socket system driver
140 # vat VAT compatibility audio driver (requires snd*)
141 # gsc Genius GS-4500 hand scanner
142 # joy pc joystick
143 # tun* Tunneling IP device
144 # tap* Ethernet Tunneling device
145 # snp* tty snoop devices
146 # spigot Video Spigot video acquisition card
147 # ctx* Cortex-I video acquisition card
148 # meteor* Matrox Meteor video acquisition card (pci)
149 # bktr* Bt848 based video acquisition card (pci)
150 # labpc* National Instrument's Lab-PC and LAB-PC+
151 # perfmon CPU performance-monitoring counters
152 # pci PCI configuration-space access from user mode
153 # ipl ipfilter control devices (ipl, ipnat, ipstate, ipauth)
154 # kbd keyboard devices
155 # elan-mmcr AMD Elan support (e.g. mmap MMCR)
156 # agpgart AGP interface
157 # nsmb* SMB/CIFS protocol interface
158 # pf PF packet filter
159 # cmx Omnikey CardMan 4040 smartcard reader
160 # devctl devctl(4) interface
162 ##############################################################################
164 # To override the default ownership and/or permissions, you now have the
165 # /etc/devices.conf file (create it if it's not there). Entries in this file
166 # should look like:
168 # ad0s1c root:staff 666 # Override ad0s1c
169 # ad0* root:wheel 641 # Override the entire ad0 family
170 # sa0.ctl heinz:ketchup 444 # Override device control node
171 # sa*.ctl heinz:ketchup 666 # Override all sa* control nodes
172 # fd/4 ihate:floppies 000 # Override /dev/fd/4
174 # See the devices.conf(5) man page for further information.
176 # J.Anslik (joerg@anslik.de)
178 ##############################################################################
182 #-----------------------------------------------------------------------------
183 # Where all device special files are built.
184 #-----------------------------------------------------------------------------
186 DEVDIR=dev
189 #-----------------------------------------------------------------------------
190 # File containing local ownership and permissions override entries.
191 #-----------------------------------------------------------------------------
193 DEVPERMS_LOCAL="/etc/devices.conf"
196 #-----------------------------------------------------------------------------
197 # Some useful programs.
198 #-----------------------------------------------------------------------------
200 cut=/usr/bin/cut
201 grep=/usr/bin/grep
202 mknod=/sbin/mknod
203 sed=/usr/bin/sed
204 tr=/usr/bin/tr
207 #-----------------------------------------------------------------------------
208 # Set up a default search path.
209 #-----------------------------------------------------------------------------
211 if [ -n "$MAKEDEVPATH" ]
212 then
213 PATH="$MAKEDEVPATH"
214 else
215 PATH=/sbin:/bin
219 #-----------------------------------------------------------------------------
220 # Print error message $2 and exit this script, returning $1.
221 #-----------------------------------------------------------------------------
223 die()
225 echo $2
227 exit $1
231 #-----------------------------------------------------------------------------
232 # Convert integer to partition name.
233 #-----------------------------------------------------------------------------
235 dkitop()
237 local p
239 case $1 in
240 0) p=a;; 1) p=b;; 2) p=c;; 3) p=d;;
241 4) p=e;; 5) p=f;; 6) p=g;; 7) p=h;;
242 8) p=i;; 9) p=j;; 10) p=k;; 11) p=l;;
243 12) p=m;; 13) p=n;; 14) p=o;; 15) p=p;;
244 *) p="?";;
245 esac
247 echo $p
251 #-----------------------------------------------------------------------------
252 # Convert integer to slice name.
253 #-----------------------------------------------------------------------------
255 dkitos()
257 local s
259 case $1 in
260 0) s="s0" ;;
261 1) s="" ;;
262 *) s=s$(($1-1)) ;;
263 esac
265 echo $s
268 #-----------------------------------------------------------------------------
269 # Convert unit, slice, partition to minor number.
270 #-----------------------------------------------------------------------------
272 # ndkminor(unit, slice, partition)
274 ndkminor()
276 echo $(( (($1 & 31) << 3) | (($1 & 480) << 16) | \
277 (($2 & 15) << 16) | (($2 & 112) << 25) | \
278 ($3 & 7) | (($3 & 8) << 17) | (($3 & 240) << 21) ))
282 #-----------------------------------------------------------------------------
283 # Create the device node.
284 #-----------------------------------------------------------------------------
286 mknod() {
288 local dev=$1
289 local unit=$2
291 #---------------------------------------------------------------------
292 # Remove old device node, if any.
293 #---------------------------------------------------------------------
295 rm -f "$dev$unit" || exit 1
298 #---------------------------------------------------------------------
299 # Supply default ownership and/or permissions according to the
300 # number of parameters passed to this function.
301 #---------------------------------------------------------------------
303 case $# in
304 5) owner=root:wheel; perms=600;;
305 6) owner=$6; perms=600;;
306 7) owner=$6; perms=$7;;
307 *) die 2 "Bad call: mknod $@";;
308 esac
311 #---------------------------------------------------------------------
312 # Get rid of first two parameters (no longer needed)
313 #---------------------------------------------------------------------
315 shift; shift
318 #---------------------------------------------------------------------
319 # If there's a /etc/devices.conf file, check for local overrides.
320 #---------------------------------------------------------------------
322 if [ -s $DEVPERMS_LOCAL ]
323 then
324 #-------------------------------------------------------------
325 # Temporarily prepend the device portion with a subdir name
326 # if we're not in $DEVDIR. We need to do this to distinguish
327 # between device nodes that live in /dev, and device nodes
328 # that live in /dev/subdir, like /dev/fd. This way, we can
329 # have "fd*" entries in the permission files, as well as
330 # "fd/*" stuff.
331 #-------------------------------------------------------------
333 tmpdev=$dev
334 pwd=`/usr/bin/basename $PWD`
336 [ "$pwd" = "$DEVDIR" ] || dev="${pwd}/$dev"
339 #-------------------------------------------------------------
340 # Check /etc/devices.conf for local overrides
341 #-------------------------------------------------------------
343 match=`$grep ^$dev$unit[[:space:]] $DEVPERMS_LOCAL | \
344 $sed 's/\*/\\\*/'`
346 [ "$match" ] ||
347 if [ `expr "$unit" : '\(.*\)\.ctl$'` ]
348 then
349 match=`$grep ^$dev\\\*\\\.ctl[[:space:]] \
350 $DEVPERMS_LOCAL | $sed 's/\*/\\\*/'`
351 else
352 match=`$grep ^$dev\\\*[[:space:]] $DEVPERMS_LOCAL | \
353 $sed 's/\*/\\\*/'`
356 if [ "$match" ]
357 then
358 # Separate each field by one space character...
359 match=`echo $match | $tr -s "[:space:]" " "`
361 # ...and extract owenership and permissions.
362 owner=`echo $match | $cut -d' ' -f2`
363 perms=`echo $match | $cut -d' ' -f3`
366 #-------------------------------------------------------------
367 # Restore "plain" device name (no prepending subdir name).
368 #-------------------------------------------------------------
370 dev=$tmpdev
373 #---------------------------------------------------------------------
374 # Finally, set ownership and permissions.
375 #---------------------------------------------------------------------
377 $mknod $dev$unit $1 $2 $3 $owner
378 chmod $perms $dev$unit
382 #-----------------------------------------------------------------------------
383 # Convert tape (ctrl, unit, mode, access) to device minor number.
384 #-----------------------------------------------------------------------------
386 saminor()
388 echo $(($1 << 29 | ($2 / 16) << 16 | ($2 % 16) << 4 | $3 << 2 | $4))
392 #-----------------------------------------------------------------------------
393 # Convert the last character of a tty name to a device minor number.
394 #-----------------------------------------------------------------------------
396 ttyminor()
398 case $1 in
399 [0-9]) m=$1;;
400 a) m=10;; b) m=11;; c) m=12;; d) m=13;;
401 e) m=14;; f) m=15;; g) m=16;; h) m=17;;
402 i) m=18;; j) m=19;; k) m=20;; l) m=21;;
403 m) m=22;; n) m=23;; o) m=24;; p) m=25;;
404 q) m=26;; r) m=27;; s) m=28;; t) m=29;;
405 u) m=30;; v) m=31;;
406 *) m="?";;
407 esac
409 echo $m
413 #-----------------------------------------------------------------------------
414 # Convert a unit number to a device minor number.
415 #-----------------------------------------------------------------------------
417 unit2minor()
419 echo $(((($1 >> 8) << 16) | ($1 % 256)))
423 #-----------------------------------------------------------------------------
424 # Stallion devices need some (weird) special treatment.
425 #-----------------------------------------------------------------------------
427 stallion()
429 major=$1
430 letter=$2
431 card=$3
432 iscallout=$4
434 port=0
435 maxport=8
436 pref=tty
437 owner=
438 minorbase=0
440 if [ $iscallout -gt 0 ]
441 then
442 pref=cua
443 owner=uucp:dialer
444 minorbase=128
447 case "$card" in
448 [0-7]);;
449 *) die 1 "Invalid stl card number $card";;
450 esac
452 # Make the mem interface for extracting stats & loading microcode.
453 # 0x1000000 + card number
454 mknod staliomem $card c $major 0x0100000$card
456 while [ $port -lt $maxport ]
458 minor=$(($minorbase + $card * 1048576 + $port))
460 [ $port -lt 32 ] || minor=$(($minor + 65504))
462 unit=$(($card * 64 + $port))
464 mknod ${pref}${letter} $unit c $major $minor $owner
465 mknod ${pref}i${letter} $unit c $major $(($minor + 32)) $owner
466 mknod ${pref}l${letter} $unit c $major $(($minor + 64)) $owner
468 port=$(($port + 1))
469 done
473 #-----------------------------------------------------------------------------
474 # Do it.
475 #-----------------------------------------------------------------------------
477 for i in $*; do
478 case $i in
480 all)
481 rm -f *.compat
482 sh MAKEDEV std # standard
483 sh MAKEDEV fd0 fd1 # bdev, floppy disk
484 sh MAKEDEV da0 da1 da2 da3 da4 da5 da6 da7 # bdev, SCSI disk
485 sh MAKEDEV da8 da9 da10 da11 da12 da13 da14 # bdev, SCSI disk
486 sh MAKEDEV da15 # bdev, SCSI disk
487 sh MAKEDEV ccd0 ccd1 ccd2 ccd3 # ccd disk
488 sh MAKEDEV ata # cdev, ATA control
489 sh MAKEDEV ad0 ad1 ad2 ad3 ad4 ad5 ad6 ad7 # bdev, ATA disk
490 sh MAKEDEV ar0 ar1 # bdev, ATA RAID disk
491 sh MAKEDEV acd0 afd0 ast0 # bdev, ATAPI devices
492 sh MAKEDEV vn0 vn1 vn2 vn3 # bdev, virtual disk
493 sh MAKEDEV vkd0 # bdev, virtual disk
494 sh MAKEDEV cd0 # bdev, cdrom
495 sh MAKEDEV sa0 wt0 # bdev, tape
496 sh MAKEDEV vty12 # cdev, virtual tty
497 sh MAKEDEV cuaa0 cuaa1 cuaa2 cuaa3 # cdev, serial tty
498 sh MAKEDEV pty0 # cdev, pseudo tty
499 sh MAKEDEV ttyd0 ttyd1 ttyd2 ttyd3 # cdev, serial tty
500 sh MAKEDEV kbd0 kbd1 # cdev, keyboard
501 sh MAKEDEV mse0 psm0 jogdial sysmouse # cdev, mouse
502 sh MAKEDEV pcaudio speaker snd0 # cdev, noise
503 sh MAKEDEV ipsd0 # cdev, ServeRAID disk
504 sh MAKEDEV lpt0 lpt1 lpt2 # cdev, printer
505 sh MAKEDEV ppi0 ppi1 ppi2 # cdev, parallel port
506 sh MAKEDEV iic0 iic1 # cdev, I2C device
507 sh MAKEDEV smb0 smb1 # cdev, SMBus device
508 sh MAKEDEV usb usb0 uhid0 ums0 ulpt0 ugen0 # cdev, USB devices
509 sh MAKEDEV usb1 uhid1 ums1 ulpt1 ugen1 # cdev, USB devices
510 sh MAKEDEV usb2 usb3 usb4 usb5 usb6 usb7 # cdev, USB devices
511 sh MAKEDEV urio0 uscanner0 umodem0 # cdev, USB devices too
512 sh MAKEDEV ucom0 ucom1 ucom2 ucom3 # cdev, USB serial devices
513 sh MAKEDEV bpf0 bpf1 bpf2 bpf3 # cdev, network
514 sh MAKEDEV ipl tun0 tun1 tun2 tun3 # cdev, network
515 sh MAKEDEV tap0 tap1 tap2 tap3 # cdev, network
516 sh MAKEDEV ch0 perfmon tw0 # cdev, miscellaneous
517 sh MAKEDEV acpi # cdev, laptop
518 sh MAKEDEV apm apmctl card0 card1 card2 card3 # cdev, laptop
519 sh MAKEDEV pass4 xpt2 # cdev, CAM
520 sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN
521 sh MAKEDEV i4btel0 i4btel1 i4bteld0 i4bteld1 # cdev, ISDN
522 sh MAKEDEV i4brbch0 i4brbch1 # cdev, ISDN
523 sh MAKEDEV agpgart # cdev, AGP
524 sh MAKEDEV nsmb0 # cdev, SMB/CIFS
525 sh MAKEDEV twed0 # 3ware
526 sh MAKEDEV crypto # cdev, crypto
527 sh MAKEDEV fw0 # cdev, firewire
528 sh MAKEDEV dcons # cdev, dcons
529 sh MAKEDEV pf # pf
530 sh MAKEDEV devctl # cdev, devctl
534 #-----------------------------------------------------------------------------
535 # A much restricted set of the above, to save precious i-nodes on the
536 # fixit floppy
537 #-----------------------------------------------------------------------------
539 fixit)
540 sh MAKEDEV std # standard
541 sh MAKEDEV fd0 # bdev, floppy disk
542 sh MAKEDEV da0 # bdev, SCSI disk
543 sh MAKEDEV ad0 # bdev, ATA disk
544 sh MAKEDEV acd0 afd0 ast0 # bdev, ATAPI devices
545 sh MAKEDEV vn0 # bdev, virtual disk
546 sh MAKEDEV vkd0 # bdev, virtual disk
547 sh MAKEDEV cd0 # bdev, cdrom
548 sh MAKEDEV sa0 # bdev, tape
549 sh MAKEDEV vty2 # cdev, virtual tty
550 sh MAKEDEV cuaa0 # cdev, serial tty
551 sh MAKEDEV pty0 # cdev, pseudo tty
552 sh MAKEDEV ttyd0 # cdev, serial tty
553 sh MAKEDEV kbd0 # cdev, keyboard
554 sh MAKEDEV mse0 psm0 sysmouse # cdev, mouse
555 sh MAKEDEV lpt0 # cdev, printer
556 sh MAKEDEV ppi0 # cdev, parallel port
557 sh MAKEDEV iic0 # cdev, I2C device
558 sh MAKEDEV smb0 # cdev, SMBus device
559 sh MAKEDEV ums0 # cdev, USB devices
560 sh MAKEDEV tun0 # cdev, network
561 sh MAKEDEV tap0 # cdev, network
562 sh MAKEDEV ch0 # cdev, miscellaneous
563 sh MAKEDEV apm apmctl card0 # cdev, laptop
564 sh MAKEDEV pass1 xpt1 # cdev, CAM
565 sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN
566 sh MAKEDEV i4btel0 i4bteld0 # cdev, ISDN
567 sh MAKEDEV i4brbch0 # cdev, ISDN
568 rm -f fd/[1-9]?
571 #-----------------------------------------------------------------------------
572 # Upgrade existing node set.
574 # 1.9 - disk devices have changed
575 #-----------------------------------------------------------------------------
576 upgrade)
577 echo -n "upgrading... "
578 for i in aacd ad ar afd amrd ccd da fd idad ipsd md \
579 mlxd pst twed vn vkd
581 for j in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
583 if [ -c $i$j ]; then
584 rm -f $i$j
585 rm -f $i${j}[a-p]
586 echo -n " $i$j $i${j}s0[a-p] $i${j}s1[a-p]"
587 sh MAKEDEV $i$j
588 # s0 and s1 handled by base
589 for k in s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 \
590 s12 s13 s14 s15
592 if [ -c $i$j${k}c ]; then
593 rm -f ${i}${j}${k}*
594 echo -n " $i$j$k"
595 sh MAKEDEV $i$j$k
596 echo -n " $i$j$k[a-p]"
597 sh MAKEDEV $i$j${k}a
598 elif [ -c $i$j$k ]; then
599 rm -f ${i}${j}${k}*
600 echo -n " $i$j$k"
601 sh MAKEDEV $i$j$k
603 done
605 done
606 done
607 for i in acd cd vcd
609 for j in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
611 if [ -c $i$j ]; then
612 rm -f ${i}${j}*
613 echo -n " $i$j $i${j}s0 $i${j}[a-p]"
614 sh MAKEDEV $i$j
615 elif [ -c $i${j}c ]; then
616 rm -f ${i}${j}*
617 echo -n " $i$j $i${j}s0 $i${j}[a-p]"
618 sh MAKEDEV $i$j
620 done
621 done
622 echo ""
625 #-----------------------------------------------------------------------------
626 # Basic device node set.
627 #-----------------------------------------------------------------------------
629 std)
630 mknod console "" c 0 0
631 mknod kmem "" c 2 1 root:kmem 640
632 mknod mem "" c 2 0 root:kmem 640
633 mknod null "" c 2 2 root:wheel 666
634 mknod random "" c 2 3 root:wheel 644
635 mknod urandom "" c 2 4 root:wheel 644
636 mknod zero "" c 2 12 root:wheel 666
637 mknod io "" c 2 14
638 mknod tty "" c 1 0 root:wheel 666
639 mknod klog "" c 7 0
640 mknod stdin "" c 22 0 root:wheel 666
641 mknod stdout "" c 22 1 root:wheel 666
642 mknod stderr "" c 22 2 root:wheel 666
643 mknod pci "" c 78 0 root:wheel 644
646 #---------------------------------------------------------------------
647 # Create floppy disk nodes in /dev/fd
648 #---------------------------------------------------------------------
650 mkdir -p fd
652 (cd fd &&
653 i=0 &&
654 while [ $i -lt 64 ]
656 mknod $i "" c 22 $i root:wheel 666
658 i=$(($i + 1))
659 done)
661 chmod 555 fd
664 #-----------------------------------------------------------------------------
666 jail)
667 sh MAKEDEV std pty0
669 rm mem kmem pci io klog console
671 ln -sf null mem
672 ln -sf null kmem
673 ln -sf null console
676 #-----------------------------------------------------------------------------
678 mach-4)
679 mknod iopl "" c 22 0
680 mknod kbd "" c 23 0
681 mknod mouse "" c 24 0
682 mknod time "" c 25 0
683 mknod timezone "" c 26 0
686 #-----------------------------------------------------------------------------
688 wt*)
689 u=`expr $i : '..\(.*\)'`
691 [ "$u" ] || u=0
693 # Default density, 512b blocks
694 mknod rwt $u c 10 $((0 + $u)) root:operator 660
695 mknod nrwt $u c 10 $((4 + $u)) root:operator 660
697 # Default density, 1024b blocks
698 # mknod rWt $u c 10 $((64 + $u)) root:operator 660
699 # mknod nrWt $u c 10 $((68 + $u)) root:operator 660
700 mknod rwt ${u}b c 10 $((16 + $u)) root:operator 660 # 60 MB
701 mknod nrwt ${u}b c 10 $((20 + $u)) root:operator 660
702 mknod rwt ${u}c c 10 $((24 + $u)) root:operator 660 # 120 MB
703 mknod nrwt ${u}c c 10 $((28 + $u)) root:operator 660
704 mknod rwt ${u}d c 10 $((32 + $u)) root:operator 660 # 150 MB
705 mknod nrwt ${u}d c 10 $((36 + $u)) root:operator 660
706 # mknod rwt ${u}e c 10 $((40 + $u)) root:operator 660 # 300 MB?
707 # mknod nrwt ${u}e c 10 $((44 + $u)) root:operator 660
708 # mknod rwt ${u}f c 10 $((48 + $u)) root:operator 660 # 600 MB?
709 # mknod nrwt ${u}f c 10 $((52 + $u)) root:operator 660
712 #-----------------------------------------------------------------------------
714 aacd*s*|acd*s*|ad*s*|ar*s*|afd*s*|amrd*s*|ccd*s*|da*s*|fd*s*|idad*s*|ipsd*s*|md*s*|mlxd*s*|pst*s*|twed*s*|vn*s*|vkd*s*)
715 case $i in
716 aacd*s*) name=aacd; chr=151;;
717 acd*s*) name=acd; chr=117;;
718 ad*s*) name=ad; chr=116;;
719 ar*s*) name=ar; chr=157;;
720 afd*s*) name=afd; chr=118;;
721 amrd*s*) name=amrd; chr=133;;
722 ccd*s*) name=ccd; chr=74;;
723 da*s*) name=da; chr=13;;
724 fd*s*) name=fd; chr=9;;
725 idad*s*) name=idad; chr=109;;
726 ipsd*s*) name=ipsd; chr=176;;
727 md*s*) name=md; chr=95;;
728 mlxd*s*) name=mlxd; chr=131;;
729 pst*s*) name=pst; chr=168;;
730 twed*s*) name=twed; chr=147;;
731 vn*s*) name=vn; chr=43;;
732 vkd*s*) name=vkd; chr=97;;
733 esac
735 case $i in
736 aacd*s*|amrd*s*|idad*s*|ipsd*s*|mlxd*s*|twed*s*)
737 unit=`expr $i : '....\([0-9]*\)s'`
738 slice=`expr $i : '....[0-9]*s\([0-9]*\)'`
739 part=`expr $i : '....[0-9]*s[0-9]*\(.*\)'`
742 acd*s*|afd*s*|ccd*s*|pst*s*|wfd*s*|vkd*s*)
743 unit=`expr $i : '...\([0-9]*\)s'`
744 slice=`expr $i : '...[0-9]*s\([0-9]*\)'`
745 part=`expr $i : '...[0-9]*s[0-9]*\(.*\)'`
748 unit=`expr $i : '..\([0-9]*\)s'`
749 slice=`expr $i : '..[0-9]*s\([0-9]*\)'`
750 part=`expr $i : '..[0-9]*s[0-9]*\(.*\)'`
752 esac
754 case $unit in
755 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
756 case $slice in
757 [0-9]|[0-9][0-9]|1[0-1][0-9]|12[0-6])
758 # [no s*] == whole-disk slice (slice #1 in minor)
759 # s0 == slice #0 in minor (compatibility slice)
760 # s1 == slice #2 in minor
761 # s2 == slice #3 in minor
762 # etc..
764 # set slice to slice-in-minor-number
765 oldslice=$slice
766 if [ $oldslice -eq 0 ]; then
767 slice=$(($oldslice))
768 else
769 slice=$(($slice+1))
771 slicename=`dkitos $slice`
772 minor=`ndkminor $unit $slice 255`
773 mknod ${name} $unit$slicename c $chr $minor \
774 root:operator 640
776 # raw device names are extinct
777 rm -f r$name$unit$slicename
779 # get rid of old compatibility devices, the new
780 # ones use 's0', e.g. da0s0a
781 for i in a b c d e f g h i j k l m n o p
783 rm -f $name$unit$i
784 done
786 case $part in
787 [a-p])
789 for part in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
791 minor=`ndkminor $unit $slice $part`
792 partname=`dkitop $part`
793 mknod $name $unit$slicename$partname \
794 c $chr $minor root:operator 640
795 rm -f r$name$unit$slicename$partname
796 done
799 "") ;;
800 *) echo bad partition for disk in: $i
802 esac
805 echo bad slice for disk in: $i
807 esac
810 echo bad unit for disk in: $i "(unit=$unit, slice=$slice, part=$part)"
812 esac
815 #-----------------------------------------------------------------------------
817 control-fd*)
818 unit=`expr $i : '..........\(.*\)'`
819 name=fd; chr=9
821 case $unit in
822 0|1|2|3)
823 minor=`ndkminor $unit 1 129`
824 mknod $name ${unit}.1720 c $chr $minor
825 rm -f r${name}${unit}.1720
827 minor=`ndkminor $unit 1 130`
828 mknod $name ${unit}.1480 c $chr $minor
829 rm -f r${name}${unit}.1480
831 minor=`ndkminor $unit 1 131`
832 mknod $name ${unit}.1440 c $chr $minor
833 rm -f r${name}${unit}.1440
835 minor=`ndkminor $unit 1 132`
836 mknod $name ${unit}.1200 c $chr $minor
837 rm -f r${name}${unit}.1200
839 minor=`ndkminor $unit 1 133`
840 mknod $name ${unit}.820 c $chr $minor
841 rm -f r${name}${unit}.820
843 minor=`ndkminor $unit 1 134`
844 mknod $name ${unit}.800 c $chr $minor
845 rm -f r${name}${unit}.800
847 minor=`ndkminor $unit 1 135`
848 mknod $name ${unit}.720 c $chr $minor
849 rm -f r${name}${unit}.720
851 minor=`ndkminor $unit 1 136`
852 mknod $name ${unit}.360 c $chr $minor
853 rm -f r${name}${unit}.360
855 minor=`ndkminor $unit 1 137`
856 mknod $name ${unit}.640 c $chr $minor
857 rm -f r${name}${unit}.640
859 minor=`ndkminor $unit 1 138`
860 mknod $name ${unit}.1232 c $chr $minor
861 rm -f r${name}${unit}.1232
864 echo bad unit for disk in: $i
866 esac
869 #-----------------------------------------------------------------------------
871 acd*t*)
872 units=`expr $i : '...\(.*\)t'`;
873 tracks=`expr $i : '.*t\(.*\)'`;
874 name=acd;
875 chr=117;
877 [ "$units" ] || units=0
878 [ "$tracks" ] || tracks=100
880 if [ "$units" -le 31 -a "$tracks" -le 169 ]
881 then
883 while [ $i -le $units ]
885 dname=$name$i
886 rm -rf ${dname}t*
889 while [ $j -le $tracks ]
891 # cd unit tracks use the compatibility slice
892 # and partition numbers 129+ for tracks 1+.
894 minor=`ndkminor $i 1 $(($j + 128))`
895 mknod ${dname}t $j c $chr $minor \
896 root:operator 640
897 j=$(($j + 1))
898 done
900 i=$(($i + 1))
901 done
902 else
903 echo "$i is invalid -- can't have more than 32 cd devices or 169 tracks"
907 #-----------------------------------------------------------------------------
909 aacd*|acd*|ad*|ar*|afd*|amrd*|cd*|ccd*|da*|fd*|idad*|ipsd*|md*|mlxd*|pst*|twed*|vcd*|vn*|vkd*)
910 doslices=1
911 directraw=0
912 case $i in
913 aacd*) name=aacd; chr=151;;
914 acd*) name=acd; chr=117; doslices=0; directraw=1;;
915 ad*) name=ad; chr=116;;
916 ar*) name=ar; chr=157;;
917 afd*) name=afd; chr=118;;
918 amrd*) name=amrd; chr=133;;
919 cd*) name=cd; chr=15; doslices=0;;
920 da*) name=da; chr=13;;
921 fd*) name=fd; chr=9;;
922 ccd*) name=ccd; chr=74;;
923 idad*) name=idad; chr=109;;
924 ipsd*) name=ipsd; chr=176;;
925 md*) name=md; chr=95;;
926 mlxd*) name=mlxd; chr=131;;
927 pst*) name=pst; chr=168;;
928 twed*) name=twed; chr=147;;
929 vcd*) name=vcd; chr=98; doslices=0;;
930 vn*) name=vn; chr=43;;
931 vkd*) name=vkd; chr=97;;
932 esac
934 case $i in
935 aacd*|amrd*|idad*|ipsd*|mlxd*|twed*)
936 unit=`expr $i : '....\(.*\)'`
938 acd*|afd*|ccd*|pst*|wfd*|vcd*|vkd*)
939 unit=`expr $i : '...\(.*\)'`
942 unit=`expr $i : '..\(.*\)'`
944 esac
946 case $i in
947 fd*)
948 sh MAKEDEV control-$name$unit
950 esac
952 case $unit in
953 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
954 if [ "$doslices" -gt 0 ]; then
955 minor=`ndkminor $unit 1 255`
956 mknod ${name} ${unit} c $chr $minor \
957 root:operator 640
958 for slicepartname in s0h s1h s2 s3 s4
960 sh MAKEDEV $name$unit$slicepartname
961 done
962 else
963 if [ "$directraw" -gt 0 ]; then
964 minor=`ndkminor $unit 1 128`
965 mknod ${name} ${unit} c $chr $minor \
966 root:operator 640
967 else
968 minor=`ndkminor $unit 1 255`
969 mknod ${name} ${unit} c $chr $minor \
970 root:operator 640
972 minor=`ndkminor $unit 1 255`
973 mknod ${name} ${unit}s0 c $chr $minor \
974 root:operator 640
975 minor=`ndkminor $unit 0 0`
976 mknod ${name} ${unit}a c $chr $minor \
977 root:operator 640
978 minor=`ndkminor $unit 0 2`
979 mknod ${name} ${unit}c c $chr $minor \
980 root:operator 640
984 echo bad unit for disk in: $i
986 esac
989 #-----------------------------------------------------------------------------
991 pt[0-9]*)
992 chr=61
993 name=pt
994 unit=`expr $i : 'pt\([0-9][0-9]*\)'`
996 [ "$unit" ] || unit=0
998 unit=$(($unit + 1 - 1))
999 mknod $name $unit c $chr `unit2minor $unit`
1002 #-----------------------------------------------------------------------------
1004 ses[0-9]*)
1005 chr=110
1006 name=ses
1007 unit=`expr $i : 'ses\([0-9][0-9]*\)'`
1009 [ "$unit" ] || unit=0
1011 unit=$(($unit + 1 - 1))
1012 mknod $name $unit c $chr `unit2minor $unit`
1015 #-----------------------------------------------------------------------------
1017 targ[0-9]*)
1018 chr=65
1019 name=targ
1020 unit=`expr $i : 'targ\([0-9][0-9]*\)'`
1022 [ "$unit" ] || unit=0
1024 unit=$(($unit + 1 - 1))
1026 mknod $name $unit c $chr `unit2minor $unit`
1027 mknod ${name}.ctl "" c $chr 0xffff00ff
1030 #-----------------------------------------------------------------------------
1032 # CAM transport layer device
1033 xpt*)
1034 # This major number is temporary
1035 chr=104
1036 name=xpt
1037 units=`expr $i : 'xpt\(.*\)'`
1039 [ "$units" ] || units=1
1042 while [ $i -lt $units ]
1044 rm -rf $name$i
1046 mknod $name $i c $chr `unit2minor $i` root:operator
1048 i=$(($i + 1))
1049 done
1052 #-----------------------------------------------------------------------------
1054 pass*)
1055 # This major number is temporary
1056 chr=31
1057 name=pass
1058 units=`expr $i : 'pass\(.*\)'`
1060 [ "$units" ] || units=1
1063 while [ $i -lt $units ]
1065 rm -rf $name$i
1067 mknod $name $i c $chr `unit2minor $i` root:operator
1069 i=$(($i + 1))
1070 done
1073 #-----------------------------------------------------------------------------
1075 pty*)
1076 class=`expr $i : 'pty\(.*\)'`
1077 case $class in
1078 0) offset=0 name=p;;
1079 1) offset=32 name=q;;
1080 2) offset=64 name=r;;
1081 3) offset=96 name=s;;
1082 4) offset=128 name=P;; # Note that xterm (at least) only look at p-s.
1083 5) offset=160 name=Q;;
1084 6) offset=192 name=R;;
1085 7) offset=224 name=S;;
1086 *) echo bad unit for pty in: $i;;
1087 esac
1089 case $class in
1090 0|1|2|3|4|5|6|7)
1092 while [ $i -lt 32 ]
1094 c=$(echo 0123456789abcdefghijklmnopqrstuv |
1095 dd bs=1 skip=$i count=1 2>/dev/null)
1097 mknod tty$name $c c 5 $(($offset + $i)) root:wheel 666
1098 mknod pty$name $c c 6 $(($offset + $i)) root:wheel 666
1100 i=$(($i + 1))
1101 done
1103 esac
1106 #-----------------------------------------------------------------------------
1108 sa*)
1109 unit=`expr $i : '..\(.*\)'`
1110 chr=14
1112 case $unit in
1113 [0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9])
1114 mknod sa ${unit}.ctl c $chr `saminor 1 ${unit} 0 0` \
1115 root:wheel 660
1116 ln -f sa${unit}.ctl rsa${unit}.ctl
1118 for m in 0 1 2 3
1120 mknod sa ${unit}.$m c $chr \
1121 `saminor 0 $unit $m 0` root:operator 660
1122 ln -f sa${unit}.$m rsa${unit}.$m
1124 mknod nsa ${unit}.$m c $chr \
1125 `saminor 0 $unit $m 1` root:operator 660
1126 ln -f nsa${unit}.$m nrsa${unit}.$m
1128 mknod esa ${unit}.$m c $chr \
1129 `saminor 0 $unit $m 2` root:operator 660
1130 ln -f esa${unit}.$m ersa${unit}.$m
1131 done
1133 ln -f sa${unit}.0 sa$unit
1134 ln -f sa${unit}.0 rsa${unit}.0
1135 ln -f sa${unit}.0 rsa$unit
1136 ln -f nsa${unit}.0 nsa$unit
1137 ln -f nsa${unit}.0 nrsa${unit}.0
1138 ln -f nsa${unit}.0 nrsa$unit
1139 ln -f esa${unit}.0 esa$unit
1140 ln -f esa${unit}.0 ersa${unit}.0
1141 ln -f esa${unit}.0 ersa$unit
1144 echo bad unit for tape in: $i
1146 esac
1149 #-----------------------------------------------------------------------------
1151 ch*)
1152 unit=`expr $i : '..\(.*\)'`
1154 case $i in
1155 ch*) name=ch; chr=17;;
1156 esac
1158 case $unit in
1159 0|1|2|3|4|5|6)
1160 mknod $name $unit c $chr $unit root:operator 640
1163 echo bad unit for media changer in: $i
1165 esac
1168 #-----------------------------------------------------------------------------
1170 ata)
1171 mknod ata "" c 159 0 root:operator
1174 #-----------------------------------------------------------------------------
1176 ast*)
1177 unit=`expr $i : '...\(.*\)'`
1178 chr=119
1180 case $unit in
1181 0|1|2|3)
1182 mknod ast $unit c $chr $(($unit * 8 + 0)) root:operator 640
1183 mknod nast $unit c $chr $(($unit * 8 + 1)) root:operator 640
1186 echo bad unit for tape in: $i
1188 esac
1191 #-----------------------------------------------------------------------------
1193 iic*)
1194 unit=`expr $i : 'iic\(.*\)'`
1196 mknod iic $unit c 105 `unit2minor $unit`
1199 #-----------------------------------------------------------------------------
1201 smb*)
1202 unit=`expr $i : 'smb\(.*\)'`
1204 mknod smb $unit c 106 `unit2minor $unit`
1207 #-----------------------------------------------------------------------------
1209 pcfclock*)
1210 unit=`expr $i : 'pcfclock\(.*\)'`
1212 mknod pcfclock $unit c 140 `unit2minor $unit`
1215 #-----------------------------------------------------------------------------
1217 ppi*)
1218 unit=`expr $i : 'ppi\(.*\)'`
1220 mknod ppi $unit c 82 `unit2minor $unit`
1223 #-----------------------------------------------------------------------------
1225 pps*)
1226 unit=`expr $i : 'pps\(.*\)'`
1228 mknod pps $unit c 89 `unit2minor $unit`
1231 #-----------------------------------------------------------------------------
1233 usb)
1234 mknod usb "" c 108 255 root:operator 0660
1237 #-----------------------------------------------------------------------------
1239 usb*)
1240 unit=`expr $i : 'usb\(.*\)'`
1242 mknod usb $unit c 108 `unit2minor $unit` root:operator 660
1245 #-----------------------------------------------------------------------------
1247 ucom*)
1248 unit=`expr $i : 'ucom\(.*\)'`
1250 minor=$(($unit + 128))
1251 minor=`unit2minor $(($unit + 128))`
1253 mknod ucom $unit c 138 $minor uucp:dialer 660
1256 #-----------------------------------------------------------------------------
1258 uhid*)
1259 unit=`expr $i : 'uhid\(.*\)'`
1261 mknod uhid $unit c 122 `unit2minor $unit` root:operator 660
1264 #-----------------------------------------------------------------------------
1266 ums*)
1267 unit=`expr $i : 'ums\(.*\)'`
1269 mknod ums $unit c 111 `unit2minor $unit` root:operator 660
1272 #-----------------------------------------------------------------------------
1274 ulpt*)
1275 unit=`expr $i : 'ulpt\(.*\)'`
1277 minor=`unit2minor $unit`
1278 mknod ulpt $unit c 113 $minor
1280 minor=`unit2minor $(($unit + 64))`
1281 mknod unlpt $unit c 113 $minor # and the 'no prime' version
1284 #-----------------------------------------------------------------------------
1286 ugen*)
1287 unit=`expr $i : 'ugen\([0-9][0-9]*\)'`
1288 endpoint=`expr $i : 'ugen.*\.\([0-9][0-9]*\)'`
1290 [ "$unit" ] || echo $i - Invalid unit number
1292 if [ -z "${endpoint}" ] # ugen0 & ugen0.1 - ugen0.15
1293 then
1294 mknod ugen $unit c 114 `unit2minor $(($unit * 16))` \
1295 root:operator 660
1297 while [ $i -lt 16 ]
1299 mknod ugen $unit.$i c 114 `unit2minor \
1300 $(($unit * 16 + $i))` root:operator 660
1302 i=$(($i + 1))
1303 done
1304 else
1305 minor=`unit2minor $(($unit * 16 + $endpoint))`
1306 mknod ugen $unit.$endpoint c 114 $minor root:operator 660
1310 #-----------------------------------------------------------------------------
1312 urio*)
1313 unit=`expr $i : 'urio\(.*\)'`
1315 mknod urio $unit c 143 `unit2minor $unit` root:operator 660
1318 #-----------------------------------------------------------------------------
1320 uscanner*)
1321 unit=`expr $i : 'uscanner\(.*\)'`
1323 mknod uscanner $unit c 156 `unit2minor $unit` root:operator 660
1326 #-----------------------------------------------------------------------------
1328 umodem*)
1329 unit=`expr $i : 'umodem\(.*\)'`
1331 mknod umodem $unit c 124 `unit2minor $unit` uucp:dialer 660
1334 #-----------------------------------------------------------------------------
1336 lpt*)
1337 unit=`expr $i : 'lpt\(.*\)'`
1339 mknod lpt $unit c 16 `unit2minor $unit`
1340 mknod lpctl $unit c 16 `unit2minor $(($unit + 128))`
1343 #-----------------------------------------------------------------------------
1345 vty*)
1346 chr=12
1347 units=`expr $i : 'vty\(.*\)'`
1350 while [ $i -lt $units ]
1352 mknod ttyv $(printf %01x $i) c $chr `unit2minor $i`
1354 i=$(($i + 1))
1355 done
1357 ln -fs ttyv0 vga
1360 #-----------------------------------------------------------------------------
1362 nmdm*)
1363 units=`expr $i : 'nmdm\(.*\)'`
1364 chr=18
1367 while [ $i -lt $units ]
1369 minor=`unit2minor $i`
1370 minor=$(($minor + $minor))
1371 mknod nmdm ${i}A c $chr $minor
1372 mknod nmdm ${i}B c $chr $(($minor + 1))
1374 i=$(($i + 1))
1375 done
1378 #-----------------------------------------------------------------------------
1380 bpf*)
1381 nbpf=`expr $i : 'bpf\(.*\)$'`
1383 unit=0
1384 while [ $unit -le $nbpf ]
1386 mknod bpf $unit c 23 `unit2minor $unit`
1388 unit=$(($unit + 1))
1389 done
1392 #-----------------------------------------------------------------------------
1394 speaker)
1395 mknod speaker "" c 26 0
1398 #-----------------------------------------------------------------------------
1400 cua?|cuaa?|cuaa??)
1401 unit_low=`expr $i : 'cua.*\(.\)$'`
1403 case $i in
1404 cua?|cuaa?)
1405 unit_high=""
1406 m_high=0
1408 cuaa??)
1409 unit_high=`expr $i : 'cuaa\(.\).$'`
1410 m_high=`ttyminor $unit_high`
1412 esac
1414 unit=$unit_high$unit_low
1415 m=$(($m_high << 16 | `ttyminor $unit_low`))
1417 mknod cuaa $unit c 28 $(($m | 128)) uucp:dialer 660
1418 mknod cuaia $unit c 28 $(($m | 32 | 128)) uucp:dialer 660
1419 mknod cuala $unit c 28 $(($m | 64 | 128)) uucp:dialer 660
1422 #-----------------------------------------------------------------------------
1424 crypto)
1425 mknod crypto "" c 70 0 root:operator 666
1428 #-----------------------------------------------------------------------------
1431 mknod pf "" c 73 0 root:operator 600
1434 #-----------------------------------------------------------------------------
1436 fw?)
1437 unit=`expr $i : 'fw\(.\)$'`
1439 for sub in 0 1 2 3
1441 minor=$(($unit << 16 | $sub))
1442 mknod fw $unit.$sub c 127 $minor root:operator 660
1443 mknod fwmem $unit.$sub c 127 $((1<<24 | $minor)) \
1444 root:operator 660
1445 done
1447 ln -sf fw$unit.0 fw$unit
1448 ln -sf fwmem$unit.0 fwmem$unit
1451 #-----------------------------------------------------------------------------
1453 dcons)
1454 mknod dcons "" c 184 0 root:wheel 600
1457 #-----------------------------------------------------------------------------
1459 tty?|tty0?|ttyd?|ttyd??)
1460 unit_low=`expr $i : 'tty.*\(.\)$'`
1462 case $i in
1463 tty?|tty0?|ttyd?)
1464 unit_high=""
1465 m_high=0
1467 ttyd??)
1468 unit_high=`expr $i : 'ttyd\(.\).$'`
1469 m_high=`ttyminor $unit_high`
1471 esac
1473 unit=$unit_high$unit_low
1474 m=$(($m_high << 16 | `ttyminor $unit_low`))
1476 mknod ttyd $unit c 28 $m
1477 mknod ttyid $unit c 28 $(($m | 32))
1478 mknod ttyld $unit c 28 $(($m | 64))
1481 #-----------------------------------------------------------------------------
1483 cuac?)
1484 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1485 g h i j k l m n o p q r s t u v"
1486 major=48
1487 card=`expr $i : 'cua.*\(.\)$'`
1489 for unit in $portlist
1491 minor=`ttyminor $unit`
1492 minor=$(($card * 65536 + $minor))
1493 name=$card$unit
1495 mknod cuac $name c $major $(($minor + 128)) uucp:dialer 660
1496 mknod cuaic $name c $major $(($minor + 32 + 128)) \
1497 uucp:dialer 660
1498 mknod cualc $name c $major $(($minor + 64 + 128)) \
1499 uucp:dialer 660
1500 done
1503 #-----------------------------------------------------------------------------
1505 ttyc?)
1506 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1507 g h i j k l m n o p q r s t u v"
1508 major=48
1509 card=`expr $i : 'tty.*\(.\)$'`
1511 for unit in $portlist
1513 minor=`ttyminor $unit`
1514 minor=$(($card * 65536 + $minor))
1515 name=$card$unit
1517 mknod ttyc $name c $major $minor
1518 mknod ttyic $name c $major $(($minor + 32))
1519 mknod ttylc $name c $major $(($minor + 64))
1520 done
1523 #-----------------------------------------------------------------------------
1525 cuam?)
1526 unit=`expr $i : 'cua.*\(.\)$'`
1528 m=`ttyminor $unit`
1530 mknod cuam $unit c 63 $(($m + 128)) uucp:dialer 660
1533 #-----------------------------------------------------------------------------
1535 ttym?)
1536 unit=`expr $i : 'tty.*\(.\)$'`
1538 m=`ttyminor $unit`
1540 mknod ttym $unit c 63 $m
1543 #-----------------------------------------------------------------------------
1545 ttyA*)
1546 major=68
1547 nports=`expr $i : 'ttyA\(.*\)$'`
1548 port=1
1550 while [ $port -le $nports ]
1552 minor=$(($port - 1))
1553 name=$(printf %02d $port)
1555 mknod ttyA $name c $major $minor
1556 mknod ttyiA $name c $major $(($minor + 65536))
1557 mknod ttylA $name c $major $(($minor + 131072))
1559 port=$(($port + 1))
1560 done
1562 # For the user-mode control program, 'sicontrol'
1563 mknod si_control "" c 68 262144
1566 #-----------------------------------------------------------------------------
1568 cuaA*)
1569 major=68
1570 nports=`expr $i : 'cuaA\(.*\)$'`
1571 port=1
1573 while [ $port -le $nports ]
1575 minor=$(($port - 1))
1576 name=$(printf %02d $port)
1578 mknod cuaA $name c $major $(($minor + 128)) uucp:dialer 660
1579 mknod cuaiA $name c $major $(($minor + 128 + 65536)) \
1580 uucp:dialer 660
1581 mknod cualA $name c $major $(($minor + 128 + 131072)) \
1582 uucp:dialer 660
1584 port=$(($port + 1))
1585 done
1588 #-----------------------------------------------------------------------------
1590 ttyD?)
1591 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1592 major=58
1593 card=`expr $i : 'tty.*\(.\)$'`
1595 for unit in $portlist
1597 minor=`ttyminor $unit`
1598 minor=$(($card * 65536 + $minor))
1599 name=$card$unit
1601 mknod ttyD $name c $major $minor
1602 mknod ttyiD $name c $major $(($minor + 32))
1603 mknod ttylD $name c $major $(($minor + 64))
1604 done
1607 #-----------------------------------------------------------------------------
1609 cuaD?)
1610 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1611 major=58
1612 card=`expr $i : 'cua.*\(.\)$'`
1614 for unit in $portlist
1616 minor=`ttyminor $unit`
1617 minor=$(($card * 65536 + $minor))
1618 name=$card$unit
1620 mknod cuaD $name c $major $(($minor + 128)) uucp:dialer 660
1621 mknod cuaiD $name c $major $(($minor + 32 + 128)) \
1622 uucp:dialer 660
1623 mknod cualD $name c $major $(($minor + 64 + 128)) \
1624 uucp:dialer 660
1625 done
1628 #-----------------------------------------------------------------------------
1630 ttyE*)
1631 stallion 72 E `expr $i : 'tty.*\(.\)$'` 0
1633 cuaE*)
1634 stallion 72 E `expr $i : 'cua.*\(.\)$'` 1
1636 stl*)
1637 card=`expr $i : 'stl\(.\)$'`
1638 stallion 72 E $card 0
1639 stallion 72 E $card 1
1642 ttyF*)
1643 stallion 75 F `expr $i : 'tty.*\(.\)$'` 0
1645 cuaF*)
1646 stallion 75 F `expr $i : 'cua.*\(.\)$'` 1
1648 stli*)
1649 card=`expr $i : 'stl\(.\)$'`
1650 stallion 75 F $card 0
1651 stallion 75 F $card 1
1654 ttyM*)
1655 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1656 modulelist="a b c d"
1657 major=101
1658 card=`expr $i : 'tty.*\(.\)$'`
1660 for unit in $modulelist
1662 moduleminor=`ttyminor $unit`
1663 moduleminor=$(($moduleminor % 10 * 16))
1664 modulename=$unit
1666 for unit in $portlist
1668 minor=`ttyminor $unit`
1669 minor=$(($card * 65536 + $minor + $moduleminor))
1670 name=$card$modulename$unit
1672 rm -f tty*M$name
1674 mknod ttyM $name c $major $minor
1675 mknod ttyiM $name c $major $(($minor + 64))
1676 mknod ttylM $name c $major $(($minor + 128))
1677 done
1678 done
1681 cuaM?)
1682 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1683 modulelist="a b c d"
1684 major=101
1685 card=`expr $i : 'cua.*\(.\)$'`
1687 for unit in $modulelist
1689 moduleminor=`ttyminor $unit`
1690 moduleminor=$(($moduleminor % 10 * 16))
1691 modulename=$unit
1693 for unit in $portlist
1695 minor=`ttyminor $unit`
1696 minor=$(($card * 65536 + $minor + $moduleminor))
1697 name=$card$modulename$unit
1699 rm -f cua*M$name
1701 mknod cuaM $name c $major $(($minor + 262144)) \
1702 uucp:dialer 660
1703 mknod cuaiM $name c $major $(($minor + 64 + 262144)) \
1704 uucp:dialer 660
1705 mknod cualM $name c $major $(($minor + 128 + 262144)) \
1706 uucp:dialer 660
1707 done
1708 done
1711 ttyR?)
1712 major=81
1713 BOARD=1; Rnum=0
1714 MINOR=$(($BOARD * 65536))
1715 controllers=$(
1716 dmesg | while read first rest
1718 case "$first" in
1719 RocketPort[0-4]) echo "$first"
1721 esac
1722 done)
1724 rm -f ttyR* ttyiR* ttylR*
1726 for i in $controllers
1728 ndevices=$(
1729 dmesg | while read first bar ports rest
1731 case "$first" in
1732 $i*) echo "$ports"
1734 esac
1735 done)
1737 echo -n "Creating $ndevices devices for $i: "
1738 dev=0
1740 while [ $dev -lt $ndevices ]
1742 mknod ttyR $Rnum c $major $MINOR
1743 mknod ttyiR $Rnum c $major $(($MINOR + 32))
1744 mknod ttylR $Rnum c $major $(($MINOR + 64))
1746 Rnum=$(($Rnum + 1))
1747 MINOR=$(($MINOR + 1))
1749 dev=$(($dev + 1))
1750 done
1752 BOARD=$(($BOARD + 1))
1753 MINOR=$(($BOARD * 65536))
1754 echo " "
1755 done
1758 cuaR?)
1759 major=81
1760 BOARD=1; Rnum=0
1761 MINOR=$(($BOARD * 65536))
1762 controllers=$(
1763 dmesg | while read first rest
1765 case "$first" in
1766 RocketPort[0-4]) echo "$first"
1768 esac
1769 done)
1771 rm -f cuaR* cuaiR* cualR*
1773 for i in $controllers
1775 ndevices=$(
1776 dmesg | while read first bar ports rest
1778 case "$first" in
1779 $i*) echo "$ports"
1781 esac
1782 done)
1784 echo -n "Creating $ndevices devices for $i: "
1785 dev=0
1787 while [ $dev -lt $ndevices ]
1789 mknod cuaR $Rnum c $major $(($MINOR + 128)) \
1790 uucp:dialer 660
1791 mknod cuaiR $Rnum c $major $(($MINOR + 128 + 32)) \
1792 uucp:dialer 660
1793 mknod cualR $Rnum c $major $(($MINOR + 128 + 64)) \
1794 uucp:dialer 660
1796 Rnum=$(($Rnum + 1))
1797 MINOR=$(($MINOR + 1))
1799 dev=$(($dev + 1))
1800 done
1802 BOARD=$(($BOARD + 1))
1803 MINOR=$(($BOARD * 65536))
1804 echo " "
1805 done
1808 #-----------------------------------------------------------------------------
1810 mse*)
1811 unit=`expr $i : 'mse\(.*\)'`
1812 chr=27
1814 # Non-blocking for X11
1815 mknod mse $unit c $chr `unit2minor $(($unit * 2 + 1))`
1818 #-----------------------------------------------------------------------------
1820 psm*)
1821 unit=`expr $i : 'psm\(.*\)'`
1822 chr=21
1824 # Non-blocking for X11
1825 mknod psm $unit c $chr `unit2minor $(($unit * 2 + 1))`
1828 #-----------------------------------------------------------------------------
1830 mouse*)
1831 name=`expr $i : 'mouse\(.*\)'`
1833 [ -c $name ] || $0 $name # Make the appropriate device
1835 ln -fs $name mouse
1838 #-----------------------------------------------------------------------------
1840 pcaudio)
1841 mknod pcaudio "" c 24 0
1842 mknod pcaudioctl "" c 24 128
1845 #-----------------------------------------------------------------------------
1847 socksys)
1848 mknod socksys "" c 41 0 root:wheel 666
1849 mknod spx "" c 41 1 root:wheel 666
1851 ln -fs socksys nfsd
1854 #-----------------------------------------------------------------------------
1856 snd*)
1858 unit=`expr $i : 'snd\(.*\)'`
1859 chr=30
1861 ln -fs mixer$unit mixer
1862 ln -fs sequencer$unit sequencer
1863 ln -fs dsp$unit dsp
1864 ln -fs dspW$unit dspW
1865 ln -fs music$unit music
1866 ln -fs pss$unit pss
1867 ln -fs dsp$unit.0 dsp$unit
1868 ln -fs dspW$unit.0 dspW$unit
1870 ln -fs dsp audio
1871 ln -fs dsp$unit audio$unit
1873 mknod mixer $unit c $chr `unit2minor $(($unit * 16 + 0))` \
1874 root:wheel 666
1875 mknod sequencer $unit c $chr `unit2minor $(($unit * 16 + 1))` \
1876 root:wheel 666
1877 mknod midi $unit c $chr `unit2minor $(($unit * 16 + 2))` \
1878 root:wheel 666
1880 for chn in 0 1 2 3
1882 minor=$(($chn * 65536 + $unit * 16))
1884 mknod dsp $unit.$chn c $chr $(($minor + 3)) root:wheel 666
1885 mknod dspW $unit.$chn c $chr $(($minor + 5)) root:wheel 666
1886 ln -fs dsp$unit.$chn audio$unit.$chn
1887 done
1889 mknod sndstat "" c $chr 6 root:wheel 666
1890 mknod music $unit c $chr `unit2minor $(($unit * 16 + 8))` root:wheel 666
1891 mknod pss $unit c $chr `unit2minor $(($unit * 16 + 9))` root:wheel 666
1894 #-----------------------------------------------------------------------------
1896 vat)
1897 mknod vatio "" c 25 128 root:wheel 660
1900 #-----------------------------------------------------------------------------
1902 gsc*)
1903 unit=`expr $i : 'gsc\(.*\)'`
1905 mknod gsc $unit c 47 `unit2minor $unit` root:wheel 666
1906 mknod gsc ${unit}p c 47 `unit2minor $(($unit + 8))` root:wheel 666
1907 mknod gsc ${unit}d c 47 `unit2minor $(($unit + 32))` root:wheel 666
1908 mknod gsc ${unit}pd c 47 `unit2minor $(($unit + 40))` root:wheel 666
1911 #-----------------------------------------------------------------------------
1913 acpi)
1914 mknod acpi "" c 152 0 root:operator 664
1917 #-----------------------------------------------------------------------------
1919 apm)
1920 mknod apm "" c 39 0 root:operator 664
1923 #-----------------------------------------------------------------------------
1925 apmctl)
1926 mknod apmctl "" c 39 8 root:operator 660
1929 #-----------------------------------------------------------------------------
1931 card*)
1932 unit=`expr $i : 'card\(.*\)'`
1933 chr=50
1935 mknod card $unit c $chr `unit2minor $unit` root:wheel 644
1938 #-----------------------------------------------------------------------------
1940 ttyx?|ttyy?|ttyz?)
1941 case $i in
1942 *0) unit=0;; *1) unit=1;; *2) unit=2;; *3) unit=3;;
1943 *4) unit=4;; *5) unit=5;; *6) unit=6;; *7) unit=7;;
1944 *8) unit=8;; *9) unit=9;; *a) unit=10;; *b) unit=11;;
1945 *c) unit=12;; *d) unit=13;; *e) unit=14;; *f) unit=15;;
1946 esac
1948 case $i in
1949 ttyy?) unit=$(($unit + 16));;
1950 ttyz?) unit=$(($unit + 32));;
1951 esac
1953 mknod $i "" c 42 $unit
1956 #-----------------------------------------------------------------------------
1958 cronyx)
1959 mknod cronyx "" c 42 63
1962 #-----------------------------------------------------------------------------
1964 joy)
1965 mknod joy 0 c 51 0 root:operator 640
1966 mknod joy 1 c 51 1 root:operator 640
1969 #-----------------------------------------------------------------------------
1971 spigot)
1972 mknod spigot "" c 11 0 root:wheel 444
1975 #-----------------------------------------------------------------------------
1977 ctx?)
1978 unit=`expr $i : 'ctx\(.*\)'`
1980 mknod ctx $unit c 40 `unit2minor $unit` root:wheel 444
1983 #-----------------------------------------------------------------------------
1985 meteor?)
1986 unit=`expr $i : 'meteor\(.*\)'`
1988 mknod meteor $unit c 67 `unit2minor $unit` root:wheel 444
1991 #-----------------------------------------------------------------------------
1993 bktr?)
1994 unit=`expr $i : 'bktr\(.*\)'`
1996 mknod bktr $unit c 92 `unit2minor $unit` root:wheel 444
1997 mknod tuner $unit c 92 `unit2minor $((16 + $unit))` root:wheel 444
1998 mknod vbi $unit c 92 `unit2minor $((32 + $unit))` root:wheel 444
2001 #-----------------------------------------------------------------------------
2003 tun*)
2004 ntun=`expr $i : 'tun\(.*\)$'`
2005 unit=0
2007 while [ $unit -le $ntun ]
2009 mknod tun $unit c 52 `unit2minor $unit`
2011 unit=$(($unit + 1))
2012 done
2015 #-----------------------------------------------------------------------------
2017 tap*)
2018 ntap=`expr $i : 'tap\(.*\)$'`
2019 unit=0
2021 while [ $unit -le $ntap ]
2023 mknod tap $unit c 149 `unit2minor $unit` root:network
2025 unit=$(($unit + 1))
2026 done
2029 #-----------------------------------------------------------------------------
2031 sysmouse)
2032 mknod sysmouse "" c 12 128
2033 mknod consolectl "" c 12 255
2036 #-----------------------------------------------------------------------------
2038 jogdial)
2039 mknod jogdial "" c 160 0
2042 #-----------------------------------------------------------------------------
2044 snp?)
2045 unit=`expr $i : 'snp\(.*\)'`
2047 mknod snp $unit c 53 `unit2minor $unit`
2050 #-----------------------------------------------------------------------------
2052 labpc*)
2053 case $i in
2054 labpcaio*)
2055 name=labpcaio
2056 unit=`expr $i : 'labpcaio\(.*\)'`
2057 all="0 1 2 3 4 5 6 7"
2058 offset=0
2061 labpcdio*)
2062 name=labpcdio
2063 unit=`expr $i : 'labpcdio\(.*\)'`
2064 all="0 1 2 3"
2065 offset=8
2069 die 3 "Don't know LabPC type $i"
2071 esac
2073 [ "${unit}" ] || unit=all
2075 case $unit in
2076 0|1|2|3|4|5|6|7)
2077 mknod $name $unit c 66 $(($offset + $unit)) \
2078 root:wheel 660
2081 all)
2082 for i in $all
2084 mknod $name $i c 66 $(($offset + $i)) \
2085 root:wheel 660
2086 done
2090 echo "No such LabPC unit: $unit"
2092 esac
2095 #-----------------------------------------------------------------------------
2097 perfmon)
2098 mknod perfmon "" c 2 32 root:kmem 640
2101 #-----------------------------------------------------------------------------
2103 ipl)
2104 mknod ipl "" c 79 0
2105 mknod ipnat "" c 79 1
2106 mknod ipstate "" c 79 2
2107 mknod ipauth "" c 79 3
2110 #-----------------------------------------------------------------------------
2112 elan*)
2113 mknod elan-mmcr "" c 100 0 root:wheel 600
2116 #-----------------------------------------------------------------------------
2118 kbd*)
2119 unit=`expr $i : 'kbd\(.*\)'`
2120 chr=112
2122 mknod kbd $unit c $chr `unit2minor $unit`
2125 #-----------------------------------------------------------------------------
2127 i4b)
2128 mknod i4b "" c 60 0
2131 i4bctl)
2132 mknod i4bctl "" c 55 0
2135 i4brbch*)
2136 unit=`expr $i : 'i4brbch\(.*\)'`
2138 mknod i4brbch $unit c 57 `unit2minor $unit`
2141 i4bteld*)
2142 offset=64
2143 unit=`expr $i : 'i4bteld\(.*\)'`
2145 mknod i4bteld $unit c 56 `unit2minor $(($offset + $unit))`
2148 i4btel*)
2149 unit=`expr $i : 'i4btel\(.*\)'`
2151 mknod i4btel $unit c 56 `unit2minor $unit`
2154 i4btrc*)
2155 unit=`expr $i : 'i4btrc\(.*\)'`
2157 mknod i4btrc $unit c 59 `unit2minor $unit`
2160 #-----------------------------------------------------------------------------
2162 aac*)
2163 unit=`expr $i : 'aac\(.*\)'`
2165 mknod aac $unit c 150 `unit2minor $unit`
2167 ln -fs aac$unit afa$unit
2168 ln -fs aac$unit hpn$unit
2171 #-----------------------------------------------------------------------------
2173 mlx*)
2174 unit=`expr $i : 'mlx\(.*\)'`
2176 mknod mlx $unit c 130 `unit2minor $unit`
2179 #-----------------------------------------------------------------------------
2181 amr*)
2182 unit=`expr $i : 'amr\(.*\)'`
2184 mknod amr $unit c 132 `unit2minor $unit`
2187 #-----------------------------------------------------------------------------
2189 ips*)
2190 unit=`expr $i : 'ips\(.*\)'`
2192 mknod mlx $unit c 175 `unit2minor $unit`
2195 #-----------------------------------------------------------------------------
2197 ciss*)
2198 unit=`expr $i : 'ciss\(.*\)'`
2200 mknod ciss $unit c 166 `unit2minor $unit`
2203 #-----------------------------------------------------------------------------
2205 agpgart)
2206 mknod agpgart "" c 148 0
2209 #-----------------------------------------------------------------------------
2211 twe*)
2212 unit=`expr $i : 'twe\(.*\)'`
2214 mknod twe $unit c 146 `unit2minor $unit`
2217 #-----------------------------------------------------------------------------
2219 tw*)
2220 unit=`expr $i : 'tw\(.*\)'`
2222 mknod tw $unit c 19 `unit2minor $unit` root:operator
2225 #-----------------------------------------------------------------------------
2227 nsmb*)
2228 unit=`expr $i : 'nsmb\(.*\)'`
2230 mknod nsmb $unit c 144 $unit
2233 #-----------------------------------------------------------------------------
2235 cmx*)
2236 unit=`expr $i : 'cmx\(.*\)'`
2238 mknod cmx $unit c 185 $unit
2241 #-----------------------------------------------------------------------------
2243 devctl)
2244 mknod devctl "" c 188 0 root:wheel 600
2247 #-----------------------------------------------------------------------------
2249 local)
2250 umask 0
2251 sh MAKEDEV.local
2252 umask 77
2255 #-----------------------------------------------------------------------------
2258 echo $i - no such device name
2261 esac
2262 done