3 # Copyright (c) 1990 The Regents of the University of California.
6 # Written and contributed by W. Jolitz 12/90
8 # Redistribution and use in source and binary forms are permitted provided
9 # that: (1) source distributions retain this entire copyright notice and
10 # comment, and (2) distributions including binaries display the following
11 # acknowledgement: ``This product includes software developed by the
12 # University of California, Berkeley and its contributors'' in the
13 # documentation or other materials provided with the distribution and in
14 # all advertising materials mentioning features or use of this software.
15 # Neither the name of the University nor the names of its contributors may
16 # be used to endorse or promote products derived from this software without
17 # specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 # @(#)MAKEDEV 5.2 (Berkeley) 6/22/90
24 # Device "make" file. Valid arguments:
25 # all makes all known devices, standard number of units (or close)
26 # std standard devices
27 # jail suitable for a jail(8)
28 # local configuration specific devices
29 # mach-4 mach4&lites+devices for Mach's XFree86 distribution
30 # (see http://www.cs.hut.fi/lites.html for more info on LITES)
33 # wt* QIC-interfaced (e.g. not SCSI) 3M cartridge tape
34 # sa* SCSI Sequential Access Devices
35 # ft* QIC-40/QIC-80 3M cartridge tape (interfaced
36 # via the floppy disk controller)
39 # wd* "Winchester" disk drives (ST506,IDE,ESDI,RLL,...)
40 # wfd* IDE floppy disk drives (LS-120)
41 # fd* floppy disk drives (3 1/2", 5 1/4")
42 # da* SCSI Direct Access Devices
43 # cd* SCSI CD-ROM disks
44 # sd* SCSI disk, antiquated, use da* instead
45 # mcd* Mitsumi CD-ROM disks
46 # scd* Sony CD-ROM disks
47 # matcd* Matsushita (Panasonic) CD-ROM disks
48 # acd* ATAPI CD-ROM disks
51 # fla* M-Systems DiskOnChip
52 # ida* Compaq Smart-2 RAID
55 # vty* virtual console devices for syscons/pcvt/codrv
58 # mse* Logitech and ATI Inport bus mouse
60 # sysmouse Mousesystems mouse emulator for syscons
63 # refclock-* serial ports used by xntpd parse refclocks
66 # tty* general purpose serial ports
67 # cua* dialout serial ports
68 # ttyA* Specialix SI/XIO dialin ports ('*' = number of devices)
69 # cuaA* Specialix SI/XIO dialout ports
70 # ttyD* Digiboard - 16 dialin ports
71 # cuaD* Digiboard - 16 dialout ports
72 # ttyR* Rocketport dialin ports
73 # cuaR* Rocketport dialout ports
76 # pty* set of 32 master and slave pseudo terminals
77 # vty* virtual terminals using syscons/pcvt/codrv console
81 # ppi* Parallel port i/o
82 # pps* Pulse per second timing interface
91 # ugen* generic USB device
93 # SCSI devices (other than CD-ROM, tape and disk):
94 # ssc The ``super scsi'' device
96 # pt* Processor Type (HP scanner, as one example)
97 # pass* CAM Passthrough device
99 # PC-CARD (previously called PCMCIA) support
100 # card* PC-CARD slots
103 # i4b isdnd call control device
104 # i4bctl debugging control device
105 # i4btrc* trace data interface(s), one per passive card
106 # i4btel* telephony interface(s)
107 # i4bteld* telephony dialout interface(s)
108 # i4brbch* raw b channel access device(s)
110 # Special purpose devices:
111 # apm Advanced Power Management BIOS
112 # apmctl APM BIOS control device
115 # tw* xten power controller
116 # snd* various sound cards
117 # pcaudio PCM audio driver
118 # socksys iBCS2 socket system driver
119 # vat VAT compatibility audio driver (requires snd*)
120 # gsc Genius GS-4500 hand scanner
122 # tun* Tunneling IP device
123 # snp* tty snoop devices
124 # spigot Video Spigot video acquisition card
125 # ctx* Cortex-I video acquisition card
126 # meteor* Matrox Meteor video acquisition card (pci)
127 # bktr* Bt848 based video acquisition card (pci)
128 # labpc* National Instrument's Lab-PC and LAB-PC+
129 # perfmon CPU performance-monitoring counters
130 # pci PCI configuration-space access from user mode
131 # ipl ipfilter control devices (ipl, ipnat, ipstate, ipauth)
132 # kbd keyboard devices
134 # $Id: MAKEDEV,v 1.206 1999/07/10 18:02:40 iwasaki Exp $
137 PATH=/sbin:/bin/:/usr/bin:/usr/sbin:$PATH
140 # Usage: die exitcode msg
146 # Convert integer to partition name
151 0) p=a;; 1) p=b;; 2) p=c;; 3) p=d;; 4) p=e;; 5) p=f;; 6) p=g;; 7) p=h;;
157 # Convert integer to slice name
169 # Convert disk (type, unit, slice, partition) to minor number
172 echo $(($1 << 25 | ($2 / 32) << 21 | ($2 % 32) << 3 | $3 << 16 | $4))
174 # Convert tape (ctrl, unit, mode, access) to minor number
177 echo $(($1 << 29 | ($2 / 16) << 16 | ($2 % 16) << 4 | $3 << 2 | $4))
180 # Override mknod(2) to add extra handling to it.
183 /sbin/mknod "$@" || die 2 "/sbin/mknod $@ failed"
184 chown root:wheel "$1" || exit 1
187 # Convert the last character of a tty name to a minor number.
192 a) m=10;; b) m=11;; c) m=12;; d) m=13;; e) m=14;; f) m=15;; g) m=16;;
193 h) m=17;; i) m=18;; j) m=19;; k) m=20;; l) m=21;; m) m=22;; n) m=23;;
194 o) m=24;; p) m=25;; q) m=26;; r) m=27;; s) m=28;; t) m=29;; u) m=30;;
201 # Raw partition for disks
204 # Compatibility slice for disks
207 # Raw slice for disks
211 disk_umask=037 # allow group operator to read disks
212 tape_umask=017 # allow group operator to read/write tapes
218 sh MAKEDEV std # standard
219 sh MAKEDEV fd0 fd1 # bdev, floppy disk
220 sh MAKEDEV da0 da1 da2 da3 wd0 wd1 wd2 wd3 # bdev, ordinary disk
221 sh MAKEDEV od0 # bdev, optical disk
222 sh MAKEDEV wfd0 # bdev, LS-120 floppy
223 sh MAKEDEV vn0 # bdev, virtual disk
224 sh MAKEDEV cd0 matcd0 mcd0 scd0 wcd0 # bdev, cdrom
225 sh MAKEDEV ft0 sa0 wt0 wst0 # bdev, tape
226 sh MAKEDEV vty12 # cdev, virtual tty
227 sh MAKEDEV cuaa0 cuaa1 cuaa2 cuaa3 # cdev, serial tty
228 sh MAKEDEV pty0 # cdev, pseudo tty
229 sh MAKEDEV ttyd0 ttyd1 ttyd2 ttyd3 # cdev, serial tty
230 sh MAKEDEV kbd0 # cdev, keyboard
231 sh MAKEDEV mse0 psm0 sysmouse # cdev, mouse
232 sh MAKEDEV pcaudio speaker # cdev, noise
233 sh MAKEDEV lpt0 lpt1 lpt2 # cdev, printer
234 sh MAKEDEV ppi0 ppi1 ppi2 # cdev, parallel port
235 sh MAKEDEV iic0 iic1 # cdev, I2C device
236 sh MAKEDEV smb0 smb1 # cdev, SMBus device
237 sh MAKEDEV ums0 ulpt0 ugen0 # cdev, USB devices
238 sh MAKEDEV bpf0 ipl tun0 # cdev, network
239 sh MAKEDEV ch0 perfmon tw0 # cdev, miscellaneous
240 sh MAKEDEV apm apmctl card0 card1 card2 card3 # cdev, laptop
241 sh MAKEDEV pass4 xpt2 # cdev, CAM
242 sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN
243 sh MAKEDEV i4btel0 i4btel1 i4bteld0 i4bteld1 # cdev, ISDN
244 sh MAKEDEV i4brbch0 i4brbch1 # cdev, ISDN
248 mknod console c 0 0; chmod 600 console
249 mknod drum c 4 0; chmod 640 drum; chgrp kmem drum
250 mknod kmem c 2 1; chmod 640 kmem; chgrp kmem kmem
251 mknod mem c 2 0; chmod 640 mem; chgrp kmem mem
252 mknod null c 2 2; chmod 666 null
253 mknod random c 2 3; chmod 644 random
254 mknod urandom c 2 4; chmod 644 urandom
255 mknod zero c 2 12; chmod 666 zero
256 mknod io c 2 14; chmod 600 io
257 mknod tty c 1 0; chmod 666 tty
258 mknod klog c 7 0; chmod 600 klog
259 mknod stdin c 22 0; chmod 666 stdin
260 mknod stdout c 22 1; chmod 666 stdout
261 mknod stderr c 22 2; chmod 666 stderr
262 mknod pci c 78 0; chmod 644 pci
264 (cd fd && eval `echo "" | awk ' BEGIN { \
265 for (i = 0; i < 64; i++) \
266 printf("mknod %d c 22 %d;", i, i)}'`)
274 rm mem kmem drum pci io klog # for security
275 ln -sf null mem # for libkvm (ab)users
276 ln -sf null kmem # --//--
277 ln -sf null drum # --//--
285 mknod timezone c 26 0
288 # Create device files for new Archive/Wangtek QIC-02 tape driver (vak)
291 u=`expr $i : '..\(.*\)'`
292 if [ x$u = x ]; then u=0; fi
293 mknod rwt${u} c 10 `expr 0 + $u` # default density, 512b blocks
294 mknod nrwt${u} c 10 `expr 4 + $u`
295 # mknod rWt${u} c 10 `expr 64 + $u` # default density, 1024b blocks
296 # mknod nrWt${u} c 10 `expr 68 + $u`
297 mknod rwt${u}b c 10 `expr 16 + $u` # 60 megabytes
298 mknod nrwt${u}b c 10 `expr 20 + $u`
299 mknod rwt${u}c c 10 `expr 24 + $u` # 120 megabytes
300 mknod nrwt${u}c c 10 `expr 28 + $u`
301 mknod rwt${u}d c 10 `expr 32 + $u` # 150 megabytes
302 mknod nrwt${u}d c 10 `expr 36 + $u`
303 # mknod rwt${u}e c 10 `expr 40 + $u` # 300 megabytes?
304 # mknod nrwt${u}e c 10 `expr 44 + $u`
305 # mknod rwt${u}f c 10 `expr 48 + $u` # 600 megabytes?
306 # mknod nrwt${u}f c 10 `expr 52 + $u`
307 chgrp operator r[Ww]t$u nr[Ww]t$u r[Ww]t$u[a-f] nr[Ww]t$u[a-f]
312 ad*s*|od*s*|sd*s*|da*s*|vn*s*|wd*s*|afd*s*|wfd*s*|fla*s*|ida*s*)
315 ad*s*) name=ad; blk=30; chr=116;;
316 afd*s*) name=afd; blk=32; chr=118;;
317 ida*s*) name=ida; blk=29; chr=109;;
318 fla*s*) name=fla; blk=28; chr=102;;
319 od*s*) name=od; blk=4; chr=13;;
320 sd*s*) name=sd; blk=4; chr=13;;
321 da*s*) name=da; blk=4; chr=13;;
322 vn*s*) name=vn; blk=15; chr=43;;
323 wd*s*) name=wd; blk=0; chr=3;;
324 wfd*s*) name=wfd; blk=1; chr=87;;
327 afd*s*|ida*s*|fla*s*|wfd*s*)
328 unit=`expr $i : '...\([0-9]*\)s'`
329 slice=`expr $i : '...[0-9]*s\([0-9]*\)'`
330 part=`expr $i : '...[0-9]*s[0-9]*\(.*\)'`
333 unit=`expr $i : '..\([0-9]*\)s'`
334 slice=`expr $i : '..[0-9]*s\([0-9]*\)'`
335 part=`expr $i : '..[0-9]*s[0-9]*\(.*\)'`
339 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
344 slicename=`dkitos $slice`
345 minor=`dkminor 0 $unit $slice $dkrawpart`
346 mknod $name$unit$slicename b $blk $minor
347 mknod r$name$unit$slicename c $chr $minor
351 0) slice=$oldslice ;;
353 for part in 0 1 2 3 4 5 6 7
355 minor=`dkminor 0 $unit $slice $part`
356 partname=`dkitop $part`
357 mknod $name$unit$slicename$partname \
359 mknod r$name$unit$slicename$partname \
366 echo bad partition for disk in: $i
369 chgrp operator $name$unit$slicename* \
370 r$name$unit$slicename*
373 echo bad slice for disk in: $i
378 echo bad unit for disk in: $i "(unit=$unit, slice=$slice, part=$part)"
386 unit=`expr $i : '..\(.*\)'`
387 name=fd; blk=2; chr=9
390 mknod ${name}${unit} b $blk `expr $unit '*' 64`
391 mknod r${name}${unit} c $chr `expr $unit '*' 64`
392 # Fake BSD partitions
393 for i in a b c d e f g h
395 ln -f ${name}${unit} ${name}${unit}$i
396 ln -f r${name}${unit} r${name}${unit}$i
398 # User-readable and programmer-readable name sets
400 mknod ${name}${unit}.1720 b $blk `expr $unit '*' 64 + 1`
401 mknod r${name}${unit}.1720 c $chr `expr $unit '*' 64 + 1`
402 # ln -f ${name}${unit}.1720 ${name}${unit}135hs21
403 # ln -f r${name}${unit}.1720 r${name}${unit}135hs21
405 mknod ${name}${unit}.1480 b $blk `expr $unit '*' 64 + 2`
406 mknod r${name}${unit}.1480 c $chr `expr $unit '*' 64 + 2`
407 # ln -f ${name}${unit}.1480 ${name}${unit}135hs18
408 # ln -f r${name}${unit}.1480 r${name}${unit}135hs18
409 # ln -f ${name}${unit}.1480 ${name}${unit}96hs18
410 # ln -f r${name}${unit}.1480 r${name}${unit}96hs18
412 mknod ${name}${unit}.1440 b $blk `expr $unit '*' 64 + 3`
413 mknod r${name}${unit}.1440 c $chr `expr $unit '*' 64 + 3`
414 # ln -f ${name}${unit}.1440 ${name}${unit}135
415 # ln -f r${name}${unit}.1440 r${name}${unit}135
416 # ln -f ${name}${unit}.1440 ${name}${unit}135ds18
417 # ln -f r${name}${unit}.1440 r${name}${unit}135ds18
418 # ln -f ${name}${unit}.1440 ${name}${unit}96ds18
419 # ln -f r${name}${unit}.1440 r${name}${unit}96ds18
421 mknod ${name}${unit}.1200 b $blk `expr $unit '*' 64 + 4`
422 mknod r${name}${unit}.1200 c $chr `expr $unit '*' 64 + 4`
423 # ln -f ${name}${unit}.1200 ${name}${unit}96
424 # ln -f r${name}${unit}.1200 r${name}${unit}96
425 # ln -f ${name}${unit}.1200 ${name}${unit}96ds15
426 # ln -f r${name}${unit}.1200 r${name}${unit}96ds15
427 # ln -f ${name}${unit}.1200 ${name}${unit}135ds15
428 # ln -f r${name}${unit}.1200 r${name}${unit}135ds15
430 mknod ${name}${unit}.820 b $blk `expr $unit '*' 64 + 5`
431 mknod r${name}${unit}.820 c $chr `expr $unit '*' 64 + 5`
432 # ln -f ${name}${unit}.820 ${name}${unit}96hs10
433 # ln -f r${name}${unit}.820 r${name}${unit}96hs10
434 # ln -f ${name}${unit}.820 ${name}${unit}135hs10
435 # ln -f r${name}${unit}.820 r${name}${unit}135hs10
437 mknod ${name}${unit}.800 b $blk `expr $unit '*' 64 + 6`
438 mknod r${name}${unit}.800 c $chr `expr $unit '*' 64 + 6`
439 # ln -f ${name}${unit}.800 ${name}${unit}96ds10
440 # ln -f r${name}${unit}.800 r${name}${unit}96ds10
441 # ln -f ${name}${unit}.800 ${name}${unit}135ds10
442 # ln -f r${name}${unit}.800 r${name}${unit}135ds10
444 mknod ${name}${unit}.720 b $blk `expr $unit '*' 64 + 7`
445 mknod r${name}${unit}.720 c $chr `expr $unit '*' 64 + 7`
446 # ln -f ${name}${unit}.720 ${name}${unit}96ds9
447 # ln -f r${name}${unit}.720 r${name}${unit}96ds9
448 # ln -f ${name}${unit}.720 ${name}${unit}135ds9
449 # ln -f r${name}${unit}.720 r${name}${unit}135ds9
451 mknod ${name}${unit}.360 b $blk `expr $unit '*' 64 + 8`
452 mknod r${name}${unit}.360 c $chr `expr $unit '*' 64 + 8`
453 # ln -f ${name}${unit}.360 ${name}${unit}48
454 # ln -f r${name}${unit}.360 r${name}${unit}48
455 # ln -f ${name}${unit}.360 ${name}${unit}48ds9
456 # ln -f r${name}${unit}.360 r${name}${unit}48ds9
458 chgrp operator ${name}${unit}* r${name}${unit}*
461 echo bad unit for disk in: $i
469 unit=`expr $i : '..\(.*\)'`
470 name=ft; blk=2; chr=9
473 mknod ${name}${unit} b $blk `expr $unit '*' 64 + 32`
474 mknod r${name}${unit} c $chr `expr $unit '*' 64 + 32`
475 ln -f ${name}${unit} ${name}${unit}a
476 ln -f r${name}${unit} r${name}${unit}a
477 chgrp operator ${name}${unit}* r${name}${unit}*
480 echo bad unit for tape in: $i
486 ad*|sd*|od*|da*|vn*|wd*|afd*|wfd*|fla*|ida*)
489 ad*) name=ad; blk=30; chr=116;;
490 afd*) name=afd; blk=32; chr=118;;
491 ida*) name=ida; blk=29; chr=109;;
492 fla*) name=fla; blk=28; chr=102;;
493 sd*) name=sd; blk=4; chr=13;;
494 od*) name=od; blk=4; chr=13;;
495 da*) name=da; blk=4; chr=13;;
496 vn*) name=vn; blk=15; chr=43;;
497 wd*) name=wd; blk=0; chr=3;;
498 wfd*) name=wfd; blk=1; chr=87;;
502 unit=`expr $i : '...\(.*\)'`
505 unit=`expr $i : '..\(.*\)'`
509 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
510 for slicepartname in s0h s1 s2 s3 s4
512 sh MAKEDEV $name$unit$slicepartname
516 echo bad unit for disk in: $i
526 unit=`expr $i : '...\(.*\)'`
528 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
529 for part in 0 1 2 3 4 5 6 7
531 minor=`dkminor 0 $unit 0 $part`
532 partname=`dkitop $part`
533 mknod $name$unit$partname b $blk $minor
534 mknod r$name$unit$partname c $chr $minor
536 chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
539 echo bad unit for disk in: $i
549 # SCSI processor type driver
553 unit=`expr $i : 'pt\([0-9][0-9]*\)'`
554 if [ "X${unit}" = "X" ]; then
557 unit=`expr $unit + 1 - 1`
558 mknod ${name}${unit} c $chr $unit
561 # SCSI target mode sample driver
565 unit=`expr $i : 'targ\([0-9][0-9]*\)'`
566 if [ "X${unit}" = "X" ]; then
569 unit=`expr $unit + 1 - 1`
570 mknod ${name}${unit} c $chr $unit
571 mknod ${name}.ctl c $chr 0xffff00ff
574 # CAM transport layer device
577 # This major number is temporary
580 units=`expr $i : 'xpt\(.*\)'`
581 if [ "X${units}" = "X" ]; then
584 eval `echo ${chr} ${units} ${name} |awk \
585 '{ c=$1; n=$2; name=$3;} END {
586 for (i = 0; i < n; i++)
587 printf("rm -f %s%d r%s%d; mknod %s%d c %d %d; \
588 chgrp operator %s%d;", \
589 name, i, name, i, name, i, c, i, \
592 # CAM passthrough device
595 # This major number is temporary
598 units=`expr $i : 'pass\(.*\)'`
599 if [ "X${units}" = "X" ]; then
602 eval `echo ${chr} ${units} ${name} |awk \
603 '{ c=$1; n=$2; name=$3;} END {
604 for (i = 0; i < n; i++)
605 printf("rm -f %s%d r%s%d; mknod %s%d c %d %d; \
606 chgrp operator %s%d;", \
607 name, i, name, i, name, i, c, i, \
611 class=`expr $i : 'pty\(.*\)'`
614 1) offset=32 name=q;;
615 2) offset=64 name=r;;
616 3) offset=96 name=s;;
617 # Note that xterm (at least) only look at p-s.
618 4) offset=128 name=P;;
619 5) offset=160 name=Q;;
620 6) offset=192 name=R;;
621 7) offset=224 name=S;;
622 # This still leaves [tuTU].
623 *) echo bad unit for pty in: $i;;
628 eval `echo $offset $name | awk ' { b=0+$1; n=$2 } END { \
629 for (i = 0; i < 32; i++) {
630 c = substr("0123456789abcdefghijklmnopqrstuv", i + 1, 1); \
631 printf("mknod tty%s%s c 5 %d; \
632 mknod pty%s%s c 6 %d;", \
644 unit=`expr $i : '..\(.*\)'`
648 [0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9])
649 mknod rsa${unit}.ctl c $chr `saminor 1 ${unit} 0 0`
652 mknod rsa${unit}.${m} c $chr `saminor 0 ${unit} ${m} 0`
653 mknod nrsa${unit}.${m} c $chr `saminor 0 ${unit} ${m} 1`
654 mknod ersa${unit}.${m} c $chr `saminor 0 ${unit} ${m} 2`
655 chgrp operator rsa${unit}.${m} nrsa${unit}.${m} \
658 ln -f rsa${unit}.0 rsa${unit}
659 ln -f nrsa${unit}.0 nrsa${unit}
660 ln -f ersa${unit}.0 ersa${unit}
663 echo bad unit for tape in: $i
671 unit=`expr $i : '..\(.*\)'`
673 ch*) name=ch; chr=17;;
677 mknod ${name}${unit} c $chr $unit
678 chgrp operator ${name}${unit}
681 echo bad unit for media changer in: $i
689 unit=`expr $i : '...\(.*\)'`
693 mknod rast${unit} c $chr `expr $unit '*' 8 + 0`
694 chgrp operator rast${unit}
695 chmod 640 rast${unit}
698 echo bad unit for tape in: $i
707 acd*) units=`expr $i : '...\(.*\)'`; name=acd; blk=31; chr=117;;
708 cd*) units=`expr $i : '..\(.*\)'`; name=cd; blk=6; chr=15;;
709 mcd*) units=`expr $i : '...\(.*\)'`; name=mcd; blk=7; chr=29;;
710 scd*) units=`expr $i : '...\(.*\)'`; name=scd; blk=16; chr=45;;
712 if [ "X${units}" = "X" -o ${units} -le 0 ]; then
715 if [ "${units}" -le 31 ]; then
716 eval `echo ${chr} ${blk} ${units} ${name} |awk \
717 '{ c=$1; b=$2; n=$3; name=$4;} END{
718 for (i = 0; i < n; i++){
719 printf("rm -f %s%d* r%s%d*; \
720 mknod %s%da b %d %d; \
721 mknod %s%dc b %d %d; \
722 mknod r%s%da c %d %d; \
723 mknod r%s%dc c %d %d; \
724 chgrp operator %s%d* r%s%d*;",
727 name, i, b, (i * 8) + 2,
729 name, i, c, (i * 8) + 2,
730 name, i, name, i); }}'`
733 echo "$i is invalid -- can't have more than 32 cd devices"
741 matcd*) unit=`expr $i : '.....\(.*\)'`; name=matcd; blk=17; chr=46;;
744 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15)
745 mknod ${name}${unit}a b $blk `expr $unit '*' 8 + 0`
746 mknod ${name}${unit}c b $blk `expr $unit '*' 8 + 2`
747 mknod r${name}${unit}a c $chr `expr $unit '*' 8 + 0`
748 mknod r${name}${unit}c c $chr `expr $unit '*' 8 + 2`
749 chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
750 chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
752 mknod ${name}${unit}la b $blk `expr $unit '*' 8 + 128`
753 mknod ${name}${unit}lc b $blk `expr $unit '*' 8 + 130`
754 mknod r${name}${unit}la c $chr `expr $unit '*' 8 + 128`
755 mknod r${name}${unit}lc c $chr `expr $unit '*' 8 + 130`
756 chgrp operator ${name}${unit}l[a-h] r${name}${unit}l[a-h]
757 chmod 640 ${name}${unit}l[a-h] r${name}${unit}l[a-h]
760 echo bad unit for disk in: $i
768 unit=`expr $i : '...\(.*\)'`
773 mknod wcd${unit}a b $blk `expr $unit '*' 8 + 0`
774 mknod rwcd${unit}a c $chr `expr $unit '*' 8 + 0`
775 mknod wcd${unit}c b $blk `expr $unit '*' 8 + 2`
776 mknod rwcd${unit}c c $chr `expr $unit '*' 8 + 2`
777 chgrp operator wcd${unit}[a-h] rwcd${unit}[a-h]
778 chmod 640 wcd${unit}[a-h] rwcd${unit}[a-h]
781 echo bad unit for disk in: $i
789 unit=`expr $i : '...\(.*\)'`
793 mknod rwst${unit} c $chr `expr $unit '*' 8 + 0`
794 chgrp operator rwst${unit}
795 chmod 640 rwst${unit}
802 unit=`expr $i : 'iic\(.*\)'`
803 mknod iic$unit c 105 $unit
807 unit=`expr $i : 'smb\(.*\)'`
808 mknod smb$unit c 106 $unit
812 unit=`expr $i : 'ppi\(.*\)'`
813 mknod ppi$unit c 82 $unit
817 unit=`expr $i : 'pps\(.*\)'`
818 mknod pps$unit c 89 $unit
822 unit=`expr $i : 'usb\(.*\)'`
823 mknod usb$unit c 108 $unit
827 unit=`expr $i : 'ums\(.*\)'`
828 mknod ums$unit c 111 $unit
832 unit=`expr $i : 'ulpt\(.*\)'`
833 mknod ulpt$unit c 113 $unit
837 unit=`expr $i : 'ugen\([0-9][0-9]*\)'`
838 endpoint=`expr $i : 'ugen.*\.\([0-9][0-9]*\)'`
839 if [ "x$unit" = "x" ]; then
840 echo $i - Invalid unit number
842 if [ "x$endpoint" = "x" ]; then
843 minor=`expr $unit \* 16`
844 mknod ugen$unit c 114 $minor
846 minor=`expr $unit \* 16 + $endpoint`
847 mknod ugen$unit.$endpoint c 114 $minor
852 unit=`expr $i : 'lpt\(.*\)'`
853 mknod lpt$unit c 16 $unit
854 mknod lpctl$unit c 16 `expr $unit + 128`
858 unit=`expr $i : 'tw\(.*\)'`
859 mknod tw$unit c 19 $unit
860 chgrp operator tw$unit
863 # Use this to create virtual consoles for syscons, pcvt or codrv
865 # use as MAKEDEV vtyNN to create NN entries
868 units=`expr $i : 'vty\(.*\)'`
869 eval `echo ${chr} ${units} | awk ' { c=0+$1; n=0+$2 } END {
870 for (i = 0; i < n; i++)
871 printf("mknod ttyv%01x c %d %d;", i, c, i); }'`
872 ln -fs ttyv0 vga # XXX X still needs this pccons relic
876 nbpf=`expr $i : 'bpf\(.*\)$'`
878 while [ $unit -le $nbpf ]; do
879 mknod bpf$unit c 23 $unit
880 unit=`expr $unit + 1`
890 unit=`expr $i : 'cua.*\(.\)$'`
892 mknod cuaa$unit c 28 `expr $m + 128`
893 mknod cuaia$unit c 28 `expr $m + 32 + 128`
894 mknod cuala$unit c 28 `expr $m + 64 + 128`
895 chown uucp:dialer cua*a$unit
900 unit=`expr $i : 'tty.*\(.\)$'`
902 mknod ttyd$unit c 28 $m
903 mknod ttyid$unit c 28 `expr $m + 32`
904 mknod ttyld$unit c 28 `expr $m + 64`
909 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
910 g h i j k l m n o p q r s t u v"
912 card=`expr $i : 'cua.*\(.\)$'`
913 for unit in $portlist
915 minor=`ttyminor $unit`
916 minor=`expr $card \* 65536 + $minor`
918 mknod cuac$name c $major `expr $minor + 128`
919 mknod cuaic$name c $major `expr $minor + 32 + 128`
920 mknod cualc$name c $major `expr $minor + 64 + 128`
921 chown uucp:dialer cuac$name cuaic$name cualc$name
927 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
928 g h i j k l m n o p q r s t u v"
930 card=`expr $i : 'tty.*\(.\)$'`
931 for unit in $portlist
933 minor=`ttyminor $unit`
934 minor=`expr $card \* 65536 + $minor`
936 mknod ttyc$name c $major $minor
937 mknod ttyic$name c $major `expr $minor + 32`
938 mknod ttylc$name c $major `expr $minor + 64`
942 # RISCom8 'rc' driver entries
946 unit=`expr $i : 'cua.*\(.\)$'`
948 mknod cuam$unit c 63 `expr $m + 128`
949 chown uucp:dialer cuam$unit
954 unit=`expr $i : 'tty.*\(.\)$'`
956 mknod ttym$unit c 63 $m
960 # Note: these are 'base 1' to match the numbers on the panels, and to match
961 # the manual that comes with the system.
964 nports=`expr $i : 'ttyA\(.*\)$'`
966 while [ $port -le $nports ]; do
967 minor=`expr $port - 1`
968 name=`expr $port + 1000 | cut -c 3-4`
969 mknod ttyA$name c $major $minor
970 mknod ttyiA$name c $major `expr $minor + 65536`
971 mknod ttylA$name c $major `expr $minor + 131072`
972 port=`expr $port + 1`
974 # For the user-mode control program, 'sicontrol'
975 mknod si_control c 68 262144
981 nports=`expr $i : 'cuaA\(.*\)$'`
983 while [ $port -le $nports ]; do
984 minor=`expr $port - 1`
985 name=`expr $port + 1000 | cut -c 3-4`
986 mknod cuaA$name c $major `expr $minor + 128`
987 mknod cuaiA$name c $major `expr $minor + 128 + 65536`
988 mknod cualA$name c $major `expr $minor + 128 + 131072`
989 chown uucp:dialer cuaA$name cuaiA$name cualA$name
990 port=`expr $port + 1`
995 # Digiboard PC/?? 16 port card.
996 # The current scheme of minor numbering is:
998 # unused{14} CARD{2} major{8} CALLOUT{1} LOCK{1} INIT{1} PORT{5}
1000 # CARD bitfield in future versions may be extended to 3 bits.
1005 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1007 card=`expr $i : 'tty.*\(.\)$'`
1008 for unit in $portlist
1010 minor=`ttyminor $unit`
1011 minor=`expr $card \* 65536 + $minor`
1013 mknod ttyD$name c $major $minor
1014 mknod ttyiD$name c $major `expr $minor + 32`
1015 mknod ttylD$name c $major `expr $minor + 64`
1021 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1023 card=`expr $i : 'cua.*\(.\)$'`
1024 for unit in $portlist
1026 minor=`ttyminor $unit`
1027 minor=`expr $card \* 65536 + $minor`
1029 mknod cuaD$name c $major `expr $minor + 128`
1030 mknod cuaiD$name c $major `expr $minor + 32 + 128`
1031 mknod cualD$name c $major `expr $minor + 64 + 128`
1032 chown uucp:dialer cua*D$name
1038 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1039 modulelist="a b c d"
1041 card=`expr $i : 'tty.*\(.\)$'`
1042 for unit in $modulelist
1044 moduleminor=`ttyminor $unit`
1045 moduleminor=`expr $moduleminor % 10 \* 16`
1048 for unit in $portlist
1050 minor=`ttyminor $unit`
1051 minor=`expr $card \* 65536 + $minor + $moduleminor`
1052 name=$card$modulename$unit
1054 mknod ttyM$name c $major $minor
1055 mknod ttyiM$name c $major `expr $minor + 64`
1056 mknod ttylM$name c $major `expr $minor + 128`
1057 chown root:wheel tty*M$name
1064 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1065 modulelist="a b c d"
1067 card=`expr $i : 'cua.*\(.\)$'`
1068 for unit in $modulelist
1070 moduleminor=`ttyminor $unit`
1071 moduleminor=`expr $moduleminor % 10 \* 16`
1074 for unit in $portlist
1076 minor=`ttyminor $unit`
1077 minor=`expr $card \* 65536 + $minor + $moduleminor`
1078 name=$card$modulename$unit
1080 mknod cuaM$name c $major `expr $minor + 262144`
1081 mknod cuaiM$name c $major `expr $minor + 64 + 262144`
1082 mknod cualM$name c $major `expr $minor + 128 + 262144`
1083 chown uucp:dialer cua*M$name
1091 BOARD=1; MINOR=65536; Rnum=0
1092 MINOR=`expr $BOARD \* 65536`
1093 dmesg | grep ^RocketPort[0-4] > /tmp/rp_list
1094 controllers=`awk '{print $1}' < /tmp/rp_list`
1095 rm -f /dev/ttyR*; rm -f /dev/ttyiR*; rm -f /dev/ttylR*
1096 for i in $controllers;do
1097 ndevices=`grep ^$i /tmp/rp_list | sed -e 's/.* \([0-9]*\) ports/\1/'`
1098 echo -n "Creating $ndevices devices for $i: "
1099 for dev in `jot $ndevices 0`;do
1100 mknod /dev/ttyR$Rnum c $major $MINOR
1101 mknod /dev/ttylR$Rnum c $major `expr $MINOR + 32`
1102 mknod /dev/ttyiR$Rnum c $major `expr $MINOR + 64`
1103 Rnum=`expr $Rnum + 1`
1104 MINOR=`expr $MINOR + 1`
1106 BOARD=`expr $BOARD + 1`
1107 MINOR=`expr $BOARD \* 65536`
1114 BOARD=1; MINOR=65536; Rnum=0
1115 MINOR=`expr $BOARD \* 65536`
1116 dmesg | grep ^RocketPort[0-4] > /tmp/rp_list
1117 controllers=`awk '{print $1}' < /tmp/rp_list`
1118 rm -f /dev/cuaR*; rm -f /dev/cuaiR*; rm -f /dev/cualR*
1119 for i in $controllers;do
1120 ndevices=`grep ^$i /tmp/rp_list | sed -e 's/.* \([0-9]*\) ports/\1/'`
1121 echo -n "Creating $ndevices devices for $i: "
1122 for dev in `jot $ndevices 0`;do
1123 mknod /dev/cuaR$Rnum c $major `expr $MINOR + 128`
1124 mknod /dev/cualR$Rnum c $major `expr $MINOR + 128 + 32`
1125 mknod /dev/cuaiR$Rnum c $major `expr $MINOR + 128 + 64`
1126 Rnum=`expr $Rnum + 1`
1127 MINOR=`expr $MINOR + 1`
1129 BOARD=`expr $BOARD + 1`
1130 MINOR=`expr $BOARD \* 65536`
1133 chown uucp:dialer /dev/cuaR*
1137 unit=`expr $i : 'mse\(.*\)'`
1139 mknod mse$unit c $chr `expr $unit '*' 2 + 1` # non-blocking for X11
1143 unit=`expr $i : 'psm\(.*\)'`
1145 mknod psm$unit c $chr `expr $unit '*' 2 + 1` # non-blocking for X11
1149 name=`expr $i : 'mouse\(.*\)'`
1150 if [ ! -c $name ]; then
1151 $0 $name # make the appropriate device
1157 mknod pcaudio c 24 0
1158 mknod pcaudioctl c 24 128
1162 mknod socksys c 41 0
1165 chmod 666 socksys nfsd spx
1170 # changes from Linux voxware
1171 # minor Linux FreeBSD
1172 # 8 sequencer2 (aka music0) music0
1173 # 17 patmgr0 sequencer1
1174 # 33 patmgr1 sequencer2
1177 unit=`expr $i : 'snd\(.*\)'`
1180 # XXX write this less verbosely, like std
1181 snd_security_hole=0 # XXX
1182 umask $snd_security_hole
1184 ln -fs mixer$unit mixer
1185 ln -fs sequencer$unit sequencer
1187 ln -fs audio$unit audio
1188 ln -fs dspW$unit dspW
1189 ln -fs music$unit music
1192 mknod mixer$unit c $chr `expr $unit '*' 16 + 0`
1193 mknod sequencer$unit c $chr `expr $unit '*' 16 + 1`
1194 mknod midi$unit c $chr `expr $unit '*' 16 + 2`
1195 mknod dsp$unit c $chr `expr $unit '*' 16 + 3`
1196 mknod audio$unit c $chr `expr $unit '*' 16 + 4`
1197 mknod dspW$unit c $chr `expr $unit '*' 16 + 5`
1198 mknod sndstat c $chr 6
1199 # minor number 7 is unused
1200 mknod music$unit c $chr `expr $unit '*' 16 + 8`
1201 mknod pss$unit c $chr `expr $unit '*' 16 + 9`
1202 # minor numbers 10-15 are unused
1207 mknod vatio c 25 128
1212 unit=`expr $i : 'gsc\(.*\)'`
1213 mknod gsc${unit} c 47 $unit
1214 mknod gsc${unit}p c 47 $(($unit + 8))
1215 mknod gsc${unit}d c 47 $(($unit + 32))
1216 mknod gsc${unit}pd c 47 $(($unit + 40))
1217 chmod 666 gsc${unit}*
1223 mknod apmctl c $chr 8
1225 chgrp operator apmctl
1231 unit=`expr $i : 'card\(.*\)'`
1233 mknod card$unit c $chr $unit
1239 *0) unit=0;; *1) unit=1;; *2) unit=2;; *3) unit=3;;
1240 *4) unit=4;; *5) unit=5;; *6) unit=6;; *7) unit=7;;
1241 *8) unit=8;; *9) unit=9;; *a) unit=10;; *b) unit=11;;
1242 *c) unit=12;; *d) unit=13;; *e) unit=14;; *f) unit=15;;
1245 ttyy?) unit=`expr $unit \+ 16`;;
1246 ttyz?) unit=`expr $unit \+ 32`;;
1253 mknod cronyx c 42 63
1259 chgrp operator joy0 joy1
1269 unit=`expr $i : 'ctx\(.*\)'`
1270 mknod ctx$unit c 40 $unit
1275 unit=`expr $i : 'meteor\(.*\)'`
1276 mknod meteor$unit c 67 $unit
1277 chmod 444 meteor$unit
1281 unit=`expr $i : 'bktr\(.*\)'`
1282 mknod bktr$unit c 92 $unit
1283 mknod tuner$unit c 92 $((16 + $unit ))
1284 mknod vbi$unit c 92 $((32 + $unit ))
1285 chmod 444 bktr$unit tuner$unit vbi$unit
1289 ntun=`expr $i : 'tun\(.*\)$'`
1291 while [ $unit -le $ntun ]; do
1292 mknod tun$unit c 52 $unit
1293 chown uucp:dialer tun$unit
1294 unit=`expr $unit + 1`
1299 mknod sysmouse c 12 128
1300 mknod consolectl c 12 255
1304 unit=`expr $i : 'snp\(.*\)'`
1305 mknod snp$unit c 53 $unit
1308 # dufault@hda.com: If I do much more work on other A-D boards
1309 # then eventually we'll have a "ad" and "dio" interface and some of these
1310 # "labpcaio" ones will be gone.
1311 # labpcaio: D-A and A-D.
1312 # labpcdio: Digital in and Digital out.
1319 unit=`expr $i : 'labpcaio\(.*\)'`
1320 all="0 1 2 3 4 5 6 7"
1325 unit=`expr $i : 'labpcdio\(.*\)'`
1330 die 3 "Don't know LabPC type $i"
1333 if [ "X${unit}" = "X" ]; then
1338 mknod $name$unit c 66 `expr $offset + $unit `
1343 mknod $name$i c 66 `expr $offset + $i `
1347 echo "No such LabPC unit: $unit"
1354 mknod perfmon c 2 32
1362 mknod ipstate c 79 2
1367 unit=`expr $i : 'kbd\(.*\)'`
1369 mknod kbd$unit c $chr $unit
1374 chown root:wheel i4b
1380 chown root:wheel i4bctl
1385 unit=`expr $i : 'i4brbch\(.*\)'`
1386 mknod i4brbch$unit c 57 $unit
1387 chown root:wheel i4brbch$unit
1388 chmod 600 i4brbch$unit
1393 unit=`expr $i : 'i4bteld\(.*\)'`
1394 mknod i4bteld$unit c 56 `expr $offset + $unit `
1395 chown root:wheel i4bteld$unit
1396 chmod 600 i4bteld$unit
1400 unit=`expr $i : 'i4btel\(.*\)'`
1401 mknod i4btel$unit c 56 $unit
1402 chown root:wheel i4btel$unit
1403 chmod 600 i4btel$unit
1407 unit=`expr $i : 'i4btrc\(.*\)'`
1408 mknod i4btrc$unit c 59 $unit
1409 chown root:wheel i4btrc$unit
1410 chmod 600 i4btrc$unit
1414 umask 0 # XXX should be elsewhere
1420 echo $i - no such device name