HAMMER UTILS - Add to the newfs_hammer documentation.
[dragonfly.git] / etc / MAKEDEV
blob0fffde3ce01918df0e948639ee5cb55072734133
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 # cxm* Conexant iTVC MPEG Coder
151 # labpc* National Instrument's Lab-PC and LAB-PC+
152 # perfmon CPU performance-monitoring counters
153 # pci PCI configuration-space access from user mode
154 # ipl ipfilter control devices (ipl, ipnat, ipstate, ipauth)
155 # kbd keyboard devices
156 # elan-mmcr AMD Elan support (e.g. mmap MMCR)
157 # agpgart AGP interface
158 # nsmb* SMB/CIFS protocol interface
159 # pf PF packet filter
160 # cmx Omnikey CardMan 4040 smartcard reader
161 # devctl devctl(4) interface
163 ##############################################################################
165 # To override the default ownership and/or permissions, you now have the
166 # /etc/devices.conf file (create it if it's not there). Entries in this file
167 # should look like:
169 # ad0s1c root:staff 666 # Override ad0s1c
170 # ad0* root:wheel 641 # Override the entire ad0 family
171 # sa0.ctl heinz:ketchup 444 # Override device control node
172 # sa*.ctl heinz:ketchup 666 # Override all sa* control nodes
173 # fd/4 ihate:floppies 000 # Override /dev/fd/4
175 # See the devices.conf(5) man page for further information.
177 # J.Anslik (joerg@anslik.de)
179 ##############################################################################
183 #-----------------------------------------------------------------------------
184 # Where all device special files are built.
185 #-----------------------------------------------------------------------------
187 DEVDIR=dev
190 #-----------------------------------------------------------------------------
191 # File containing local ownership and permissions override entries.
192 #-----------------------------------------------------------------------------
194 DEVPERMS_LOCAL="/etc/devices.conf"
197 #-----------------------------------------------------------------------------
198 # Some useful programs.
199 #-----------------------------------------------------------------------------
201 cut=/usr/bin/cut
202 grep=/usr/bin/grep
203 mknod=/sbin/mknod
204 sed=/usr/bin/sed
205 tr=/usr/bin/tr
208 #-----------------------------------------------------------------------------
209 # Set up a default search path.
210 #-----------------------------------------------------------------------------
212 if [ -n "$MAKEDEVPATH" ]
213 then
214 PATH="$MAKEDEVPATH"
215 else
216 PATH=/sbin:/bin
220 #-----------------------------------------------------------------------------
221 # Print error message $2 and exit this script, returning $1.
222 #-----------------------------------------------------------------------------
224 die()
226 echo $2
228 exit $1
232 #-----------------------------------------------------------------------------
233 # Convert integer to partition name.
234 #-----------------------------------------------------------------------------
236 dkitop()
238 local p
240 case $1 in
241 0) p=a;; 1) p=b;; 2) p=c;; 3) p=d;;
242 4) p=e;; 5) p=f;; 6) p=g;; 7) p=h;;
243 8) p=i;; 9) p=j;; 10) p=k;; 11) p=l;;
244 12) p=m;; 13) p=n;; 14) p=o;; 15) p=p;;
245 *) p="?";;
246 esac
248 echo $p
252 #-----------------------------------------------------------------------------
253 # Convert integer to slice name.
254 #-----------------------------------------------------------------------------
256 dkitos()
258 local s
260 case $1 in
261 0) s="s0" ;;
262 1) s="" ;;
263 *) s=s$(($1-1)) ;;
264 esac
266 echo $s
269 #-----------------------------------------------------------------------------
270 # Convert unit, slice, partition to minor number.
271 #-----------------------------------------------------------------------------
273 # ndkminor(unit, slice, partition)
275 ndkminor()
277 echo $(( (($1 & 31) << 3) | (($1 & 480) << 16) | \
278 (($2 & 15) << 16) | (($2 & 112) << 25) | \
279 ($3 & 7) | (($3 & 8) << 17) | (($3 & 240) << 21) ))
283 #-----------------------------------------------------------------------------
284 # Create the device node.
285 #-----------------------------------------------------------------------------
287 mknod() {
289 local dev=$1
290 local unit=$2
292 #---------------------------------------------------------------------
293 # Remove old device node, if any.
294 #---------------------------------------------------------------------
296 rm -f "$dev$unit" || exit 1
299 #---------------------------------------------------------------------
300 # Supply default ownership and/or permissions according to the
301 # number of parameters passed to this function.
302 #---------------------------------------------------------------------
304 case $# in
305 5) owner=root:wheel; perms=600;;
306 6) owner=$6; perms=600;;
307 7) owner=$6; perms=$7;;
308 *) die 2 "Bad call: mknod $@";;
309 esac
312 #---------------------------------------------------------------------
313 # Get rid of first two parameters (no longer needed)
314 #---------------------------------------------------------------------
316 shift; shift
319 #---------------------------------------------------------------------
320 # If there's a /etc/devices.conf file, check for local overrides.
321 #---------------------------------------------------------------------
323 if [ -s $DEVPERMS_LOCAL ]
324 then
325 #-------------------------------------------------------------
326 # Temporarily prepend the device portion with a subdir name
327 # if we're not in $DEVDIR. We need to do this to distinguish
328 # between device nodes that live in /dev, and device nodes
329 # that live in /dev/subdir, like /dev/fd. This way, we can
330 # have "fd*" entries in the permission files, as well as
331 # "fd/*" stuff.
332 #-------------------------------------------------------------
334 tmpdev=$dev
335 pwd=`/usr/bin/basename $PWD`
337 [ "$pwd" = "$DEVDIR" ] || dev="${pwd}/$dev"
340 #-------------------------------------------------------------
341 # Check /etc/devices.conf for local overrides
342 #-------------------------------------------------------------
344 match=`$grep ^$dev$unit[[:space:]] $DEVPERMS_LOCAL | \
345 $sed 's/\*/\\\*/'`
347 [ "$match" ] ||
348 if [ `expr "$unit" : '\(.*\)\.ctl$'` ]
349 then
350 match=`$grep ^$dev\\\*\\\.ctl[[:space:]] \
351 $DEVPERMS_LOCAL | $sed 's/\*/\\\*/'`
352 else
353 match=`$grep ^$dev\\\*[[:space:]] $DEVPERMS_LOCAL | \
354 $sed 's/\*/\\\*/'`
357 if [ "$match" ]
358 then
359 # Separate each field by one space character...
360 match=`echo $match | $tr -s "[:space:]" " "`
362 # ...and extract owenership and permissions.
363 owner=`echo $match | $cut -d' ' -f2`
364 perms=`echo $match | $cut -d' ' -f3`
367 #-------------------------------------------------------------
368 # Restore "plain" device name (no prepending subdir name).
369 #-------------------------------------------------------------
371 dev=$tmpdev
374 #---------------------------------------------------------------------
375 # Finally, set ownership and permissions.
376 #---------------------------------------------------------------------
378 $mknod $dev$unit $1 $2 $3 $owner
379 chmod $perms $dev$unit
383 #-----------------------------------------------------------------------------
384 # Convert tape (ctrl, unit, mode, access) to device minor number.
385 #-----------------------------------------------------------------------------
387 saminor()
389 echo $(($1 << 29 | ($2 / 16) << 16 | ($2 % 16) << 4 | $3 << 2 | $4))
393 #-----------------------------------------------------------------------------
394 # Convert the last character of a tty name to a device minor number.
395 #-----------------------------------------------------------------------------
397 ttyminor()
399 case $1 in
400 [0-9]) m=$1;;
401 a) m=10;; b) m=11;; c) m=12;; d) m=13;;
402 e) m=14;; f) m=15;; g) m=16;; h) m=17;;
403 i) m=18;; j) m=19;; k) m=20;; l) m=21;;
404 m) m=22;; n) m=23;; o) m=24;; p) m=25;;
405 q) m=26;; r) m=27;; s) m=28;; t) m=29;;
406 u) m=30;; v) m=31;;
407 *) m="?";;
408 esac
410 echo $m
414 #-----------------------------------------------------------------------------
415 # Convert a unit number to a device minor number.
416 #-----------------------------------------------------------------------------
418 unit2minor()
420 echo $(((($1 >> 8) << 16) | ($1 % 256)))
424 #-----------------------------------------------------------------------------
425 # Stallion devices need some (weird) special treatment.
426 #-----------------------------------------------------------------------------
428 stallion()
430 major=$1
431 letter=$2
432 card=$3
433 iscallout=$4
435 port=0
436 maxport=8
437 pref=tty
438 owner=
439 minorbase=0
441 if [ $iscallout -gt 0 ]
442 then
443 pref=cua
444 owner=uucp:dialer
445 minorbase=128
448 case "$card" in
449 [0-7]);;
450 *) die 1 "Invalid stl card number $card";;
451 esac
453 # Make the mem interface for extracting stats & loading microcode.
454 # 0x1000000 + card number
455 mknod staliomem $card c $major 0x0100000$card
457 while [ $port -lt $maxport ]
459 minor=$(($minorbase + $card * 1048576 + $port))
461 [ $port -lt 32 ] || minor=$(($minor + 65504))
463 unit=$(($card * 64 + $port))
465 mknod ${pref}${letter} $unit c $major $minor $owner
466 mknod ${pref}i${letter} $unit c $major $(($minor + 32)) $owner
467 mknod ${pref}l${letter} $unit c $major $(($minor + 64)) $owner
469 port=$(($port + 1))
470 done
474 #-----------------------------------------------------------------------------
475 # Do it.
476 #-----------------------------------------------------------------------------
478 for i in $*; do
479 case $i in
481 all)
482 rm -f *.compat
483 sh MAKEDEV std # standard
484 sh MAKEDEV fd0 fd1 # bdev, floppy disk
485 sh MAKEDEV da0 da1 da2 da3 da4 da5 da6 da7 # bdev, SCSI disk
486 sh MAKEDEV da8 da9 da10 da11 da12 da13 da14 # bdev, SCSI disk
487 sh MAKEDEV da15 # bdev, SCSI disk
488 sh MAKEDEV ccd0 ccd1 ccd2 ccd3 # ccd disk
489 sh MAKEDEV ata # cdev, ATA control
490 sh MAKEDEV ad0 ad1 ad2 ad3 ad4 ad5 ad6 ad7 # bdev, ATA disk
491 sh MAKEDEV ar0 ar1 # bdev, ATA RAID disk
492 sh MAKEDEV acd0 afd0 ast0 # bdev, ATAPI devices
493 sh MAKEDEV vn0 vn1 vn2 vn3 # bdev, virtual disk
494 sh MAKEDEV vkd0 # bdev, virtual disk
495 sh MAKEDEV cd0 # bdev, cdrom
496 sh MAKEDEV sa0 wt0 # bdev, tape
497 sh MAKEDEV vty12 # cdev, virtual tty
498 sh MAKEDEV cuaa0 cuaa1 cuaa2 cuaa3 # cdev, serial tty
499 sh MAKEDEV pty0 # cdev, pseudo tty
500 sh MAKEDEV ttyd0 ttyd1 ttyd2 ttyd3 # cdev, serial tty
501 sh MAKEDEV kbd0 kbd1 # cdev, keyboard
502 sh MAKEDEV mse0 psm0 jogdial sysmouse # cdev, mouse
503 sh MAKEDEV pcaudio speaker snd0 # cdev, noise
504 sh MAKEDEV ipsd0 # cdev, ServeRAID disk
505 sh MAKEDEV lpt0 lpt1 lpt2 # cdev, printer
506 sh MAKEDEV ppi0 ppi1 ppi2 # cdev, parallel port
507 sh MAKEDEV iic0 iic1 # cdev, I2C device
508 sh MAKEDEV smb0 smb1 # cdev, SMBus device
509 sh MAKEDEV usb usb0 uhid0 ums0 ulpt0 ugen0 # cdev, USB devices
510 sh MAKEDEV usb1 uhid1 ums1 ulpt1 ugen1 # cdev, USB devices
511 sh MAKEDEV usb2 usb3 usb4 usb5 usb6 usb7 # cdev, USB devices
512 sh MAKEDEV urio0 uscanner0 umodem0 # cdev, USB devices too
513 sh MAKEDEV ucom0 ucom1 ucom2 ucom3 # cdev, USB serial devices
514 sh MAKEDEV bpf0 bpf1 bpf2 bpf3 # cdev, network
515 sh MAKEDEV ipl tun0 tun1 tun2 tun3 # cdev, network
516 sh MAKEDEV tap0 tap1 tap2 tap3 # cdev, network
517 sh MAKEDEV ch0 perfmon tw0 # cdev, miscellaneous
518 sh MAKEDEV acpi # cdev, laptop
519 sh MAKEDEV apm apmctl card0 card1 card2 card3 # cdev, laptop
520 sh MAKEDEV pass4 xpt2 # cdev, CAM
521 sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN
522 sh MAKEDEV i4btel0 i4btel1 i4bteld0 i4bteld1 # cdev, ISDN
523 sh MAKEDEV i4brbch0 i4brbch1 # cdev, ISDN
524 sh MAKEDEV agpgart # cdev, AGP
525 sh MAKEDEV nsmb0 # cdev, SMB/CIFS
526 sh MAKEDEV twed0 # 3ware
527 sh MAKEDEV crypto # cdev, crypto
528 sh MAKEDEV fw0 # cdev, firewire
529 sh MAKEDEV dcons # cdev, dcons
530 sh MAKEDEV pf # pf
531 sh MAKEDEV devctl # cdev, devctl
535 #-----------------------------------------------------------------------------
536 # A much restricted set of the above, to save precious i-nodes on the
537 # fixit floppy
538 #-----------------------------------------------------------------------------
540 fixit)
541 sh MAKEDEV std # standard
542 sh MAKEDEV fd0 # bdev, floppy disk
543 sh MAKEDEV da0 # bdev, SCSI disk
544 sh MAKEDEV ad0 # bdev, ATA disk
545 sh MAKEDEV acd0 afd0 ast0 # bdev, ATAPI devices
546 sh MAKEDEV vn0 # bdev, virtual disk
547 sh MAKEDEV vkd0 # bdev, virtual disk
548 sh MAKEDEV cd0 # bdev, cdrom
549 sh MAKEDEV sa0 # bdev, tape
550 sh MAKEDEV vty2 # cdev, virtual tty
551 sh MAKEDEV cuaa0 # cdev, serial tty
552 sh MAKEDEV pty0 # cdev, pseudo tty
553 sh MAKEDEV ttyd0 # cdev, serial tty
554 sh MAKEDEV kbd0 # cdev, keyboard
555 sh MAKEDEV mse0 psm0 sysmouse # cdev, mouse
556 sh MAKEDEV lpt0 # cdev, printer
557 sh MAKEDEV ppi0 # cdev, parallel port
558 sh MAKEDEV iic0 # cdev, I2C device
559 sh MAKEDEV smb0 # cdev, SMBus device
560 sh MAKEDEV ums0 # cdev, USB devices
561 sh MAKEDEV tun0 # cdev, network
562 sh MAKEDEV tap0 # cdev, network
563 sh MAKEDEV ch0 # cdev, miscellaneous
564 sh MAKEDEV apm apmctl card0 # cdev, laptop
565 sh MAKEDEV pass1 xpt1 # cdev, CAM
566 sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN
567 sh MAKEDEV i4btel0 i4bteld0 # cdev, ISDN
568 sh MAKEDEV i4brbch0 # cdev, ISDN
569 rm -f fd/[1-9]?
572 #-----------------------------------------------------------------------------
573 # Upgrade existing node set.
575 # 1.9 - disk devices have changed
576 #-----------------------------------------------------------------------------
577 upgrade)
578 echo -n "upgrading... "
579 for i in aacd ad ar afd amrd ccd da fd idad ipsd md \
580 mlxd pst twed vn vkd
582 for j in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
584 if [ -c $i$j ]; then
585 rm -f $i$j
586 rm -f $i${j}[a-p]
587 echo -n " $i$j $i${j}s0[a-p] $i${j}s1[a-p]"
588 sh MAKEDEV $i$j
589 # s0 and s1 handled by base
590 for k in s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 \
591 s12 s13 s14 s15
593 if [ -c $i$j${k}c ]; then
594 rm -f ${i}${j}${k}*
595 echo -n " $i$j$k"
596 sh MAKEDEV $i$j$k
597 echo -n " $i$j$k[a-p]"
598 sh MAKEDEV $i$j${k}a
599 elif [ -c $i$j$k ]; then
600 rm -f ${i}${j}${k}*
601 echo -n " $i$j$k"
602 sh MAKEDEV $i$j$k
604 done
606 done
607 done
608 for i in acd cd vcd
610 for j in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
612 if [ -c $i$j ]; then
613 rm -f ${i}${j}*
614 echo -n " $i$j $i${j}s0 $i${j}[a-p]"
615 sh MAKEDEV $i$j
616 elif [ -c $i${j}c ]; then
617 rm -f ${i}${j}*
618 echo -n " $i$j $i${j}s0 $i${j}[a-p]"
619 sh MAKEDEV $i$j
621 done
622 done
623 echo ""
626 #-----------------------------------------------------------------------------
627 # Basic device node set.
628 #-----------------------------------------------------------------------------
630 std)
631 mknod console "" c 0 0
632 mknod kmem "" c 2 1 root:kmem 640
633 mknod mem "" c 2 0 root:kmem 640
634 mknod null "" c 2 2 root:wheel 666
635 mknod random "" c 2 3 root:wheel 644
636 mknod urandom "" c 2 4 root:wheel 644
637 mknod zero "" c 2 12 root:wheel 666
638 mknod io "" c 2 14
639 mknod tty "" c 1 0 root:wheel 666
640 mknod klog "" c 7 0
641 mknod stdin "" c 22 0 root:wheel 666
642 mknod stdout "" c 22 1 root:wheel 666
643 mknod stderr "" c 22 2 root:wheel 666
644 mknod pci "" c 78 0 root:wheel 644
647 #---------------------------------------------------------------------
648 # Create floppy disk nodes in /dev/fd
649 #---------------------------------------------------------------------
651 mkdir -p fd
653 (cd fd &&
654 i=0 &&
655 while [ $i -lt 64 ]
657 mknod $i "" c 22 $i root:wheel 666
659 i=$(($i + 1))
660 done)
662 chmod 555 fd
665 #-----------------------------------------------------------------------------
667 jail)
668 sh MAKEDEV std pty0
670 rm mem kmem pci io klog console
672 ln -sf null mem
673 ln -sf null kmem
674 ln -sf null console
677 #-----------------------------------------------------------------------------
679 mach-4)
680 mknod iopl "" c 22 0
681 mknod kbd "" c 23 0
682 mknod mouse "" c 24 0
683 mknod time "" c 25 0
684 mknod timezone "" c 26 0
687 #-----------------------------------------------------------------------------
689 wt*)
690 u=`expr $i : '..\(.*\)'`
692 [ "$u" ] || u=0
694 # Default density, 512b blocks
695 mknod rwt $u c 10 $((0 + $u)) root:operator 660
696 mknod nrwt $u c 10 $((4 + $u)) root:operator 660
698 # Default density, 1024b blocks
699 # mknod rWt $u c 10 $((64 + $u)) root:operator 660
700 # mknod nrWt $u c 10 $((68 + $u)) root:operator 660
701 mknod rwt ${u}b c 10 $((16 + $u)) root:operator 660 # 60 MB
702 mknod nrwt ${u}b c 10 $((20 + $u)) root:operator 660
703 mknod rwt ${u}c c 10 $((24 + $u)) root:operator 660 # 120 MB
704 mknod nrwt ${u}c c 10 $((28 + $u)) root:operator 660
705 mknod rwt ${u}d c 10 $((32 + $u)) root:operator 660 # 150 MB
706 mknod nrwt ${u}d c 10 $((36 + $u)) root:operator 660
707 # mknod rwt ${u}e c 10 $((40 + $u)) root:operator 660 # 300 MB?
708 # mknod nrwt ${u}e c 10 $((44 + $u)) root:operator 660
709 # mknod rwt ${u}f c 10 $((48 + $u)) root:operator 660 # 600 MB?
710 # mknod nrwt ${u}f c 10 $((52 + $u)) root:operator 660
713 #-----------------------------------------------------------------------------
715 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*)
716 case $i in
717 aacd*s*) name=aacd; chr=151;;
718 acd*s*) name=acd; chr=117;;
719 ad*s*) name=ad; chr=116;;
720 ar*s*) name=ar; chr=157;;
721 afd*s*) name=afd; chr=118;;
722 amrd*s*) name=amrd; chr=133;;
723 ccd*s*) name=ccd; chr=74;;
724 da*s*) name=da; chr=13;;
725 fd*s*) name=fd; chr=9;;
726 idad*s*) name=idad; chr=109;;
727 ipsd*s*) name=ipsd; chr=176;;
728 md*s*) name=md; chr=95;;
729 mlxd*s*) name=mlxd; chr=131;;
730 pst*s*) name=pst; chr=168;;
731 twed*s*) name=twed; chr=147;;
732 vn*s*) name=vn; chr=43;;
733 vkd*s*) name=vkd; chr=97;;
734 esac
736 case $i in
737 aacd*s*|amrd*s*|idad*s*|ipsd*s*|mlxd*s*|twed*s*)
738 unit=`expr $i : '....\([0-9]*\)s'`
739 slice=`expr $i : '....[0-9]*s\([0-9]*\)'`
740 part=`expr $i : '....[0-9]*s[0-9]*\(.*\)'`
743 acd*s*|afd*s*|ccd*s*|pst*s*|wfd*s*|vkd*s*)
744 unit=`expr $i : '...\([0-9]*\)s'`
745 slice=`expr $i : '...[0-9]*s\([0-9]*\)'`
746 part=`expr $i : '...[0-9]*s[0-9]*\(.*\)'`
749 unit=`expr $i : '..\([0-9]*\)s'`
750 slice=`expr $i : '..[0-9]*s\([0-9]*\)'`
751 part=`expr $i : '..[0-9]*s[0-9]*\(.*\)'`
753 esac
755 case $unit in
756 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
757 case $slice in
758 [0-9]|[0-9][0-9]|1[0-1][0-9]|12[0-6])
759 # [no s*] == whole-disk slice (slice #1 in minor)
760 # s0 == slice #0 in minor (compatibility slice)
761 # s1 == slice #2 in minor
762 # s2 == slice #3 in minor
763 # etc..
765 # set slice to slice-in-minor-number
766 oldslice=$slice
767 if [ $oldslice -eq 0 ]; then
768 slice=$(($oldslice))
769 else
770 slice=$(($slice+1))
772 slicename=`dkitos $slice`
773 minor=`ndkminor $unit $slice 255`
774 mknod ${name} $unit$slicename c $chr $minor \
775 root:operator 640
777 # raw device names are extinct
778 rm -f r$name$unit$slicename
780 # get rid of old compatibility devices, the new
781 # ones use 's0', e.g. da0s0a
782 for i in a b c d e f g h i j k l m n o p
784 rm -f $name$unit$i
785 done
787 case $part in
788 [a-p])
790 for part in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
792 minor=`ndkminor $unit $slice $part`
793 partname=`dkitop $part`
794 mknod $name $unit$slicename$partname \
795 c $chr $minor root:operator 640
796 rm -f r$name$unit$slicename$partname
797 done
800 "") ;;
801 *) echo bad partition for disk in: $i
803 esac
806 echo bad slice for disk in: $i
808 esac
811 echo bad unit for disk in: $i "(unit=$unit, slice=$slice, part=$part)"
813 esac
816 #-----------------------------------------------------------------------------
818 control-fd*)
819 unit=`expr $i : '..........\(.*\)'`
820 name=fd; chr=9
822 case $unit in
823 0|1|2|3)
824 minor=`ndkminor $unit 1 129`
825 mknod $name ${unit}.1720 c $chr $minor
826 rm -f r${name}${unit}.1720
828 minor=`ndkminor $unit 1 130`
829 mknod $name ${unit}.1480 c $chr $minor
830 rm -f r${name}${unit}.1480
832 minor=`ndkminor $unit 1 131`
833 mknod $name ${unit}.1440 c $chr $minor
834 rm -f r${name}${unit}.1440
836 minor=`ndkminor $unit 1 132`
837 mknod $name ${unit}.1200 c $chr $minor
838 rm -f r${name}${unit}.1200
840 minor=`ndkminor $unit 1 133`
841 mknod $name ${unit}.820 c $chr $minor
842 rm -f r${name}${unit}.820
844 minor=`ndkminor $unit 1 134`
845 mknod $name ${unit}.800 c $chr $minor
846 rm -f r${name}${unit}.800
848 minor=`ndkminor $unit 1 135`
849 mknod $name ${unit}.720 c $chr $minor
850 rm -f r${name}${unit}.720
852 minor=`ndkminor $unit 1 136`
853 mknod $name ${unit}.360 c $chr $minor
854 rm -f r${name}${unit}.360
856 minor=`ndkminor $unit 1 137`
857 mknod $name ${unit}.640 c $chr $minor
858 rm -f r${name}${unit}.640
860 minor=`ndkminor $unit 1 138`
861 mknod $name ${unit}.1232 c $chr $minor
862 rm -f r${name}${unit}.1232
865 echo bad unit for disk in: $i
867 esac
870 #-----------------------------------------------------------------------------
872 acd*t*)
873 units=`expr $i : '...\(.*\)t'`;
874 tracks=`expr $i : '.*t\(.*\)'`;
875 name=acd;
876 chr=117;
878 [ "$units" ] || units=0
879 [ "$tracks" ] || tracks=100
881 if [ "$units" -le 31 -a "$tracks" -le 169 ]
882 then
884 while [ $i -le $units ]
886 dname=$name$i
887 rm -rf ${dname}t*
890 while [ $j -le $tracks ]
892 # cd unit tracks use the compatibility slice
893 # and partition numbers 129+ for tracks 1+.
895 minor=`ndkminor $i 1 $(($j + 128))`
896 mknod ${dname}t $j c $chr $minor \
897 root:operator 640
898 j=$(($j + 1))
899 done
901 i=$(($i + 1))
902 done
903 else
904 echo "$i is invalid -- can't have more than 32 cd devices or 169 tracks"
908 #-----------------------------------------------------------------------------
910 aacd*|acd*|ad*|ar*|afd*|amrd*|cd*|ccd*|da*|fd*|idad*|ipsd*|md*|mlxd*|pst*|twed*|vcd*|vn*|vkd*)
911 doslices=1
912 directraw=0
913 case $i in
914 aacd*) name=aacd; chr=151;;
915 acd*) name=acd; chr=117; doslices=0; directraw=1;;
916 ad*) name=ad; chr=116;;
917 ar*) name=ar; chr=157;;
918 afd*) name=afd; chr=118;;
919 amrd*) name=amrd; chr=133;;
920 cd*) name=cd; chr=15; doslices=0;;
921 da*) name=da; chr=13;;
922 fd*) name=fd; chr=9;;
923 ccd*) name=ccd; chr=74;;
924 idad*) name=idad; chr=109;;
925 ipsd*) name=ipsd; chr=176;;
926 md*) name=md; chr=95;;
927 mlxd*) name=mlxd; chr=131;;
928 pst*) name=pst; chr=168;;
929 twed*) name=twed; chr=147;;
930 vcd*) name=vcd; chr=98; doslices=0;;
931 vn*) name=vn; chr=43;;
932 vkd*) name=vkd; chr=97;;
933 esac
935 case $i in
936 aacd*|amrd*|idad*|ipsd*|mlxd*|twed*)
937 unit=`expr $i : '....\(.*\)'`
939 acd*|afd*|ccd*|pst*|wfd*|vcd*|vkd*)
940 unit=`expr $i : '...\(.*\)'`
943 unit=`expr $i : '..\(.*\)'`
945 esac
947 case $i in
948 fd*)
949 sh MAKEDEV control-$name$unit
951 esac
953 case $unit in
954 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
955 if [ "$doslices" -gt 0 ]; then
956 minor=`ndkminor $unit 1 255`
957 mknod ${name} ${unit} c $chr $minor \
958 root:operator 640
959 for slicepartname in s0h s1h s2 s3 s4
961 sh MAKEDEV $name$unit$slicepartname
962 done
963 else
964 if [ "$directraw" -gt 0 ]; then
965 minor=`ndkminor $unit 1 128`
966 mknod ${name} ${unit} c $chr $minor \
967 root:operator 640
968 else
969 minor=`ndkminor $unit 1 255`
970 mknod ${name} ${unit} c $chr $minor \
971 root:operator 640
973 minor=`ndkminor $unit 1 255`
974 mknod ${name} ${unit}s0 c $chr $minor \
975 root:operator 640
976 minor=`ndkminor $unit 0 0`
977 mknod ${name} ${unit}a c $chr $minor \
978 root:operator 640
979 minor=`ndkminor $unit 0 2`
980 mknod ${name} ${unit}c c $chr $minor \
981 root:operator 640
985 echo bad unit for disk in: $i
987 esac
990 #-----------------------------------------------------------------------------
992 pt[0-9]*)
993 chr=61
994 name=pt
995 unit=`expr $i : 'pt\([0-9][0-9]*\)'`
997 [ "$unit" ] || unit=0
999 unit=$(($unit + 1 - 1))
1000 mknod $name $unit c $chr `unit2minor $unit`
1003 #-----------------------------------------------------------------------------
1005 ses[0-9]*)
1006 chr=110
1007 name=ses
1008 unit=`expr $i : 'ses\([0-9][0-9]*\)'`
1010 [ "$unit" ] || unit=0
1012 unit=$(($unit + 1 - 1))
1013 mknod $name $unit c $chr `unit2minor $unit`
1016 #-----------------------------------------------------------------------------
1018 targ[0-9]*)
1019 chr=65
1020 name=targ
1021 unit=`expr $i : 'targ\([0-9][0-9]*\)'`
1023 [ "$unit" ] || unit=0
1025 unit=$(($unit + 1 - 1))
1027 mknod $name $unit c $chr `unit2minor $unit`
1028 mknod ${name}.ctl "" c $chr 0xffff00ff
1031 #-----------------------------------------------------------------------------
1033 # CAM transport layer device
1034 xpt*)
1035 # This major number is temporary
1036 chr=104
1037 name=xpt
1038 units=`expr $i : 'xpt\(.*\)'`
1040 [ "$units" ] || units=1
1043 while [ $i -lt $units ]
1045 rm -rf $name$i
1047 mknod $name $i c $chr `unit2minor $i` root:operator
1049 i=$(($i + 1))
1050 done
1053 #-----------------------------------------------------------------------------
1055 pass*)
1056 # This major number is temporary
1057 chr=31
1058 name=pass
1059 units=`expr $i : 'pass\(.*\)'`
1061 [ "$units" ] || units=1
1064 while [ $i -lt $units ]
1066 rm -rf $name$i
1068 mknod $name $i c $chr `unit2minor $i` root:operator
1070 i=$(($i + 1))
1071 done
1074 #-----------------------------------------------------------------------------
1076 pty*)
1077 class=`expr $i : 'pty\(.*\)'`
1078 case $class in
1079 0) offset=0 name=p;;
1080 1) offset=32 name=q;;
1081 2) offset=64 name=r;;
1082 3) offset=96 name=s;;
1083 4) offset=128 name=P;; # Note that xterm (at least) only look at p-s.
1084 5) offset=160 name=Q;;
1085 6) offset=192 name=R;;
1086 7) offset=224 name=S;;
1087 *) echo bad unit for pty in: $i;;
1088 esac
1090 case $class in
1091 0|1|2|3|4|5|6|7)
1093 while [ $i -lt 32 ]
1095 c=$(echo 0123456789abcdefghijklmnopqrstuv |
1096 dd bs=1 skip=$i count=1 2>/dev/null)
1098 mknod tty$name $c c 5 $(($offset + $i)) root:wheel 666
1099 mknod pty$name $c c 6 $(($offset + $i)) root:wheel 666
1101 i=$(($i + 1))
1102 done
1104 esac
1107 #-----------------------------------------------------------------------------
1109 sa*)
1110 unit=`expr $i : '..\(.*\)'`
1111 chr=14
1113 case $unit in
1114 [0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9])
1115 mknod sa ${unit}.ctl c $chr `saminor 1 ${unit} 0 0` \
1116 root:wheel 660
1117 ln -f sa${unit}.ctl rsa${unit}.ctl
1119 for m in 0 1 2 3
1121 mknod sa ${unit}.$m c $chr \
1122 `saminor 0 $unit $m 0` root:operator 660
1123 ln -f sa${unit}.$m rsa${unit}.$m
1125 mknod nsa ${unit}.$m c $chr \
1126 `saminor 0 $unit $m 1` root:operator 660
1127 ln -f nsa${unit}.$m nrsa${unit}.$m
1129 mknod esa ${unit}.$m c $chr \
1130 `saminor 0 $unit $m 2` root:operator 660
1131 ln -f esa${unit}.$m ersa${unit}.$m
1132 done
1134 ln -f sa${unit}.0 sa$unit
1135 ln -f sa${unit}.0 rsa${unit}.0
1136 ln -f sa${unit}.0 rsa$unit
1137 ln -f nsa${unit}.0 nsa$unit
1138 ln -f nsa${unit}.0 nrsa${unit}.0
1139 ln -f nsa${unit}.0 nrsa$unit
1140 ln -f esa${unit}.0 esa$unit
1141 ln -f esa${unit}.0 ersa${unit}.0
1142 ln -f esa${unit}.0 ersa$unit
1145 echo bad unit for tape in: $i
1147 esac
1150 #-----------------------------------------------------------------------------
1152 ch*)
1153 unit=`expr $i : '..\(.*\)'`
1155 case $i in
1156 ch*) name=ch; chr=17;;
1157 esac
1159 case $unit in
1160 0|1|2|3|4|5|6)
1161 mknod $name $unit c $chr $unit root:operator 640
1164 echo bad unit for media changer in: $i
1166 esac
1169 #-----------------------------------------------------------------------------
1171 ata)
1172 mknod ata "" c 159 0 root:operator
1175 #-----------------------------------------------------------------------------
1177 ast*)
1178 unit=`expr $i : '...\(.*\)'`
1179 chr=119
1181 case $unit in
1182 0|1|2|3)
1183 mknod ast $unit c $chr $(($unit * 8 + 0)) root:operator 640
1184 mknod nast $unit c $chr $(($unit * 8 + 1)) root:operator 640
1187 echo bad unit for tape in: $i
1189 esac
1192 #-----------------------------------------------------------------------------
1194 iic*)
1195 unit=`expr $i : 'iic\(.*\)'`
1197 mknod iic $unit c 105 `unit2minor $unit`
1200 #-----------------------------------------------------------------------------
1202 smb*)
1203 unit=`expr $i : 'smb\(.*\)'`
1205 mknod smb $unit c 106 `unit2minor $unit`
1208 #-----------------------------------------------------------------------------
1210 pcfclock*)
1211 unit=`expr $i : 'pcfclock\(.*\)'`
1213 mknod pcfclock $unit c 140 `unit2minor $unit`
1216 #-----------------------------------------------------------------------------
1218 ppi*)
1219 unit=`expr $i : 'ppi\(.*\)'`
1221 mknod ppi $unit c 82 `unit2minor $unit`
1224 #-----------------------------------------------------------------------------
1226 pps*)
1227 unit=`expr $i : 'pps\(.*\)'`
1229 mknod pps $unit c 89 `unit2minor $unit`
1232 #-----------------------------------------------------------------------------
1234 usb)
1235 mknod usb "" c 108 255 root:operator 0660
1238 #-----------------------------------------------------------------------------
1240 usb*)
1241 unit=`expr $i : 'usb\(.*\)'`
1243 mknod usb $unit c 108 `unit2minor $unit` root:operator 660
1246 #-----------------------------------------------------------------------------
1248 ucom*)
1249 unit=`expr $i : 'ucom\(.*\)'`
1251 minor=$(($unit + 128))
1252 minor=`unit2minor $(($unit + 128))`
1254 mknod ucom $unit c 138 $minor uucp:dialer 660
1257 #-----------------------------------------------------------------------------
1259 uhid*)
1260 unit=`expr $i : 'uhid\(.*\)'`
1262 mknod uhid $unit c 122 `unit2minor $unit` root:operator 660
1265 #-----------------------------------------------------------------------------
1267 ums*)
1268 unit=`expr $i : 'ums\(.*\)'`
1270 mknod ums $unit c 111 `unit2minor $unit` root:operator 660
1273 #-----------------------------------------------------------------------------
1275 ulpt*)
1276 unit=`expr $i : 'ulpt\(.*\)'`
1278 minor=`unit2minor $unit`
1279 mknod ulpt $unit c 113 $minor
1281 minor=`unit2minor $(($unit + 64))`
1282 mknod unlpt $unit c 113 $minor # and the 'no prime' version
1285 #-----------------------------------------------------------------------------
1287 ugen*)
1288 unit=`expr $i : 'ugen\([0-9][0-9]*\)'`
1289 endpoint=`expr $i : 'ugen.*\.\([0-9][0-9]*\)'`
1291 [ "$unit" ] || echo $i - Invalid unit number
1293 if [ -z "${endpoint}" ] # ugen0 & ugen0.1 - ugen0.15
1294 then
1295 mknod ugen $unit c 114 `unit2minor $(($unit * 16))` \
1296 root:operator 660
1298 while [ $i -lt 16 ]
1300 mknod ugen $unit.$i c 114 `unit2minor \
1301 $(($unit * 16 + $i))` root:operator 660
1303 i=$(($i + 1))
1304 done
1305 else
1306 minor=`unit2minor $(($unit * 16 + $endpoint))`
1307 mknod ugen $unit.$endpoint c 114 $minor root:operator 660
1311 #-----------------------------------------------------------------------------
1313 urio*)
1314 unit=`expr $i : 'urio\(.*\)'`
1316 mknod urio $unit c 143 `unit2minor $unit` root:operator 660
1319 #-----------------------------------------------------------------------------
1321 uscanner*)
1322 unit=`expr $i : 'uscanner\(.*\)'`
1324 mknod uscanner $unit c 156 `unit2minor $unit` root:operator 660
1327 #-----------------------------------------------------------------------------
1329 umodem*)
1330 unit=`expr $i : 'umodem\(.*\)'`
1332 mknod umodem $unit c 124 `unit2minor $unit` uucp:dialer 660
1335 #-----------------------------------------------------------------------------
1337 lpt*)
1338 unit=`expr $i : 'lpt\(.*\)'`
1340 mknod lpt $unit c 16 `unit2minor $unit`
1341 mknod lpctl $unit c 16 `unit2minor $(($unit + 128))`
1344 #-----------------------------------------------------------------------------
1346 vty*)
1347 chr=12
1348 units=`expr $i : 'vty\(.*\)'`
1351 while [ $i -lt $units ]
1353 mknod ttyv $(printf %01x $i) c $chr `unit2minor $i`
1355 i=$(($i + 1))
1356 done
1358 ln -fs ttyv0 vga
1361 #-----------------------------------------------------------------------------
1363 nmdm*)
1364 units=`expr $i : 'nmdm\(.*\)'`
1365 chr=18
1368 while [ $i -lt $units ]
1370 minor=`unit2minor $i`
1371 minor=$(($minor + $minor))
1372 mknod nmdm ${i}A c $chr $minor
1373 mknod nmdm ${i}B c $chr $(($minor + 1))
1375 i=$(($i + 1))
1376 done
1379 #-----------------------------------------------------------------------------
1381 bpf*)
1382 nbpf=`expr $i : 'bpf\(.*\)$'`
1384 unit=0
1385 while [ $unit -le $nbpf ]
1387 mknod bpf $unit c 23 `unit2minor $unit`
1389 unit=$(($unit + 1))
1390 done
1393 #-----------------------------------------------------------------------------
1395 speaker)
1396 mknod speaker "" c 26 0
1399 #-----------------------------------------------------------------------------
1401 cua?|cuaa?|cuaa??)
1402 unit_low=`expr $i : 'cua.*\(.\)$'`
1404 case $i in
1405 cua?|cuaa?)
1406 unit_high=""
1407 m_high=0
1409 cuaa??)
1410 unit_high=`expr $i : 'cuaa\(.\).$'`
1411 m_high=`ttyminor $unit_high`
1413 esac
1415 unit=$unit_high$unit_low
1416 m=$(($m_high << 16 | `ttyminor $unit_low`))
1418 mknod cuaa $unit c 28 $(($m | 128)) uucp:dialer 660
1419 mknod cuaia $unit c 28 $(($m | 32 | 128)) uucp:dialer 660
1420 mknod cuala $unit c 28 $(($m | 64 | 128)) uucp:dialer 660
1423 #-----------------------------------------------------------------------------
1425 crypto)
1426 mknod crypto "" c 70 0 root:operator 666
1429 #-----------------------------------------------------------------------------
1432 mknod pf "" c 73 0 root:operator 600
1435 #-----------------------------------------------------------------------------
1437 fw?)
1438 unit=`expr $i : 'fw\(.\)$'`
1440 for sub in 0 1 2 3
1442 minor=$(($unit << 16 | $sub))
1443 mknod fw $unit.$sub c 127 $minor root:operator 660
1444 mknod fwmem $unit.$sub c 127 $((1<<24 | $minor)) \
1445 root:operator 660
1446 done
1448 ln -sf fw$unit.0 fw$unit
1449 ln -sf fwmem$unit.0 fwmem$unit
1452 #-----------------------------------------------------------------------------
1454 dcons)
1455 mknod dcons "" c 184 0 root:wheel 600
1458 #-----------------------------------------------------------------------------
1460 tty?|tty0?|ttyd?|ttyd??)
1461 unit_low=`expr $i : 'tty.*\(.\)$'`
1463 case $i in
1464 tty?|tty0?|ttyd?)
1465 unit_high=""
1466 m_high=0
1468 ttyd??)
1469 unit_high=`expr $i : 'ttyd\(.\).$'`
1470 m_high=`ttyminor $unit_high`
1472 esac
1474 unit=$unit_high$unit_low
1475 m=$(($m_high << 16 | `ttyminor $unit_low`))
1477 mknod ttyd $unit c 28 $m
1478 mknod ttyid $unit c 28 $(($m | 32))
1479 mknod ttyld $unit c 28 $(($m | 64))
1482 #-----------------------------------------------------------------------------
1484 cuac?)
1485 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1486 g h i j k l m n o p q r s t u v"
1487 major=48
1488 card=`expr $i : 'cua.*\(.\)$'`
1490 for unit in $portlist
1492 minor=`ttyminor $unit`
1493 minor=$(($card * 65536 + $minor))
1494 name=$card$unit
1496 mknod cuac $name c $major $(($minor + 128)) uucp:dialer 660
1497 mknod cuaic $name c $major $(($minor + 32 + 128)) \
1498 uucp:dialer 660
1499 mknod cualc $name c $major $(($minor + 64 + 128)) \
1500 uucp:dialer 660
1501 done
1504 #-----------------------------------------------------------------------------
1506 ttyc?)
1507 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1508 g h i j k l m n o p q r s t u v"
1509 major=48
1510 card=`expr $i : 'tty.*\(.\)$'`
1512 for unit in $portlist
1514 minor=`ttyminor $unit`
1515 minor=$(($card * 65536 + $minor))
1516 name=$card$unit
1518 mknod ttyc $name c $major $minor
1519 mknod ttyic $name c $major $(($minor + 32))
1520 mknod ttylc $name c $major $(($minor + 64))
1521 done
1524 #-----------------------------------------------------------------------------
1526 cuam?)
1527 unit=`expr $i : 'cua.*\(.\)$'`
1529 m=`ttyminor $unit`
1531 mknod cuam $unit c 63 $(($m + 128)) uucp:dialer 660
1534 #-----------------------------------------------------------------------------
1536 ttym?)
1537 unit=`expr $i : 'tty.*\(.\)$'`
1539 m=`ttyminor $unit`
1541 mknod ttym $unit c 63 $m
1544 #-----------------------------------------------------------------------------
1546 ttyA*)
1547 major=68
1548 nports=`expr $i : 'ttyA\(.*\)$'`
1549 port=1
1551 while [ $port -le $nports ]
1553 minor=$(($port - 1))
1554 name=$(printf %02d $port)
1556 mknod ttyA $name c $major $minor
1557 mknod ttyiA $name c $major $(($minor + 65536))
1558 mknod ttylA $name c $major $(($minor + 131072))
1560 port=$(($port + 1))
1561 done
1563 # For the user-mode control program, 'sicontrol'
1564 mknod si_control "" c 68 262144
1567 #-----------------------------------------------------------------------------
1569 cuaA*)
1570 major=68
1571 nports=`expr $i : 'cuaA\(.*\)$'`
1572 port=1
1574 while [ $port -le $nports ]
1576 minor=$(($port - 1))
1577 name=$(printf %02d $port)
1579 mknod cuaA $name c $major $(($minor + 128)) uucp:dialer 660
1580 mknod cuaiA $name c $major $(($minor + 128 + 65536)) \
1581 uucp:dialer 660
1582 mknod cualA $name c $major $(($minor + 128 + 131072)) \
1583 uucp:dialer 660
1585 port=$(($port + 1))
1586 done
1589 #-----------------------------------------------------------------------------
1591 ttyD?)
1592 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1593 major=58
1594 card=`expr $i : 'tty.*\(.\)$'`
1596 for unit in $portlist
1598 minor=`ttyminor $unit`
1599 minor=$(($card * 65536 + $minor))
1600 name=$card$unit
1602 mknod ttyD $name c $major $minor
1603 mknod ttyiD $name c $major $(($minor + 32))
1604 mknod ttylD $name c $major $(($minor + 64))
1605 done
1608 #-----------------------------------------------------------------------------
1610 cuaD?)
1611 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1612 major=58
1613 card=`expr $i : 'cua.*\(.\)$'`
1615 for unit in $portlist
1617 minor=`ttyminor $unit`
1618 minor=$(($card * 65536 + $minor))
1619 name=$card$unit
1621 mknod cuaD $name c $major $(($minor + 128)) uucp:dialer 660
1622 mknod cuaiD $name c $major $(($minor + 32 + 128)) \
1623 uucp:dialer 660
1624 mknod cualD $name c $major $(($minor + 64 + 128)) \
1625 uucp:dialer 660
1626 done
1629 #-----------------------------------------------------------------------------
1631 ttyE*)
1632 stallion 72 E `expr $i : 'tty.*\(.\)$'` 0
1634 cuaE*)
1635 stallion 72 E `expr $i : 'cua.*\(.\)$'` 1
1637 stl*)
1638 card=`expr $i : 'stl\(.\)$'`
1639 stallion 72 E $card 0
1640 stallion 72 E $card 1
1643 ttyF*)
1644 stallion 75 F `expr $i : 'tty.*\(.\)$'` 0
1646 cuaF*)
1647 stallion 75 F `expr $i : 'cua.*\(.\)$'` 1
1649 stli*)
1650 card=`expr $i : 'stl\(.\)$'`
1651 stallion 75 F $card 0
1652 stallion 75 F $card 1
1655 ttyM*)
1656 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1657 modulelist="a b c d"
1658 major=101
1659 card=`expr $i : 'tty.*\(.\)$'`
1661 for unit in $modulelist
1663 moduleminor=`ttyminor $unit`
1664 moduleminor=$(($moduleminor % 10 * 16))
1665 modulename=$unit
1667 for unit in $portlist
1669 minor=`ttyminor $unit`
1670 minor=$(($card * 65536 + $minor + $moduleminor))
1671 name=$card$modulename$unit
1673 rm -f tty*M$name
1675 mknod ttyM $name c $major $minor
1676 mknod ttyiM $name c $major $(($minor + 64))
1677 mknod ttylM $name c $major $(($minor + 128))
1678 done
1679 done
1682 cuaM?)
1683 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1684 modulelist="a b c d"
1685 major=101
1686 card=`expr $i : 'cua.*\(.\)$'`
1688 for unit in $modulelist
1690 moduleminor=`ttyminor $unit`
1691 moduleminor=$(($moduleminor % 10 * 16))
1692 modulename=$unit
1694 for unit in $portlist
1696 minor=`ttyminor $unit`
1697 minor=$(($card * 65536 + $minor + $moduleminor))
1698 name=$card$modulename$unit
1700 rm -f cua*M$name
1702 mknod cuaM $name c $major $(($minor + 262144)) \
1703 uucp:dialer 660
1704 mknod cuaiM $name c $major $(($minor + 64 + 262144)) \
1705 uucp:dialer 660
1706 mknod cualM $name c $major $(($minor + 128 + 262144)) \
1707 uucp:dialer 660
1708 done
1709 done
1712 ttyR?)
1713 major=81
1714 BOARD=1; Rnum=0
1715 MINOR=$(($BOARD * 65536))
1716 controllers=$(
1717 dmesg | while read first rest
1719 case "$first" in
1720 RocketPort[0-4]) echo "$first"
1722 esac
1723 done)
1725 rm -f ttyR* ttyiR* ttylR*
1727 for i in $controllers
1729 ndevices=$(
1730 dmesg | while read first bar ports rest
1732 case "$first" in
1733 $i*) echo "$ports"
1735 esac
1736 done)
1738 echo -n "Creating $ndevices devices for $i: "
1739 dev=0
1741 while [ $dev -lt $ndevices ]
1743 mknod ttyR $Rnum c $major $MINOR
1744 mknod ttyiR $Rnum c $major $(($MINOR + 32))
1745 mknod ttylR $Rnum c $major $(($MINOR + 64))
1747 Rnum=$(($Rnum + 1))
1748 MINOR=$(($MINOR + 1))
1750 dev=$(($dev + 1))
1751 done
1753 BOARD=$(($BOARD + 1))
1754 MINOR=$(($BOARD * 65536))
1755 echo " "
1756 done
1759 cuaR?)
1760 major=81
1761 BOARD=1; Rnum=0
1762 MINOR=$(($BOARD * 65536))
1763 controllers=$(
1764 dmesg | while read first rest
1766 case "$first" in
1767 RocketPort[0-4]) echo "$first"
1769 esac
1770 done)
1772 rm -f cuaR* cuaiR* cualR*
1774 for i in $controllers
1776 ndevices=$(
1777 dmesg | while read first bar ports rest
1779 case "$first" in
1780 $i*) echo "$ports"
1782 esac
1783 done)
1785 echo -n "Creating $ndevices devices for $i: "
1786 dev=0
1788 while [ $dev -lt $ndevices ]
1790 mknod cuaR $Rnum c $major $(($MINOR + 128)) \
1791 uucp:dialer 660
1792 mknod cuaiR $Rnum c $major $(($MINOR + 128 + 32)) \
1793 uucp:dialer 660
1794 mknod cualR $Rnum c $major $(($MINOR + 128 + 64)) \
1795 uucp:dialer 660
1797 Rnum=$(($Rnum + 1))
1798 MINOR=$(($MINOR + 1))
1800 dev=$(($dev + 1))
1801 done
1803 BOARD=$(($BOARD + 1))
1804 MINOR=$(($BOARD * 65536))
1805 echo " "
1806 done
1809 #-----------------------------------------------------------------------------
1811 mse*)
1812 unit=`expr $i : 'mse\(.*\)'`
1813 chr=27
1815 # Non-blocking for X11
1816 mknod mse $unit c $chr `unit2minor $(($unit * 2 + 1))`
1819 #-----------------------------------------------------------------------------
1821 psm*)
1822 unit=`expr $i : 'psm\(.*\)'`
1823 chr=21
1825 # Non-blocking for X11
1826 mknod psm $unit c $chr `unit2minor $(($unit * 2 + 1))`
1829 #-----------------------------------------------------------------------------
1831 mouse*)
1832 name=`expr $i : 'mouse\(.*\)'`
1834 [ -c $name ] || $0 $name # Make the appropriate device
1836 ln -fs $name mouse
1839 #-----------------------------------------------------------------------------
1841 pcaudio)
1842 mknod pcaudio "" c 24 0
1843 mknod pcaudioctl "" c 24 128
1846 #-----------------------------------------------------------------------------
1848 socksys)
1849 mknod socksys "" c 41 0 root:wheel 666
1850 mknod spx "" c 41 1 root:wheel 666
1852 ln -fs socksys nfsd
1855 #-----------------------------------------------------------------------------
1857 snd*)
1859 unit=`expr $i : 'snd\(.*\)'`
1860 chr=30
1862 ln -fs mixer$unit mixer
1863 ln -fs sequencer$unit sequencer
1864 ln -fs dsp$unit dsp
1865 ln -fs dspW$unit dspW
1866 ln -fs music$unit music
1867 ln -fs pss$unit pss
1868 ln -fs dsp$unit.0 dsp$unit
1869 ln -fs dspW$unit.0 dspW$unit
1871 ln -fs dsp audio
1872 ln -fs dsp$unit audio$unit
1874 mknod mixer $unit c $chr `unit2minor $(($unit * 16 + 0))` \
1875 root:wheel 666
1876 mknod sequencer $unit c $chr `unit2minor $(($unit * 16 + 1))` \
1877 root:wheel 666
1878 mknod midi $unit c $chr `unit2minor $(($unit * 16 + 2))` \
1879 root:wheel 666
1881 for chn in 0 1 2 3
1883 minor=$(($chn * 65536 + $unit * 16))
1885 mknod dsp $unit.$chn c $chr $(($minor + 3)) root:wheel 666
1886 mknod dspW $unit.$chn c $chr $(($minor + 5)) root:wheel 666
1887 ln -fs dsp$unit.$chn audio$unit.$chn
1888 done
1890 mknod sndstat "" c $chr 6 root:wheel 666
1891 mknod music $unit c $chr `unit2minor $(($unit * 16 + 8))` root:wheel 666
1892 mknod pss $unit c $chr `unit2minor $(($unit * 16 + 9))` root:wheel 666
1895 #-----------------------------------------------------------------------------
1897 vat)
1898 mknod vatio "" c 25 128 root:wheel 660
1901 #-----------------------------------------------------------------------------
1903 gsc*)
1904 unit=`expr $i : 'gsc\(.*\)'`
1906 mknod gsc $unit c 47 `unit2minor $unit` root:wheel 666
1907 mknod gsc ${unit}p c 47 `unit2minor $(($unit + 8))` root:wheel 666
1908 mknod gsc ${unit}d c 47 `unit2minor $(($unit + 32))` root:wheel 666
1909 mknod gsc ${unit}pd c 47 `unit2minor $(($unit + 40))` root:wheel 666
1912 #-----------------------------------------------------------------------------
1914 acpi)
1915 mknod acpi "" c 152 0 root:operator 664
1918 #-----------------------------------------------------------------------------
1920 apm)
1921 mknod apm "" c 39 0 root:operator 664
1924 #-----------------------------------------------------------------------------
1926 apmctl)
1927 mknod apmctl "" c 39 8 root:operator 660
1930 #-----------------------------------------------------------------------------
1932 card*)
1933 unit=`expr $i : 'card\(.*\)'`
1934 chr=50
1936 mknod card $unit c $chr `unit2minor $unit` root:wheel 644
1939 #-----------------------------------------------------------------------------
1941 ttyx?|ttyy?|ttyz?)
1942 case $i in
1943 *0) unit=0;; *1) unit=1;; *2) unit=2;; *3) unit=3;;
1944 *4) unit=4;; *5) unit=5;; *6) unit=6;; *7) unit=7;;
1945 *8) unit=8;; *9) unit=9;; *a) unit=10;; *b) unit=11;;
1946 *c) unit=12;; *d) unit=13;; *e) unit=14;; *f) unit=15;;
1947 esac
1949 case $i in
1950 ttyy?) unit=$(($unit + 16));;
1951 ttyz?) unit=$(($unit + 32));;
1952 esac
1954 mknod $i "" c 42 $unit
1957 #-----------------------------------------------------------------------------
1959 cronyx)
1960 mknod cronyx "" c 42 63
1963 #-----------------------------------------------------------------------------
1965 joy)
1966 mknod joy 0 c 51 0 root:operator 640
1967 mknod joy 1 c 51 1 root:operator 640
1970 #-----------------------------------------------------------------------------
1972 spigot)
1973 mknod spigot "" c 11 0 root:wheel 444
1976 #-----------------------------------------------------------------------------
1978 ctx?)
1979 unit=`expr $i : 'ctx\(.*\)'`
1981 mknod ctx $unit c 40 `unit2minor $unit` root:wheel 444
1984 #-----------------------------------------------------------------------------
1986 meteor?)
1987 unit=`expr $i : 'meteor\(.*\)'`
1989 mknod meteor $unit c 67 `unit2minor $unit` root:wheel 444
1992 #-----------------------------------------------------------------------------
1994 bktr?)
1995 unit=`expr $i : 'bktr\(.*\)'`
1997 mknod bktr $unit c 92 `unit2minor $unit` root:wheel 444
1998 mknod tuner $unit c 92 `unit2minor $((16 + $unit))` root:wheel 444
1999 mknod vbi $unit c 92 `unit2minor $((32 + $unit))` root:wheel 444
2002 #-----------------------------------------------------------------------------
2004 cxm?)
2005 unit=`expr $i : 'cxm\(.*\)'`
2007 mknod cxm $unit c 93 `unit2minor $unit` root:wheel 444
2010 #-----------------------------------------------------------------------------
2012 tun*)
2013 ntun=`expr $i : 'tun\(.*\)$'`
2014 unit=0
2016 while [ $unit -le $ntun ]
2018 mknod tun $unit c 52 `unit2minor $unit`
2020 unit=$(($unit + 1))
2021 done
2024 #-----------------------------------------------------------------------------
2026 tap*)
2027 ntap=`expr $i : 'tap\(.*\)$'`
2028 unit=0
2030 while [ $unit -le $ntap ]
2032 mknod tap $unit c 149 `unit2minor $unit` root:network
2034 unit=$(($unit + 1))
2035 done
2038 #-----------------------------------------------------------------------------
2040 sysmouse)
2041 mknod sysmouse "" c 12 128
2042 mknod consolectl "" c 12 255
2045 #-----------------------------------------------------------------------------
2047 jogdial)
2048 mknod jogdial "" c 160 0
2051 #-----------------------------------------------------------------------------
2053 snp?)
2054 unit=`expr $i : 'snp\(.*\)'`
2056 mknod snp $unit c 53 `unit2minor $unit`
2059 #-----------------------------------------------------------------------------
2061 labpc*)
2062 case $i in
2063 labpcaio*)
2064 name=labpcaio
2065 unit=`expr $i : 'labpcaio\(.*\)'`
2066 all="0 1 2 3 4 5 6 7"
2067 offset=0
2070 labpcdio*)
2071 name=labpcdio
2072 unit=`expr $i : 'labpcdio\(.*\)'`
2073 all="0 1 2 3"
2074 offset=8
2078 die 3 "Don't know LabPC type $i"
2080 esac
2082 [ "${unit}" ] || unit=all
2084 case $unit in
2085 0|1|2|3|4|5|6|7)
2086 mknod $name $unit c 66 $(($offset + $unit)) \
2087 root:wheel 660
2090 all)
2091 for i in $all
2093 mknod $name $i c 66 $(($offset + $i)) \
2094 root:wheel 660
2095 done
2099 echo "No such LabPC unit: $unit"
2101 esac
2104 #-----------------------------------------------------------------------------
2106 perfmon)
2107 mknod perfmon "" c 2 32 root:kmem 640
2110 #-----------------------------------------------------------------------------
2112 ipl)
2113 mknod ipl "" c 79 0
2114 mknod ipnat "" c 79 1
2115 mknod ipstate "" c 79 2
2116 mknod ipauth "" c 79 3
2119 #-----------------------------------------------------------------------------
2121 elan*)
2122 mknod elan-mmcr "" c 100 0 root:wheel 600
2125 #-----------------------------------------------------------------------------
2127 kbd*)
2128 unit=`expr $i : 'kbd\(.*\)'`
2129 chr=112
2131 mknod kbd $unit c $chr `unit2minor $unit`
2134 #-----------------------------------------------------------------------------
2136 i4b)
2137 mknod i4b "" c 60 0
2140 i4bctl)
2141 mknod i4bctl "" c 55 0
2144 i4brbch*)
2145 unit=`expr $i : 'i4brbch\(.*\)'`
2147 mknod i4brbch $unit c 57 `unit2minor $unit`
2150 i4bteld*)
2151 offset=64
2152 unit=`expr $i : 'i4bteld\(.*\)'`
2154 mknod i4bteld $unit c 56 `unit2minor $(($offset + $unit))`
2157 i4btel*)
2158 unit=`expr $i : 'i4btel\(.*\)'`
2160 mknod i4btel $unit c 56 `unit2minor $unit`
2163 i4btrc*)
2164 unit=`expr $i : 'i4btrc\(.*\)'`
2166 mknod i4btrc $unit c 59 `unit2minor $unit`
2169 #-----------------------------------------------------------------------------
2171 aac*)
2172 unit=`expr $i : 'aac\(.*\)'`
2174 mknod aac $unit c 150 `unit2minor $unit`
2176 ln -fs aac$unit afa$unit
2177 ln -fs aac$unit hpn$unit
2180 #-----------------------------------------------------------------------------
2182 mlx*)
2183 unit=`expr $i : 'mlx\(.*\)'`
2185 mknod mlx $unit c 130 `unit2minor $unit`
2188 #-----------------------------------------------------------------------------
2190 amr*)
2191 unit=`expr $i : 'amr\(.*\)'`
2193 mknod amr $unit c 132 `unit2minor $unit`
2196 #-----------------------------------------------------------------------------
2198 ips*)
2199 unit=`expr $i : 'ips\(.*\)'`
2201 mknod mlx $unit c 175 `unit2minor $unit`
2204 #-----------------------------------------------------------------------------
2206 ciss*)
2207 unit=`expr $i : 'ciss\(.*\)'`
2209 mknod ciss $unit c 166 `unit2minor $unit`
2212 #-----------------------------------------------------------------------------
2214 agpgart)
2215 mknod agpgart "" c 148 0
2218 #-----------------------------------------------------------------------------
2220 twe*)
2221 unit=`expr $i : 'twe\(.*\)'`
2223 mknod twe $unit c 146 `unit2minor $unit`
2226 #-----------------------------------------------------------------------------
2228 tw*)
2229 unit=`expr $i : 'tw\(.*\)'`
2231 mknod tw $unit c 19 `unit2minor $unit` root:operator
2234 #-----------------------------------------------------------------------------
2236 nsmb*)
2237 unit=`expr $i : 'nsmb\(.*\)'`
2239 mknod nsmb $unit c 144 $unit
2242 #-----------------------------------------------------------------------------
2244 cmx*)
2245 unit=`expr $i : 'cmx\(.*\)'`
2247 mknod cmx $unit c 185 $unit
2250 #-----------------------------------------------------------------------------
2252 devctl)
2253 mknod devctl "" c 188 0 root:wheel 600
2256 #-----------------------------------------------------------------------------
2258 local)
2259 umask 0
2260 sh MAKEDEV.local
2261 umask 77
2264 #-----------------------------------------------------------------------------
2267 echo $i - no such device name
2270 esac
2271 done