]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/MAKEDEV
Spelling: aquire -> acquire.
[FreeBSD/FreeBSD.git] / etc / MAKEDEV
1 #!/bin/sh -
2 #
3 # Copyright (c) 1990 The Regents of the University of California.
4 # All rights reserved.
5 #
6 # Written and contributed by W. Jolitz 12/90
7 #
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.
21 #
22 #       @(#)MAKEDEV     5.2 (Berkeley) 6/22/90
23 # $FreeBSD$
24 #
25 # Device "make" file.  Valid arguments:
26 #       all     makes all known devices, standard number of units (or close)
27 #       std     standard devices
28 #       jail    suitable for a jail(8)
29 #       local   configuration specific devices
30 #       mach-4  mach4&lites+devices for Mach's XFree86 distribution
31 #       (see http://www.cs.hut.fi/lites.html for more info on LITES)
32 #
33 # Tapes:
34 #       wt*     QIC-interfaced (e.g. not SCSI) 3M cartridge tape
35 #       sa*     SCSI Sequential Access Devices
36 #
37 # Disks:
38 #       aac*    Adaptec FSA RAID controllers
39 #       aacd*   Adaptec FSA RAID
40 #       acd*    ATAPI CD-ROM disks
41 #       amrd*   AMI MegaRAID
42 #       cd*     SCSI CD-ROM disks
43 #       da*     SCSI Direct Access Devices
44 #       fd*     floppy disk drives (3 1/2", 5 1/4")
45 #       fla*    M-Systems DiskOnChip
46 #       idad*   Compaq Smart-2 RAID arrays
47 #       matcd*  Matsushita (Panasonic) CD-ROM disks
48 #       mcd*    Mitsumi CD-ROM disks
49 #       md*     Memory (or malloc) disk
50 #       mlx*    Mylex DAC960 RAID controllers
51 #       mlxd*   Mylex DAC960 RAID disk volumes
52 #       mly*    Mylex RAID controllers (newer models)
53 #       scd*    Sony CD-ROM disks
54 #       wd*     "Winchester" disk drives (ST506,IDE,ESDI,RLL,...)
55 #       wfd*    IDE floppy disk drives (LS-120)
56 #
57 # Console ports:
58 #       vty*    virtual console devices for syscons/pcvt/codrv
59 #
60 # Pointing devices:
61 #       mse*    Logitech and ATI Inport bus mouse
62 #       psm*    PS/2 mouse
63 #       jogdial Sony VAIO jog dial
64 #       sysmouse Mousesystems mouse emulator for syscons
65 #
66 # Time devices:
67 #       refclock-*  serial ports used by xntpd parse refclocks
68 #
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 #       ttyDXX  Digiboard Xi - 16 dialin ports (dgb)
75 #       cuaDXX  Digiboard Xi - 16 dialout ports (dgb)
76 #       ttyDX.X Digiboards (work in progress) - 16 dialin ports (digi)
77 #       cuaDX.X Digiboards (work in progress) - 16 dialout ports (digi)
78 #       ttyM*   Digiboard Xem - 16 dialin ports (dgm)
79 #       cuaM*   Digiboard Xem - 16 dialout ports (dgm)
80 #       ttyR*   Rocketport dialin ports
81 #       cuaR*   Rocketport dialout ports
82 #
83 # Pseudo terminals:
84 #       pty*    set of 32 master and slave pseudo terminals
85 #       vty*    virtual terminals using syscons/pcvt/codrv console
86 #
87 # Parallel port:
88 #       lpt*    Printer
89 #       ppi*    Parallel port i/o
90 #       pps*    Pulse per second timing interface
91 #       pcfclock*  Parallel time sync interface
92 #
93 # I2C and SMBus:
94 #       iic*    I2C devices
95 #       smb*    SMBUS devices
96 #
97 # USB devices:
98 #       usb*    USB bus control device
99 #       ugen*   generic USB device
100 #       uhid*   Human Interface Device (HID)
101 #       ulpt*   printer
102 #       umodem* modems
103 #       ums*    mouse
104 #       urio*   Diamond Rio 500
105 #       uscanner* USB scanners
106 #       usio*   USB serial devices
107 #
108 # SCSI devices (other than CD-ROM, tape and disk):
109 #       ch*     SCSI Media-Changer (juke box) driver
110 #       worm*   WORM driver
111 #       pt*     Processor Type (HP scanner, as one example)
112 #       pass*   CAM Passthrough device
113 #       ses*    SES (SCSI Environmental Services) and
114 #               SAF-TE (Scsi Accessable Fault-Tolerant Enclosures) device
115 #
116 # PC-CARD (previously called PCMCIA) support
117 #       card*   PC-CARD slots
118 #
119 # ISDN devices:
120 #       i4b     isdnd call control device
121 #       i4bctl  debugging control device
122 #       i4btrc* trace data interface(s), one per passive card
123 #       i4btel* telephony interface(s)
124 #       i4bteld* telephony dialout interface(s)
125 #       i4brbch* raw b channel access device(s)
126 #
127 # Special purpose devices:
128 #       acpi    Advanced Configuration and Power Interface
129 #       apm     Advanced Power Management BIOS
130 #       apmctl  APM BIOS control device
131 #       bpf*    packet filter
132 #       speaker pc speaker
133 #       tw*     xten power controller
134 #       snd*    various sound cards
135 #       pcaudio PCM audio driver
136 #       socksys iBCS2 socket system driver
137 #       vat     VAT compatibility audio driver (requires snd*)
138 #       gsc     Genius GS-4500 hand scanner
139 #       joy     pc joystick
140 #       tun*    Tunneling IP device
141 #       tap*    Ethernet Tunneling device
142 #       snp*    tty snoop devices
143 #       spigot  Video Spigot video acquisition card
144 #       ctx*    Cortex-I video acquisition card
145 #       meteor* Matrox Meteor video acquisition card (pci)
146 #       bktr*   Bt848 based video acquisition card (pci)
147 #       labpc*  National Instrument's Lab-PC and LAB-PC+
148 #       perfmon CPU performance-monitoring counters
149 #       pci     PCI configuration-space access from user mode
150 #       ipl     ipfilter control devices (ipl, ipnat, ipstate, ipauth)
151 #       kbd     keyboard devices
152 #       3dfx*   3dfx voodoo device for glide (tdfx) (/dev/3dfx,3dfxN,voodoo)
153 #       agpgart AGP interface
154 #
155
156 if [ -n "$MAKEDEVPATH" ]; then
157         PATH="$MAKEDEVPATH"
158 else
159         PATH=/sbin:/bin
160 fi
161 umask 77
162
163 # Usage: die exitcode msg
164 die() {
165         echo $2
166         exit $1
167 }
168
169 # Convert integer to partition name
170 dkitop() {
171         local p
172
173         case $1 in
174         0) p=a;; 1) p=b;; 2) p=c;; 3) p=d;; 4) p=e;; 5) p=f;; 6) p=g;; 7) p=h;;
175         *) p="?";;
176         esac
177         echo $p
178 }
179
180 # Convert integer to slice name
181 dkitos() {
182         local s
183
184         case $1 in
185         0) s="";;
186         1) s="";;
187         *) s=s$(($1-1));;
188         esac
189         echo $s
190 }
191
192 # Convert disk (type, unit, slice, partition) to minor number
193 dkminor()
194 {
195         echo $(($1 << 25 | ($2 / 32) << 21 | ($2 % 32) << 3 | $3 << 16 | $4))
196 }
197
198 # Override mknod(2) to add extra handling to it.
199 mknod=/sbin/mknod
200 for i in `IFS=':'; echo $PATH`; do
201         if [ -x "${i}/mknod" ]; then
202                 mknod="${i}/mknod"
203                 break
204         fi
205 done
206 mknod() {
207         rm -f "$1" || exit 1
208         case $# in
209         4) "$mknod" "$@" root:wheel || die 2 "$mknod $@ failed";;
210         5) "$mknod" "$@"            || die 2 "$mknod $@ failed";;
211         *) die 2 "bad node: mknod $@";;
212         esac
213 }
214
215 # Convert tape (ctrl, unit, mode, access) to minor number
216 saminor()
217 {
218         echo $(($1 << 29 | ($2 / 16) << 16 | ($2 % 16) << 4 | $3 << 2 | $4))
219 }
220
221 # Convert the last character of a tty name to a minor number.
222 ttyminor()
223 {
224         case $unit in
225         [0-9]) m=$unit;;
226         a) m=10;; b) m=11;; c) m=12;; d) m=13;; e) m=14;; f) m=15;; g) m=16;;
227         h) m=17;; i) m=18;; j) m=19;; k) m=20;; l) m=21;; m) m=22;; n) m=23;;
228         o) m=24;; p) m=25;; q) m=26;; r) m=27;; s) m=28;; t) m=29;; u) m=30;;
229         v) m=31;;
230         *) m="?";;
231         esac
232         echo $m
233 }
234
235 # Convert a unit number to a minor number.
236 unit2minor()
237 {
238   echo $(((($1 >> 8) << 16) | ($1 % 256)))
239 }
240
241 # Raw partition for disks
242 dkrawpart=2
243
244 # Compatibility slice for disks
245 dkcompatslice=0
246
247 # Raw slice for disks
248 dkrawslice=1
249
250 # Standard umasks
251 disk_umask=037                  # allow group operator to read disks
252 tape_umask=017                  # allow group operator to read/write tapes
253
254 for i in $*; do
255 case $i in
256
257 all)
258         sh $0 std                                       # standard
259         sh $0 fd0 fd1                                   # floppy disk
260         sh $0 da0 da1 da2 da3                           # SCSI disk
261         sh $0 ata                                       # ATA control
262         sh $0 ad0 ad1 ad2 ad3                           # ATA disk
263         sh $0 ar0 ar1                                   # ATA RAID disk
264         sh $0 acd0 acd0t afd0 ast0                      # ATAPI devices
265         sh $0 wd0 wd1 wd2 wd3                           # OLD disk
266         sh $0 wcd0 wfd0 wst0                            # OLD ATAPI devs
267         sh $0 cd0 matcd0 mcd0 scd0                      # cdrom
268         sh $0 sa0 wt0                                   # tape
269         sh $0 vty12                                     # virtual tty
270         sh $0 cuaa0 cuaa1 cuaa2 cuaa3                   # serial tty
271         sh $0 pty0                                      # pseudo tty
272         sh $0 ttyd0 ttyd1 ttyd2 ttyd3                   # serial tty
273         sh $0 kbd0 kbd1                                 # keyboard
274         sh $0 mse0 psm0 jogdial sysmouse                # mouse
275         sh $0 pcaudio speaker                           # noise
276         sh $0 lpt0 lpt1 lpt2                            # printer
277         sh $0 ppi0 ppi1 ppi2                            # parallel port
278         sh $0 iic0 iic1                                 # I2C device
279         sh $0 smb0 smb1                                 # SMBus device
280         sh $0 usb usb0 uhid0 ums0 ulpt0 ugen0           # USB devices
281         sh $0 urio0 uscanner0 umodem0                   # USB devices too
282         sh $0 bpf0 bpf1 bpf2 bpf3                       # network
283         sh $0 ipl tun0 tun1 tun2 tun3                   # network
284         sh $0 tap0 tap1 tap2 tap3                       # network
285         sh $0 ch0 perfmon tw0                           # miscellaneous
286         sh $0 acpi                                      # ACPI
287         sh $0 apm apmctl card0 card1 card2 card3        # laptop
288         sh $0 pass4 xpt2                                # CAM
289         sh $0 i4b i4bctl i4btrc0 i4btrc1                # ISDN
290         sh $0 i4btel0 i4btel1 i4bteld0 i4bteld1         # ISDN
291         sh $0 i4brbch0 i4brbch1                         # ISDN
292         sh $0 agpgart                                   # AGP
293         ;;
294
295 # a much restricted set of the above, to save precious i-nodes on the
296 # fixit floppy
297 fixit)
298         sh $0 std                                       # standard
299         sh $0 fd0                                       # floppy disk
300         sh $0 da0                                       # SCSI disk
301         sh $0 ad0                                       # ATA disk
302         sh $0 acd0 afd0 ast0                            # ATAPI devices
303         sh $0 wd0                                       # OLD disk
304         sh $0 wcd0 wfd0 wst0                            # OLD ATAPI devs
305         sh $0 cd0                                       # cdrom
306         sh $0 sa0                                       # tape
307         sh $0 vty2                                      # virtual tty
308         sh $0 cuaa0                                     # serial tty
309         sh $0 pty0                                      # pseudo tty
310         sh $0 ttyd0                                     # serial tty
311         sh $0 kbd0                                      # keyboard
312         sh $0 mse0 psm0 jogdial sysmouse                # mouse
313         sh $0 lpt0                                      # printer
314         sh $0 ppi0                                      # parallel port
315         sh $0 iic0                                      # I2C device
316         sh $0 smb0                                      # SMBus device
317         sh $0 ums0                                      # USB devices
318         sh $0 tun0                                      # network
319         sh $0 tap0                                      # network
320         sh $0 ch0                                       # miscellaneous
321         sh $0 acpi                                      # ACPI
322         sh $0 apm apmctl card0                          # laptop
323         sh $0 pass1 xpt1                                # CAM
324         sh $0 i4b i4bctl i4btrc0 i4btrc1                # ISDN
325         sh $0 i4btel0 i4bteld0                          # ISDN
326         sh $0 i4brbch0                                  # ISDN
327         rm -f fd/[1-9]?
328         ;;
329
330 std)
331         mknod console   c 0 0;                  chmod 600 console
332         mknod kmem      c 2 1 root:kmem;        chmod 640 kmem
333         mknod mem       c 2 0 root:kmem;        chmod 640 mem
334         mknod null      c 2 2;                  chmod 666 null
335         mknod random    c 2 3;                  chmod 666 random
336         ln -f random urandom
337         mknod zero      c 2 12;                 chmod 666 zero
338         mknod io        c 2 14;                 chmod 600 io
339         mknod tty       c 1 0;                  chmod 666 tty
340         mknod klog      c 7 0;                  chmod 600 klog
341         mknod pci       c 78 0;                 chmod 644 pci
342         mknod mdctl     c 95 0xffff00ff;        chmod 600 mdctl
343         mkdir -p fd
344         (cd fd && i=0 &&
345                 while [ $i -lt 64 ]; do
346                         mknod $i c 22 $i
347                         i=$(($i + 1))
348                 done
349         )
350         chmod 555 fd
351         chmod 666 fd/*
352         ln -sf fd/0 stdin
353         ln -sf fd/1 stdout
354         ln -sf fd/2 stderr
355         ;;
356
357 jail)
358         sh $0 std pty0
359         rm mem kmem pci io klog console         # for security
360         ln -sf null mem                 # for libkvm (ab)users
361         ln -sf null kmem                # --//--
362         ln -sf null console
363         ;;
364
365 mach-4)
366         mknod iopl c 22 0
367         mknod kbd c 23 0
368         mknod mouse c 24 0
369         mknod time c 25 0
370         mknod timezone c 26 0
371         ;;
372
373 # Create device files for new Archive/Wangtek QIC-02 tape driver (vak)
374 wt*)
375         umask $tape_umask
376         u=`expr $i : '..\(.*\)'`
377         if [ -z "${u}" ]; then u=0; fi
378         # default density, 512b blocks
379         mknod rwt${u}   c 10 `expr  0 + $u` root:operator
380         mknod nrwt${u}  c 10 `expr  4 + $u` root:operator
381         # default density, 1024b blocks
382 #       mknod rWt${u}   c 10 `expr 64 + $u` root:operator
383 #       mknod nrWt${u}  c 10 `expr 68 + $u` root:operator
384         mknod rwt${u}b  c 10 `expr 16 + $u` root:operator       # 60 megabytes
385         mknod nrwt${u}b c 10 `expr 20 + $u` root:operator
386         mknod rwt${u}c  c 10 `expr 24 + $u` root:operator       # 120 megabytes
387         mknod nrwt${u}c c 10 `expr 28 + $u` root:operator
388         mknod rwt${u}d  c 10 `expr 32 + $u` root:operator       # 150 megabytes
389         mknod nrwt${u}d c 10 `expr 36 + $u` root:operator
390 #       mknod rwt${u}e  c 10 `expr 40 + $u` root:operator       # 300 megabytes?
391 #       mknod nrwt${u}e c 10 `expr 44 + $u` root:operator
392 #       mknod rwt${u}f  c 10 `expr 48 + $u` root:operator       # 600 megabytes?
393 #       mknod nrwt${u}f c 10 `expr 52 + $u` root:operator
394         umask 77
395         ;;
396
397 # Individual slices.
398 aacd*s*|ad*s*|ar*s*|afd*s*|amrd*s*|da*s*|fla*s*|idad*s*|md*s*|mlxd*s*|twed*s*|wd*s*|wfd*s*)
399         umask $disk_umask
400         case $i in
401         aacd*s*) name=aacd; chr=151;;
402         ad*s*) name=ad; chr=116;;
403         ar*s*) name=ar; chr=157;;
404         afd*s*) name=afd; chr=118;;
405         amrd*s*) name=amrd; chr=133;;
406         da*s*) name=da;  chr=13;;
407         fla*s*) name=fla; chr=102;;
408         idad*s*) name=idad; chr=109;;
409         md*s*) name=md;  chr=95;;
410         mlxd*s*) name=mlxd; chr=131;;
411         twed*s*) name=twed; chr=147;;
412         wd*s*) name=wd;  chr=3;;
413         wfd*s*) name=wfd; chr=87;;
414         esac
415         case $i in
416         aacd*s*|amrd*s*|idad*s*|mlxd*s*|twed*s*)
417                 unit=`expr $i : '....\([0-9]*\)s'`
418                 slice=`expr $i : '....[0-9]*s\([0-9]*\)'`
419                 part=`expr $i : '....[0-9]*s[0-9]*\(.*\)'`
420                 ;;
421         afd*s*|fla*s*|wfd*s*)
422                 unit=`expr $i : '...\([0-9]*\)s'`
423                 slice=`expr $i : '...[0-9]*s\([0-9]*\)'`
424                 part=`expr $i : '...[0-9]*s[0-9]*\(.*\)'`
425                 ;;
426         *)
427                 unit=`expr $i : '..\([0-9]*\)s'`
428                 slice=`expr $i : '..[0-9]*s\([0-9]*\)'`
429                 part=`expr $i : '..[0-9]*s[0-9]*\(.*\)'`
430                 ;;
431         esac
432         case $unit in
433         [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
434                 case $slice in
435                 [0-9]|[1-2][0-9]|30)
436                         oldslice=$slice
437                         slice=$(($slice+1))
438                         slicename=`dkitos $slice`
439                         minor=`dkminor 0 $unit $slice $dkrawpart`
440                         mknod  $name$unit$slicename c $chr $minor root:operator
441                         ln -f $name$unit$slicename r$name$unit$slicename
442                         case $part in
443                         [a-h])
444                                 case $oldslice in
445                                 0) slice=$oldslice ;;
446                                 esac
447                                 for part in 0 1 2 3 4 5 6 7
448                                 do
449                                         minor=`dkminor 0 $unit $slice $part`
450                                         partname=`dkitop $part`
451                                         mknod  $name$unit$slicename$partname \
452                                               c $chr $minor root:operator
453                                         ln -f $name$unit$slicename$partname \
454                                              r$name$unit$slicename$partname
455                                 done
456                                 ;;
457                         "")
458                                 ;;
459                         *)
460                                 echo bad partition for disk in: $i
461                                 ;;
462                         esac
463                         ;;
464                 *)
465                         echo bad slice for disk in: $i
466                         ;;
467                 esac
468                 ;;
469         *)
470                 echo bad unit for disk in: $i "(unit=$unit, slice=$slice, part=$part)"
471                 ;;
472         esac
473         umask 77
474         ;;
475
476 fd*)
477         umask $disk_umask
478         unit=`expr $i : '..\(.*\)'`
479         name=fd; chr=9
480         case $unit in
481         0|1|2|3)
482                 mknod ${name}${unit}   c $chr `expr $unit '*' 64` root:operator
483                 ln -f ${name}${unit} r${name}${unit}
484                 # Fake BSD partitions
485                 for i in a b c d e f g h
486                 do
487                         ln -f ${name}${unit} ${name}${unit}$i
488                         ln -f r${name}${unit} r${name}${unit}$i
489                 done
490                 # User-readable and programmer-readable name sets
491
492                 mknod ${name}${unit}.1720  c $chr `expr $unit '*' 64 + 1` \
493                     root:operator
494                 ln -f ${name}${unit}.1720 r${name}${unit}.1720
495                 # ln -f ${name}${unit}.1720 ${name}${unit}135hs21
496                 # ln -f r${name}${unit}.1720 r${name}${unit}135hs21
497
498                 mknod ${name}${unit}.1480  c $chr `expr $unit '*' 64 + 2` \
499                     root:operator
500                 ln -f ${name}${unit}.1480 r${name}${unit}.1480
501                 # ln -f ${name}${unit}.1480 ${name}${unit}135hs18
502                 # ln -f r${name}${unit}.1480 r${name}${unit}135hs18
503                 # ln -f ${name}${unit}.1480 ${name}${unit}96hs18
504                 # ln -f r${name}${unit}.1480 r${name}${unit}96hs18
505
506                 mknod ${name}${unit}.1440  c $chr `expr $unit '*' 64 + 3` \
507                     root:operator
508                 ln -f ${name}${unit}.1440 r${name}${unit}.1440
509                 # ln -f ${name}${unit}.1440 ${name}${unit}135
510                 # ln -f r${name}${unit}.1440 r${name}${unit}135
511                 # ln -f ${name}${unit}.1440 ${name}${unit}135ds18
512                 # ln -f r${name}${unit}.1440 r${name}${unit}135ds18
513                 # ln -f ${name}${unit}.1440 ${name}${unit}96ds18
514                 # ln -f r${name}${unit}.1440 r${name}${unit}96ds18
515
516                 mknod ${name}${unit}.1200  c $chr `expr $unit '*' 64 + 4` \
517                     root:operator
518                 ln -f ${name}${unit}.1200 r${name}${unit}.1200
519                 # ln -f ${name}${unit}.1200 ${name}${unit}96
520                 # ln -f r${name}${unit}.1200 r${name}${unit}96
521                 # ln -f ${name}${unit}.1200 ${name}${unit}96ds15
522                 # ln -f r${name}${unit}.1200 r${name}${unit}96ds15
523                 # ln -f ${name}${unit}.1200 ${name}${unit}135ds15
524                 # ln -f r${name}${unit}.1200 r${name}${unit}135ds15
525
526                 mknod ${name}${unit}.820  c $chr `expr $unit '*' 64 + 5` \
527                     root:operator
528                 ln -f ${name}${unit}.820 r${name}${unit}.820
529                 # ln -f ${name}${unit}.820 ${name}${unit}96hs10
530                 # ln -f r${name}${unit}.820 r${name}${unit}96hs10
531                 # ln -f ${name}${unit}.820 ${name}${unit}135hs10
532                 # ln -f r${name}${unit}.820 r${name}${unit}135hs10
533
534                 mknod ${name}${unit}.800  c $chr `expr $unit '*' 64 + 6` \
535                     root:operator
536                 ln -f ${name}${unit}.800 r${name}${unit}.800
537                 # ln -f ${name}${unit}.800 ${name}${unit}96ds10
538                 # ln -f r${name}${unit}.800 r${name}${unit}96ds10
539                 # ln -f ${name}${unit}.800 ${name}${unit}135ds10
540                 # ln -f r${name}${unit}.800 r${name}${unit}135ds10
541
542                 mknod ${name}${unit}.720  c $chr `expr $unit '*' 64 + 7` \
543                     root:operator
544                 ln -f ${name}${unit}.720 r${name}${unit}.720
545                 # ln -f ${name}${unit}.720 ${name}${unit}96ds9
546                 # ln -f r${name}${unit}.720 r${name}${unit}96ds9
547                 # ln -f ${name}${unit}.720 ${name}${unit}135ds9
548                 # ln -f r${name}${unit}.720 r${name}${unit}135ds9
549
550                 mknod ${name}${unit}.360  c $chr `expr $unit '*' 64 + 8` \
551                     root:operator
552                 ln -f ${name}${unit}.360 r${name}${unit}.360
553                 # ln -f ${name}${unit}.360 ${name}${unit}48
554                 # ln -f r${name}${unit}.360 r${name}${unit}48
555                 # ln -f ${name}${unit}.360 ${name}${unit}48ds9
556                 # ln -f r${name}${unit}.360 r${name}${unit}48ds9
557
558                 mknod ${name}${unit}.640  c $chr `expr $unit '*' 64 + 9` \
559                     root:operator
560                 ln -f ${name}${unit}.640 r${name}${unit}.640
561                 # ln -f ${name}${unit}.640 ${name}${unit}96ds8
562                 # ln -f r${name}${unit}.640 r${name}${unit}96ds8
563                 # ln -f ${name}${unit}.640 ${name}${unit}135ds8
564                 # ln -f r${name}${unit}.640 r${name}${unit}135ds8
565
566                 mknod ${name}${unit}.1232  c $chr `expr $unit '*' 64 + 10` \
567                     root:operator
568                 ln -f ${name}${unit}.1232 r${name}${unit}.1232
569                 # ln -f ${name}${unit}.1232 ${name}${unit}96ds8
570                 # ln -f r${name}${unit}.1232 r${name}${unit}96ds8
571                 # ln -f ${name}${unit}.1232 ${name}${unit}135ds8
572                 # ln -f r${name}${unit}.1232 r${name}${unit}135ds8
573                 ;;
574         *)
575                 echo bad unit for disk in: $i
576                 ;;
577         esac
578         umask 77
579         ;;
580
581 ata)
582         umask 177
583         mknod ata c 159 0 root:operator
584         umask 77
585         ;;
586         
587
588 aacd*|ad*|ar*|afd*|amrd*|da*|fla*|idad*|md*|mlxd*|twed*|wd*|wfd*)
589         umask $disk_umask
590         case $i in
591         aacd*) name=aacd; chr=151;;
592         ad*) name=ad; chr=116;;
593         ar*) name=ar; chr=157;;
594         afd*) name=afd; chr=118;;
595         amrd*) name=amrd; chr=133;;
596         da*) name=da;  chr=13;;
597         fla*) name=fla; chr=102;;
598         idad*) name=idad; chr=109;;
599         md*) name=md; chr=95;;
600         mlxd*) name=mlxd; chr=131;;
601         twed*) name=twed; chr=147;;
602         wd*) name=wd;  chr=3;;
603         wfd*) name=wfd; chr=87;;
604         esac
605         case $i in
606         aacd*|amrd*|idad*|mlxd*|twed*)
607                 unit=`expr $i : '....\(.*\)'`
608                 ;;
609         afd*|fla*|wfd*)
610                 unit=`expr $i : '...\(.*\)'`
611                 ;;
612         *)
613                 unit=`expr $i : '..\(.*\)'`
614                 ;;
615         esac
616         case $unit in
617         [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
618                 for slicepartname in s0h s1 s2 s3 s4
619                 do
620                         sh $0 $name$unit$slicepartname
621                 done
622                 ;;
623         *)
624                 echo bad unit for disk in: $i
625                 ;;
626         esac
627         umask 77
628         ;;
629
630 ccd*)
631         umask $disk_umask
632         name=ccd
633         chr=74
634         unit=`expr $i : '...\(.*\)'`
635         case $unit in
636         [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
637                 for part in 0 1 2 3 4 5 6 7
638                 do
639                         minor=`dkminor 0 $unit 0 $part`
640                         partname=`dkitop $part`
641                         mknod  $name$unit$partname c $chr $minor root:operator
642                         ln -f $name$unit$partname r$name$unit$partname
643                 done
644                 ;;
645         *)
646                 echo bad unit for disk in: $i
647                 ;;
648         esac
649         umask 77
650         ;;
651
652 # SCSI processor type driver
653 pt[0-9]*)
654         chr=61
655         name=pt
656         unit=`expr $i : 'pt\([0-9][0-9]*\)'`
657         if [ -z "${unit}" ]; then
658                 unit=0
659         fi
660         unit=`expr $unit + 1 - 1`
661         mknod ${name}${unit} c $chr `unit2minor $unit`
662         ;;
663
664 # SCSI SES/SAF-TE type driver
665 ses[0-9]*)
666         chr=110
667         name=ses
668         unit=`expr $i : 'ses\([0-9][0-9]*\)'`
669         if [ -z "${unit}" ]; then
670                 unit=0
671         fi
672         unit=`expr $unit + 1 - 1`
673         mknod ${name}${unit} c $chr `unit2minor $unit`
674         ;;
675 # SCSI target mode sample driver
676 targ[0-9]*)
677         chr=65
678         name=targ
679         unit=`expr $i : 'targ\([0-9][0-9]*\)'`
680         if [ -z "${unit}" ]; then
681                 unit=0
682         fi
683         unit=`expr $unit + 1 - 1`
684         mknod ${name}${unit} c $chr `unit2minor $unit`
685         mknod ${name}.ctl c $chr 0xffff00ff
686         ;;
687
688 # CAM transport layer device
689 xpt*)
690         # This major number is temporary
691         chr=104
692         name=xpt
693         units=`expr $i : 'xpt\(.*\)'`
694         if [ -z "${units}" ]; then
695                 units=1
696         fi
697         i=0
698         while [ $i -lt $units ]; do
699                 dname=$name$i
700                 rm -rf $dname r$dname
701                 mknod $dname c $chr `unit2minor $i` root:operator
702                 i=$(($i + 1))
703         done    
704         ;;
705
706 # CAM passthrough device
707 pass*)
708         # This major number is temporary
709         chr=31
710         name=pass
711         units=`expr $i : 'pass\(.*\)'`
712         if [ -z "${units}" ]; then
713                 units=1
714         fi
715         i=0
716         while [ $i -lt $units ]; do
717                 dname=$name$i
718                 rm -rf $dname r$dname
719                 mknod $dname c $chr `unit2minor $i` root:operator
720                 i=$(($i + 1))
721         done    
722         ;;
723 pty*)
724         class=`expr $i : 'pty\(.*\)'`
725         case $class in
726         0) offset=0 name=p;;
727         1) offset=32 name=q;;
728         2) offset=64 name=r;;
729         3) offset=96 name=s;;
730 # Note that xterm (at least) only look at p-s.
731         4) offset=128 name=P;;
732         5) offset=160 name=Q;;
733         6) offset=192 name=R;;
734         7) offset=224 name=S;;
735         # This still leaves [tuTU].
736         *) echo bad unit for pty in: $i;;
737         esac
738         umask 0
739         case $class in
740         0|1|2|3|4|5|6|7)
741                 i=0
742                 while [ $i -lt 32 ]; do
743 #                       This was an awk substr() before.
744                         c=$(echo 0123456789abcdefghijklmnopqrstuv |
745                             dd bs=1 skip=$i count=1 2>/dev/null)
746                         mknod tty$name$c c 5 $(($offset + $i))
747                         mknod pty$name$c c 6 $(($offset + $i))
748                         i=$(($i + 1))
749                 done
750                 ;;
751         esac
752         umask 77
753         ;;
754
755 sa*)
756         umask $tape_umask
757         unit=`expr $i : '..\(.*\)'`
758         chr=14
759
760         case $unit in
761         [0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9])
762                 mknod sa${unit}.ctl c $chr `saminor 1 ${unit} 0 0`
763                 ln -f sa${unit}.ctl rsa${unit}.ctl
764                 for m in 0 1 2 3
765                 do
766                         mknod sa${unit}.${m} c $chr \
767                             `saminor 0 ${unit} ${m} 0`  root:operator
768                         ln -f sa${unit}.${m} rsa${unit}.${m}
769                         mknod nsa${unit}.${m} c $chr \
770                             `saminor 0 ${unit} ${m} 1` root:operator
771                         ln -f nsa${unit}.${m} nrsa${unit}.${m}
772                         mknod esa${unit}.${m} c $chr \
773                             `saminor 0 ${unit} ${m} 2` root:operator
774                         ln -f esa${unit}.${m} ersa${unit}.${m}
775                 done
776                 ln -f sa${unit}.0 sa${unit}
777                 ln -f sa${unit}.0 rsa${unit}.0
778                 ln -f sa${unit}.0 rsa${unit}
779                 ln -f nsa${unit}.0 nsa${unit}
780                 ln -f nsa${unit}.0 nrsa${unit}.0
781                 ln -f nsa${unit}.0 nrsa${unit}
782                 ln -f esa${unit}.0 esa${unit}
783                 ln -f esa${unit}.0 ersa${unit}.0
784                 ln -f esa${unit}.0 ersa${unit}
785                 ;;
786         *)
787                 echo bad unit for tape in: $i
788                 ;;
789         esac
790         umask 77
791         ;;
792
793 ch*)
794         umask 37
795         unit=`expr $i : '..\(.*\)'`
796         case $i in
797         ch*) name=ch;  chr=17;;
798         esac
799         case $unit in
800         0|1|2|3|4|5|6)
801                 mknod ${name}${unit}    c $chr $unit root:operator
802                 ;;
803         *)
804                 echo bad unit for media changer in: $i
805                 ;;
806         esac
807         umask 77
808         ;;
809
810 ast*)
811         umask 2 ;
812         unit=`expr $i : '...\(.*\)'`
813         chr=119
814         case $unit in
815         0|1|2|3)
816                 mknod rast${unit} c $chr `expr $unit '*' 8 + 0` root:operator
817                 chmod 640 rast${unit}
818                 mknod nrast${unit} c $chr `expr $unit '*' 8 + 1` root:operator
819                 chmod 640 nrast${unit}
820                 ;;
821         *)
822                 echo bad unit for tape in: $i
823                 ;;
824         esac
825         umask 77
826         ;;
827
828 acd*t*)
829         umask $disk_umask
830         units=`expr $i : '...\(.*\)t'`;
831         tracks=`expr $i : '.*t\(.*\)'`;
832         name=acd;
833         chr=117;
834         if [ -z "${units}" -o "${units}" -le 0 ]; then
835                 units=1
836         fi
837         if [ -z "${tracks}" -o "${tracks}" -le 0 ]; then
838                 tracks=100
839         fi
840         if [ "${units}" -le 31 -a "${tracks}" -le 169 ]; then
841                 i=0
842                 while [ $i -le $units ]; do
843                         dname=$name$i
844                         rm -rf ${dname}t*
845                         j=1
846                         while [ $j -le ${tracks} ]; do
847                                 mknod ${dname}t$j c $chr \
848                                         $((($i * 8) + (65536 * $j))) \
849                                         root:operator
850                                 j=$(($j + 1))
851                         done
852                         i=$(($i + 1))
853                 done
854         else
855                 echo "$i is invalid -- can't have more than 32 cd devices or 169 tracks"
856         fi
857         umask 77
858         ;;
859
860 acd*|cd*|mcd*|scd*)
861         umask $disk_umask
862         case $i in
863         acd*) units=`expr $i : '...\(.*\)'`; name=acd; chr=117;;
864         cd*) units=`expr $i : '..\(.*\)'`; name=cd; chr=15;;
865         mcd*) units=`expr $i : '...\(.*\)'`; name=mcd; chr=29;;
866         scd*) units=`expr $i : '...\(.*\)'`; name=scd; chr=45;;
867         esac
868         if [ -z "${units}" -o "${units}" -le 0 ]; then
869                 units=1
870         fi
871         if [ "${units}" -le 31 ]; then
872                 i=0
873                 while [ $i -le $units ]; do
874                         dname=$name$i
875                         rm -rf ${dname}[!t]* r${dname}*
876                         mknod ${dname}a c $chr $(($i * 8)) root:operator
877                         mknod ${dname}c c $chr $(($i * 8 + 2)) root:operator
878                         ln -f ${dname}a r${dname}a
879                         ln -f ${dname}c r${dname}c
880                         i=$(($i + 1))
881                 done
882         else
883                 echo "$i is invalid -- can't have more than 32 cd devices"
884         fi
885         umask 77
886         ;;
887
888 matcd*)
889         umask 2
890         case $i in
891         matcd*) unit=`expr $i : '.....\(.*\)'`; name=matcd; chr=46;;
892         esac
893         case $unit in
894         0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15)
895                 mknod ${name}${unit}a   c $chr `expr $unit '*' 8 + 0` \
896                     root:operator
897                 mknod ${name}${unit}c   c $chr `expr $unit '*' 8 + 2` \
898                     root:operator
899                 ln -f ${name}${unit}a r${name}${unit}a
900                 ln -f ${name}${unit}c r${name}${unit}c
901                 chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
902
903                 mknod ${name}${unit}la  c $chr `expr $unit '*' 8 + 128` \
904                     root:operator
905                 mknod ${name}${unit}lc  c $chr `expr $unit '*' 8 + 130` \
906                     root:operator
907                 ln -f ${name}${unit}la r${name}${unit}la
908                 ln -f ${name}${unit}lc r${name}${unit}lc
909                 chmod 640 ${name}${unit}l[a-h] r${name}${unit}l[a-h]
910                 ;;
911         *)
912                 echo bad unit for disk in: $i
913                 ;;
914         esac
915         umask 77
916         ;;
917
918 wcd*)
919         umask 2 ;
920         unit=`expr $i : '...\(.*\)'`
921         chr=69
922         case $unit in
923         0|1|2|3|4|5|6|7)
924                 mknod wcd${unit}a  c $chr `expr $unit '*' 8 + 0` root:operator
925                 mknod wcd${unit}c  c $chr `expr $unit '*' 8 + 2` root:operator
926                 ln -f wcd${unit}a rwcd${unit}a
927                 ln -f wcd${unit}c rwcd${unit}c
928                 chmod 640 wcd${unit}[a-h] rwcd${unit}[a-h]
929                 ;;
930         *)
931                 echo bad unit for disk in: $i
932                 ;;
933         esac
934         umask 77
935         ;;
936
937 wst*)
938         umask 2 ;
939         unit=`expr $i : '...\(.*\)'`
940         chr=90
941         case $unit in
942         0|1|2|3)
943                 mknod rwst${unit} c $chr `expr $unit '*' 8 + 0` root:operator
944                 chmod 640 rwst${unit}
945                 ;;
946         esac
947         umask 77
948         ;;
949
950 iic*)
951         unit=`expr $i : 'iic\(.*\)'`
952         mknod iic$unit c 105 `unit2minor $unit`
953         ;;
954
955 smb*)
956         unit=`expr $i : 'smb\(.*\)'`
957         mknod smb$unit c 106 `unit2minor $unit`
958         ;;
959
960 pcfclock*)
961         unit=`expr $i : 'pcfclock\(.*\)'`
962         mknod pcfclock$unit c 140 `unit2minor $unit`
963         ;;
964
965 ppi*)
966         unit=`expr $i : 'ppi\(.*\)'`
967         mknod ppi$unit c 82 `unit2minor $unit`
968         ;;
969
970 pps*)
971         unit=`expr $i : 'pps\(.*\)'`
972         mknod pps$unit c 89 `unit2minor $unit`
973         ;;
974
975 usb)
976         mknod usb$unit c 108 255 root:operator
977         chmod 0660 usb$unit
978         ;;
979
980 usb*)
981         umask 7
982         unit=`expr $i : 'usb\(.*\)'`
983         mknod usb$unit c 108 `unit2minor $unit` root:operator
984         umask 77
985         ;;
986
987 uhid*)
988         umask 7
989         unit=`expr $i : 'uhid\(.*\)'`
990         mknod uhid$unit c 122 `unit2minor $unit` root:operator
991         umask 77
992         ;;
993
994 ums*)
995         umask 7
996         unit=`expr $i : 'ums\(.*\)'`
997         mknod ums$unit c 111 `unit2minor $unit` root:operator
998         umask 77
999         ;;
1000
1001 ulpt*)
1002         unit=`expr $i : 'ulpt\(.*\)'`
1003         minor=`unit2minor $unit`
1004         mknod ulpt$unit c 113 $minor
1005         minor=`unit2minor \`expr $unit + 64\``
1006         mknod unlpt$unit c 113 $minor           # and the 'no prime' version
1007         ;;
1008
1009 ugen*)
1010         umask 7
1011         unit=`expr $i : 'ugen\([0-9][0-9]*\)'`
1012         endpoint=`expr $i : 'ugen.*\.\([0-9][0-9]*\)'`
1013         if [ -z "${unit}" ]; then
1014                 echo $i - Invalid unit number
1015         fi
1016         if [ -z "${endpoint}" ]; then           # ugen0 & ugen0.1 - ugen0.15
1017                 mknod ugen$unit c 114 \
1018                                 `unit2minor $(($unit * 16))` root:operator
1019                 i=1
1020                 while [ $i -lt 16 ]; do
1021                         mknod ugen$unit.$i c 114 \
1022                                 `unit2minor $(($unit * 16 + $i))` root:operator
1023                         i=$(($i + 1))
1024                 done
1025         else
1026                 minor=`unit2minor $(($unit * 16 + $endpoint))`
1027                 mknod ugen$unit.$endpoint c 114 $minor root:operator
1028         fi
1029         umask 77
1030         ;;
1031
1032 urio*)
1033         umask 7
1034         unit=`expr $i : 'urio\(.*\)'`
1035         mknod urio$unit c 143 `unit2minor $unit` root:operator
1036         umask 77
1037         ;;
1038
1039 usio*)
1040         umask 7
1041         unit=`expr $i : 'usio\(.*\)'`
1042         minor=`unit2minor $(($unit + 128))`
1043         mknod usio$unit c 138 $minor uucp:dialer
1044         umask 77
1045         ;;
1046
1047 uscanner*)
1048         umask 7
1049         unit=`expr $i : 'uscanner\(.*\)'`
1050         mknod uscanner$unit c 156 `unit2minor $unit` root:operator
1051         umask 77
1052         ;;
1053
1054 umodem*)
1055         umask 7
1056         unit=`expr $i : 'umodem\(.*\)'`
1057         mknod umodem$unit c 124 `unit2minor $unit` uucp:dialer
1058         umask 77
1059         ;;
1060
1061 lpt*)
1062         unit=`expr $i : 'lpt\(.*\)'`
1063         mknod lpt$unit c 16 `unit2minor $unit`
1064         mknod lpctl$unit c 16 `unit2minor \`expr $unit + 128\``
1065         ;;
1066
1067 # Use this to create virtual consoles for syscons, pcvt or codrv
1068 # ttyv0-b
1069 # use as MAKEDEV vtyNN to create NN entries
1070 vty*)
1071         chr=12
1072         units=`expr $i : 'vty\(.*\)'`
1073         i=0
1074         while [ $i -lt $units ]; do
1075                 mknod ttyv$(printf %01x $i) c $chr `unit2minor $i`
1076                 i=$(($i + 1))
1077         done
1078         ln -fs ttyv0 vga        # XXX X still needs this pccons relic
1079         ;;
1080
1081 nmdm*)
1082         units=`expr $i : 'nmdm\(.*\)'`
1083         chr=18
1084         i=0
1085         while [ $i -lt $units ]; do
1086                 minor=`unit2minor $i`
1087                 minor=$(($minor + $minor))
1088                 mknod nmdm${i}A c $chr $minor
1089                 mknod nmdm${i}B c $chr $(($minor + 1))
1090                 i=$(($i + 1))
1091         done
1092         ;;
1093
1094 bpf*)
1095         nbpf=`expr $i : 'bpf\(.*\)$'`
1096         unit=0
1097         while [ $unit -le $nbpf ]; do
1098                 mknod bpf$unit c 23 `unit2minor $unit`
1099                 unit=$(($unit + 1))
1100         done
1101         ;;
1102
1103 speaker)
1104         mknod speaker c 26 0
1105         ;;
1106
1107 cuaa?|cua?)
1108         umask 7
1109         unit=`expr $i : 'cua.*\(.\)$'`
1110         m=`ttyminor $unit`
1111         mknod cuaa$unit c 28 `expr $m + 128` uucp:dialer
1112         mknod cuaia$unit c 28 `expr $m + 32 + 128` uucp:dialer
1113         mknod cuala$unit c 28 `expr $m + 64 + 128` uucp:dialer
1114         umask 77
1115         ;;
1116
1117 tty0?|ttyd?|tty?)
1118         unit=`expr $i : 'tty.*\(.\)$'`
1119         m=`ttyminor $unit`
1120         mknod ttyd$unit c 28 $m
1121         mknod ttyid$unit c 28 `expr $m + 32`
1122         mknod ttyld$unit c 28 `expr $m + 64`
1123         ;;
1124
1125 cuac?)
1126         umask 7
1127         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1128                   g h i j k l m n o p q r s t u v"
1129         major=48
1130         card=`expr $i : 'cua.*\(.\)$'`
1131         for unit in $portlist
1132         do
1133                 minor=`ttyminor $unit`
1134                 minor=`expr $card \* 65536 + $minor`
1135                 name=$card$unit
1136                 mknod cuac$name c $major `expr $minor + 128` uucp:dialer
1137                 mknod cuaic$name c $major `expr $minor + 32 + 128` uucp:dialer
1138                 mknod cualc$name c $major `expr $minor + 64 + 128` uucp:dialer
1139         done
1140         umask 77
1141         ;;
1142
1143 ttyc?)
1144         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1145                   g h i j k l m n o p q r s t u v"
1146         major=48
1147         card=`expr $i : 'tty.*\(.\)$'`
1148         for unit in $portlist
1149         do
1150                 minor=`ttyminor $unit`
1151                 minor=`expr $card \* 65536 + $minor`
1152                 name=$card$unit
1153                 mknod ttyc$name c $major $minor
1154                 mknod ttyic$name c $major `expr $minor + 32`
1155                 mknod ttylc$name c $major `expr $minor + 64`
1156         done
1157         ;;
1158
1159 # RISCom8 'rc' driver entries
1160
1161 cuam?)
1162         umask 7
1163         unit=`expr $i : 'cua.*\(.\)$'`
1164         m=`ttyminor $unit`
1165         mknod cuam$unit c 63 `expr $m + 128` uucp:dialer
1166         umask 77
1167         ;;
1168
1169 ttym?)
1170         unit=`expr $i : 'tty.*\(.\)$'`
1171         m=`ttyminor $unit`
1172         mknod ttym$unit c 63 $m
1173         ;;
1174
1175 # Specialix SI/XIO.
1176 # Note: these are 'base 1' to match the numbers on the panels, and to match
1177 #       the manual that comes with the system.
1178 ttyA*)
1179         major=68
1180         nports=`expr $i : 'ttyA\(.*\)$'`
1181         port=1
1182         while [ $port -le $nports ]; do
1183                 minor=$(expr $port - 1)
1184                 name=$(printf %02d $port)
1185                 mknod ttyA$name c $major $minor
1186                 mknod ttyiA$name c $major `expr $minor + 65536`
1187                 mknod ttylA$name c $major `expr $minor + 131072`
1188                 port=$(($port + 1))
1189         done
1190         # For the user-mode control program, 'sicontrol'
1191         mknod si_control c 68 262144
1192         ;;
1193
1194 cuaA*)
1195         umask 7
1196         major=68
1197         nports=`expr $i : 'cuaA\(.*\)$'`
1198         port=1
1199         while [ $port -le $nports ]; do
1200                 minor=$(expr $port - 1)
1201                 name=$(printf %02d $port)
1202                 mknod cuaA$name c $major `expr $minor + 128` uucp:dialer
1203                 mknod cuaiA$name c $major `expr $minor + 128 + 65536` \
1204                     uucp:dialer
1205                 mknod cualA$name c $major `expr $minor + 128 + 131072` \
1206                     uucp:dialer
1207                 port=$(($port + 1))
1208         done
1209         umask 77
1210         ;;
1211
1212 # Digiboard PC/?? 16 port card.
1213 # The current scheme of minor numbering is:
1214 #
1215 #       unused{14} CARD{2} major{8} CALLOUT{1} LOCK{1} INIT{1} PORT{5}
1216 #
1217 #   CARD bitfield in future versions may be extended to 3 bits.
1218 #
1219 # See dgb(4)
1220 #
1221 ttyD?)
1222         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1223         major=58
1224         card=`expr $i : 'tty.*\(.\)$'`
1225         for unit in $portlist
1226         do
1227                 minor=`ttyminor $unit`
1228                 minor=`expr $card \* 65536 + $minor`
1229                 name=$card$unit
1230                 mknod ttyD$name c $major $minor
1231                 mknod ttyiD$name c $major `expr $minor + 32`
1232                 mknod ttylD$name c $major `expr $minor + 64`
1233         done
1234
1235         # Also create devices for the digi driver
1236         umask 7
1237         major=162
1238         card=`expr $i : 'tty.*\(.\)$'`
1239         rm -f digi$card.ctl
1240         mknod digi$card.ctl c $major $(($card \* 65536 + 8388608)) uucp:dialer
1241         unit=0
1242         while [ $unit -lt 16 ]
1243         do
1244                 base=`expr $card \* 65536 + $unit`
1245                 name=$card.$unit
1246                 rm -f tty*D$name
1247                 mknod ttyD$name c $major $base
1248                 mknod ttyiD$name c $major $(($base + 1048576))
1249                 mknod ttylD$name c $major $(($base + 2097152))
1250                 unit=$(($unit + 1))
1251         done
1252         umask 77
1253         ;;
1254
1255 cuaD?)
1256         umask 7
1257         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1258         major=58
1259         card=`expr $i : 'cua.*\(.\)$'`
1260         for unit in $portlist
1261         do
1262                 minor=`ttyminor $unit`
1263                 minor=`expr $card \* 65536 + $minor`
1264                 name=$card$unit
1265                 mknod cuaD$name c $major `expr $minor + 128` uucp:dialer
1266                 mknod cuaiD$name c $major `expr $minor + 32 + 128` uucp:dialer
1267                 mknod cualD$name c $major `expr $minor + 64 + 128` uucp:dialer
1268         done
1269
1270         # Also create devices for the digi driver
1271         major=162
1272         card=`expr $i : 'cua.*\(.\)$'`
1273         rm -f digi$card.ctl
1274         mknod digi$card.ctl c $major $(($card \* 65536 + 8388608)) uucp:dialer
1275         unit=0
1276         while [ $unit -lt 16 ]
1277         do
1278                 base=`expr $card \* 65536 + $unit`
1279                 name=$card.$unit
1280                 rm -f cua*D$name
1281                 mknod cuaD$name c $major $(($base + 4194304)) uucp:dialer
1282                 mknod cuaiD$name c $major $(($base + 5242880)) uucp:dialer
1283                 mknod cualD$name c $major $(($base + 6291456)) uucp:dialer
1284                 unit=$(($unit + 1))
1285         done
1286         umask 77
1287         ;;
1288
1289 # Digiboard Xem - superceeded by the digi device above
1290 #
1291 ttyM*)
1292         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1293         modulelist="a b c d"
1294         major=101
1295         card=`expr $i : 'tty.*\(.\)$'`
1296         for unit in $modulelist
1297         do
1298                 moduleminor=`ttyminor $unit`
1299                 moduleminor=`expr $moduleminor % 10 \* 16`
1300                 modulename=$unit
1301
1302                 for unit in $portlist
1303                 do
1304                         minor=`ttyminor $unit`
1305                         minor=`expr $card \* 65536 + $minor + $moduleminor`
1306                         name=$card$modulename$unit
1307                         rm -f tty*M$name
1308                         mknod ttyM$name c $major $minor
1309                         mknod ttyiM$name c $major `expr $minor + 64`
1310                         mknod ttylM$name c $major `expr $minor + 128`
1311                 done
1312         done
1313         ;;
1314
1315 cuaM?)
1316         umask 7
1317         portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1318         modulelist="a b c d"
1319         major=101
1320         card=`expr $i : 'cua.*\(.\)$'`
1321         for unit in $modulelist
1322         do
1323                 moduleminor=`ttyminor $unit`
1324                 moduleminor=`expr $moduleminor % 10 \* 16`
1325                 modulename=$unit
1326
1327                 for unit in $portlist
1328                 do
1329                         minor=`ttyminor $unit`
1330                         minor=`expr $card \* 65536 + $minor + $moduleminor`
1331                         name=$card$modulename$unit
1332                         rm -f cua*M$name
1333                         mknod cuaM$name c $major `expr $minor + 262144` \
1334                             uucp:dialer
1335                         mknod cuaiM$name c $major `expr $minor + 64 + 262144` \
1336                             uucp:dialer
1337                         mknod cualM$name c $major `expr $minor + 128 + 262144` \
1338                             uucp:dialer
1339                 done
1340         done
1341         umask 77
1342         ;;
1343
1344 ttyR?)
1345         major=81
1346         BOARD=1; Rnum=0
1347         MINOR=$(($BOARD * 65536))
1348         controllers=$(
1349                 dmesg | while read first rest; do
1350                         case "$first" in
1351                         RocketPort[0-4])
1352                                 echo "$first"
1353                                 ;;
1354                         esac
1355                 done
1356         )
1357         rm -f ttyR* ttyiR* ttylR*
1358         for i in $controllers; do
1359            ndevices=$(
1360                 dmesg | while read first bar ports rest; do
1361                         case "$first" in
1362                         $i*)
1363                                 echo "$ports"
1364                                 ;;
1365                         esac
1366                 done
1367            )
1368            echo -n "Creating $ndevices devices for $i: "
1369            dev=0
1370            while [ $dev -lt $ndevices ]; do
1371                    mknod ttyR$Rnum c $major $MINOR
1372                    mknod ttyiR$Rnum c $major $(($MINOR + 32))
1373                    mknod ttylR$Rnum c $major $(($MINOR + 64))
1374                    Rnum=$(($Rnum + 1))
1375                    MINOR=$(($MINOR + 1))
1376                    dev=$(($dev + 1))
1377            done
1378                 BOARD=$(($BOARD + 1))
1379                 MINOR=$(($BOARD * 65536))
1380            echo " "
1381         done
1382         ;;
1383
1384 cuaR?)
1385         major=81
1386         BOARD=1; Rnum=0
1387         MINOR=$(($BOARD * 65536))
1388         controllers=$(
1389                 dmesg | while read first rest; do
1390                         case "$first" in
1391                         RocketPort[0-4])
1392                                 echo "$first"
1393                                 ;;
1394                         esac
1395                 done
1396         )
1397         rm -f cuaR* cuaiR* cualR*
1398         for i in $controllers; do
1399            ndevices=$(
1400                 dmesg | while read first bar ports rest; do
1401                         case "$first" in
1402                         $i*)
1403                                 echo "$ports"
1404                                 ;;
1405                         esac
1406                 done
1407            )
1408            echo -n "Creating $ndevices devices for $i: "
1409            dev=0
1410            while [ $dev -lt $ndevices ]; do
1411                    mknod cuaR$Rnum c  $major $(($MINOR + 128)) uucp:dialer
1412                    mknod cuaiR$Rnum c $major $(($MINOR + 128 + 32)) \
1413                        uucp:dialer
1414                    mknod cualR$Rnum c $major $(($MINOR + 128 + 64)) \
1415                        uucp:dialer
1416                    Rnum=$(($Rnum + 1))
1417                    MINOR=$(($MINOR + 1))
1418                    dev=$(($dev + 1))
1419            done
1420                 BOARD=$(($BOARD + 1))
1421                 MINOR=$(($BOARD * 65536))
1422            echo " "
1423         done
1424         ;;
1425
1426 mse*)
1427         unit=`expr $i : 'mse\(.*\)'`
1428         chr=27
1429         # non-blocking for X11
1430         mknod mse$unit c $chr `unit2minor \`expr $unit '*' 2 + 1\``
1431         ;;
1432
1433 psm*)
1434         unit=`expr $i : 'psm\(.*\)'`
1435         chr=21
1436         # non-blocking for X11
1437         mknod psm$unit c $chr `unit2minor \`expr $unit '*' 2 + 1\``
1438         ;;
1439
1440 mouse*)
1441         name=`expr $i : 'mouse\(.*\)'`
1442         if [ ! -c $name ]; then
1443                 $0 $name                        # make the appropriate device
1444         fi
1445         ln -fs $name mouse
1446         ;;
1447
1448 pcaudio)
1449         mknod pcaudio c 24 0
1450         mknod pcaudioctl c 24 128
1451         ;;
1452
1453 socksys)
1454         mknod socksys c 41 0
1455         mknod spx c 41 1
1456         ln -fs socksys nfsd
1457         chmod 666 socksys nfsd spx
1458         ;;
1459
1460 snd*)
1461 #
1462 # changes from Linux voxware
1463 # minor         Linux                   FreeBSD
1464 # 8             sequencer2 (aka music0) music0
1465 # 17            patmgr0                 sequencer1
1466 # 33            patmgr1                 sequencer2
1467 #
1468
1469         unit=`expr $i : 'snd\(.*\)'`
1470         chr=30
1471
1472         # XXX write this less verbosely, like std
1473         snd_security_hole=0     # XXX
1474         umask $snd_security_hole
1475
1476         ln -fs mixer$unit mixer
1477         ln -fs sequencer$unit sequencer
1478         ln -fs dsp$unit dsp
1479         ln -fs audio$unit audio
1480         ln -fs dspW$unit dspW
1481         ln -fs music$unit music
1482         ln -fs pss$unit pss
1483
1484         mknod mixer$unit        c $chr `unit2minor \`expr $unit '*' 16 + 0\``
1485         mknod sequencer$unit    c $chr `unit2minor \`expr $unit '*' 16 + 1\``
1486         mknod midi$unit         c $chr `unit2minor \`expr $unit '*' 16 + 2\``
1487         mknod dsp$unit          c $chr `unit2minor \`expr $unit '*' 16 + 3\``
1488         mknod audio$unit        c $chr `unit2minor \`expr $unit '*' 16 + 4\``
1489         mknod dspW$unit         c $chr `unit2minor \`expr $unit '*' 16 + 5\``
1490         mknod sndstat           c $chr 6
1491                                 # minor number 7 is unused
1492         mknod music$unit        c $chr `unit2minor \`expr $unit '*' 16 + 8\``
1493         mknod pss$unit          c $chr `unit2minor \`expr $unit '*' 16 + 9\``
1494                                 # minor number 10 is unused
1495         mknod midistat          c $chr 11
1496                                 # minor numbers 12-15 are unused
1497         umask 77
1498         ;;
1499
1500 vat)
1501         mknod vatio c 25 128
1502         chmod 660 vatio
1503         ;;
1504
1505 gsc*)
1506         unit=`expr $i : 'gsc\(.*\)'`
1507         mknod gsc${unit} c 47 `unit2minor $unit`
1508         mknod gsc${unit}p c 47 `unit2minor $(($unit + 8))`
1509         mknod gsc${unit}d c 47 `unit2minor $(($unit + 32))`
1510         mknod gsc${unit}pd c 47 `unit2minor $(($unit + 40))`
1511         chmod 666 gsc${unit}*
1512         ;;
1513
1514 acpi)
1515         mknod acpi c 152 0 root:operator
1516         chmod 660 acpi
1517         ;;
1518
1519 apm)
1520         mknod apm c 39 0 root:operator
1521         chmod 664 apm
1522         ;;
1523
1524 apmctl)
1525         mknod apmctl c 39 8 root:operator
1526         chmod 660 apmctl
1527         ;;
1528
1529 card*)
1530         unit=`expr $i : 'card\(.*\)'`
1531         chr=50
1532         mknod card$unit c $chr `unit2minor $unit`
1533         chmod 644 card$unit
1534         ;;
1535
1536 ttyx?|ttyy?|ttyz?)
1537         case $i in
1538         *0) unit=0;;    *1) unit=1;;    *2) unit=2;;    *3) unit=3;;
1539         *4) unit=4;;    *5) unit=5;;    *6) unit=6;;    *7) unit=7;;
1540         *8) unit=8;;    *9) unit=9;;    *a) unit=10;;   *b) unit=11;;
1541         *c) unit=12;;   *d) unit=13;;   *e) unit=14;;   *f) unit=15;;
1542         esac
1543         case $i in
1544         ttyy?)  unit=`expr $unit \+ 16`;;
1545         ttyz?)  unit=`expr $unit \+ 32`;;
1546         esac
1547         mknod $i c 42 $unit
1548         ;;
1549
1550 cronyx)
1551         mknod cronyx c 42 63
1552         ;;
1553
1554 joy)
1555         mknod joy0 c 51 0 root:operator
1556         mknod joy1 c 51 1 root:operator
1557         chmod 640  joy0 joy1
1558         ;;
1559
1560 spigot)
1561         mknod spigot c 11 0
1562         chmod 444 spigot
1563         ;;
1564
1565 ctx?)
1566         unit=`expr $i : 'ctx\(.*\)'`
1567         mknod ctx$unit c 40 `unit2minor $unit`
1568         chmod 444 ctx$unit
1569         ;;
1570
1571 meteor?)
1572         unit=`expr $i : 'meteor\(.*\)'`
1573         mknod meteor$unit c 67 `unit2minor $unit`
1574         chmod 444 meteor$unit
1575         ;;
1576
1577 bktr?)
1578         unit=`expr $i : 'bktr\(.*\)'`
1579         mknod bktr$unit c 92 `unit2minor $unit`
1580         mknod tuner$unit c 92 `unit2minor $((16 + $unit ))`
1581         mknod vbi$unit c 92 `unit2minor $((32 + $unit ))`
1582         chmod 444 bktr$unit tuner$unit vbi$unit
1583         ;;
1584
1585 tun*)
1586         ntun=`expr $i : 'tun\(.*\)$'`
1587         unit=0
1588         while [ $unit -le $ntun ]; do
1589                 mknod tun$unit c 52 `unit2minor $unit`
1590                 unit=$(($unit + 1))
1591         done
1592         ;;
1593
1594 tap*)
1595         ntap=`expr $i : 'tap\(.*\)$'`
1596         unit=0
1597         while [ $unit -le $ntap ]; do
1598                 mknod tap$unit c 149 `unit2minor $unit` root:network
1599                 unit=$(($unit + 1))
1600         done
1601         ;;
1602
1603 sysmouse)
1604         mknod sysmouse c 12 128
1605         mknod consolectl c 12 255
1606         ;;
1607
1608 jogdial)
1609         mknod jogdial c 160 0
1610         ;;
1611
1612 snp?)
1613         unit=`expr $i : 'snp\(.*\)'`
1614         mknod snp$unit c 53 `unit2minor $unit`
1615         ;;
1616
1617 # dufault@hda.com: If I do much more work on other A-D boards
1618 # then eventually we'll have a "ad" and "dio" interface and some of these
1619 # "labpcaio" ones will be gone.
1620 # labpcaio: D-A and A-D.
1621 # labpcdio: Digital in and Digital out.
1622 #
1623 labpc*)
1624         umask 7
1625         case $i in
1626         labpcaio*)
1627                 name=labpcaio
1628                 unit=`expr $i : 'labpcaio\(.*\)'`
1629                 all="0 1 2 3 4 5 6 7"
1630                 offset=0
1631                 ;;
1632         labpcdio*)
1633                 name=labpcdio
1634                 unit=`expr $i : 'labpcdio\(.*\)'`
1635                 all="0 1 2 3"
1636                 offset=8
1637                 ;;
1638         *)
1639                 die 3 "Don't know LabPC type $i"
1640                 ;;
1641         esac
1642         if [ -z "${unit}" ]; then
1643                 unit=all
1644         fi
1645         case $unit in
1646                 0|1|2|3|4|5|6|7)
1647                                 mknod $name$unit c 66 `expr $offset + $unit `
1648                 ;;
1649                 all)
1650                         for i in $all
1651                         do
1652                                 mknod $name$i c 66 `expr $offset + $i `
1653                         done
1654                         ;;
1655                 *)
1656                         echo "No such LabPC unit: $unit"
1657                         ;;
1658         esac
1659         umask 77
1660         ;;
1661
1662 perfmon)
1663         mknod perfmon c 2 32 root:kmem
1664         chmod 640 perfmon
1665         ;;
1666
1667 ipl)
1668         mknod ipl c 79 0
1669         mknod ipnat c 79 1
1670         mknod ipstate c 79 2
1671         mknod ipauth c 79 3
1672         ;;
1673
1674 kbd*)
1675         unit=`expr $i : 'kbd\(.*\)'`
1676         chr=112
1677         mknod kbd$unit c $chr `unit2minor $unit`
1678         ;;
1679
1680 i4b)
1681         mknod i4b c 60 0
1682         ;;
1683
1684 i4bctl)
1685         mknod i4bctl c 55 0
1686         ;;
1687
1688 i4brbch*)
1689         unit=`expr $i : 'i4brbch\(.*\)'`
1690         mknod i4brbch$unit c 57 `unit2minor $unit`
1691         ;;
1692
1693 i4bteld*)
1694         offset=64
1695         unit=`expr $i : 'i4bteld\(.*\)'`
1696         mknod i4bteld$unit c 56 `unit2minor \`expr $offset + $unit\``
1697         ;;
1698
1699 i4btel*)
1700         unit=`expr $i : 'i4btel\(.*\)'`
1701         mknod i4btel$unit c 56 `unit2minor $unit`
1702         ;;
1703
1704 i4btrc*)
1705         unit=`expr $i : 'i4btrc\(.*\)'`
1706         mknod i4btrc$unit c 59 `unit2minor $unit`
1707         ;;
1708
1709 aac*)
1710         unit=`expr $i : 'aac\(.*\)'`
1711         mknod aac$unit c 150 `unit2minor $unit`
1712         ln -fs aac$unit afa$unit
1713         ;;
1714
1715 mlx*)
1716         unit=`expr $i : 'mlx\(.*\)'`
1717         mknod mlx$unit c 130 `unit2minor $unit`
1718         ;;
1719
1720 mly*)
1721         unit=`expr $i : 'mlx\(.*\)'`
1722         mknod mlx$unit c 158 `unit2minor $unit`
1723         ;;
1724
1725 amr*)
1726         unit=`expr $i : 'amr\(.*\)'`
1727         mknod amr$unit c 132 `unit2minor $unit`
1728         ;;
1729
1730 3dfx*)
1731         unit=`expr $i : '3dfx\(.*\)'`
1732         mknod 3dfx$unit c 107 `unit2minor $unit`
1733         ln -sf 3dfx$unit 3dfx
1734    ln -sf 3dfx$unit voodoo
1735         ;;
1736
1737 agpgart)
1738         mknod agpgart c 148 0
1739         ;;
1740
1741 twe*)
1742         unit=`expr $i : 'twe\(.*\)'`
1743         mknod twe$unit c 146 `unit2minor $unit`
1744         ;;
1745
1746 tw*)
1747         unit=`expr $i : 'tw\(.*\)'`
1748         mknod tw$unit c 19 `unit2minor $unit` root:operator
1749         ;;
1750
1751 local)
1752         umask 0                 # XXX should be elsewhere
1753         sh $0.local
1754         umask 77
1755         ;;
1756
1757 *)
1758         echo $i - no such device name
1759         ;;
1760
1761 esac
1762 done