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
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)
34 # wt* QIC-interfaced (e.g. not SCSI) 3M cartridge tape
35 # sa* SCSI Sequential Access Devices
38 # acd* ATAPI CD-ROM disks
40 # cd* SCSI CD-ROM disks
41 # da* SCSI Direct Access Devices
42 # fd* floppy disk drives (3 1/2", 5 1/4")
43 # fla* M-Systems DiskOnChip
44 # idad* Compaq Smart-2 RAID arrays
45 # matcd* Matsushita (Panasonic) CD-ROM disks
46 # mcd* Mitsumi CD-ROM disks
47 # md* Memory (or malloc) disk
48 # mlx* Mylex DAC960 RAID controllers
49 # mlxd* Mylex DAC960 RAID disk volumes
50 # scd* Sony CD-ROM disks
52 # wd* "Winchester" disk drives (ST506,IDE,ESDI,RLL,...)
53 # wfd* IDE floppy disk drives (LS-120)
56 # vty* virtual console devices for syscons/pcvt/codrv
59 # mse* Logitech and ATI Inport bus mouse
61 # sysmouse Mousesystems mouse emulator for syscons
64 # refclock-* serial ports used by xntpd parse refclocks
67 # tty* general purpose serial ports
68 # cua* dialout serial ports
69 # ttyA* Specialix SI/XIO dialin ports ('*' = number of devices)
70 # cuaA* Specialix SI/XIO dialout ports
71 # ttyD* Digiboard - 16 dialin ports
72 # cuaD* Digiboard - 16 dialout ports
73 # ttyR* Rocketport dialin ports
74 # cuaR* Rocketport dialout ports
77 # pty* set of 32 master and slave pseudo terminals
78 # vty* virtual terminals using syscons/pcvt/codrv console
82 # ppi* Parallel port i/o
83 # pps* Pulse per second timing interface
84 # pcfclock* Parallel time sync interface
91 # usb* USB bus control device
92 # uhid* Human Interface Device (HID)
95 # ugen* generic USB device
96 # urio* Diamond Rio 500
97 # usio* USB serial devices
99 # SCSI devices (other than CD-ROM, tape and disk):
100 # ch* SCSI Media-Changer (juke box) driver
102 # pt* Processor Type (HP scanner, as one example)
103 # pass* CAM Passthrough device
104 # ses* SES (SCSI Environmental Services) and
105 # SAF-TE (Scsi Accessable Fault-Tolerant Enclosures) device
107 # PC-CARD (previously called PCMCIA) support
108 # card* PC-CARD slots
111 # i4b isdnd call control device
112 # i4bctl debugging control device
113 # i4btrc* trace data interface(s), one per passive card
114 # i4btel* telephony interface(s)
115 # i4bteld* telephony dialout interface(s)
116 # i4brbch* raw b channel access device(s)
118 # Special purpose devices:
119 # apm Advanced Power Management BIOS
120 # apmctl APM BIOS control device
123 # tw* xten power controller
124 # snd* various sound cards
125 # pcaudio PCM audio driver
126 # socksys iBCS2 socket system driver
127 # vat VAT compatibility audio driver (requires snd*)
128 # gsc Genius GS-4500 hand scanner
130 # tun* Tunneling IP device
131 # tap* Ethernet Tunneling device
132 # snp* tty snoop devices
133 # spigot Video Spigot video acquisition card
134 # ctx* Cortex-I video acquisition card
135 # meteor* Matrox Meteor video acquisition card (pci)
136 # bktr* Bt848 based video acquisition card (pci)
137 # labpc* National Instrument's Lab-PC and LAB-PC+
138 # perfmon CPU performance-monitoring counters
139 # pci PCI configuration-space access from user mode
140 # ipl ipfilter control devices (ipl, ipnat, ipstate, ipauth)
141 # kbd keyboard devices
142 # 3dfx* 3dfx voodoo device for glide (tdfx), links 3dfx to 3dfx#
143 # agpgart AGP interface
146 if [ -n "$MAKEDEVPATH" ]; then
153 # Usage: die exitcode msg
159 # Convert integer to partition name
164 0) p=a;; 1) p=b;; 2) p=c;; 3) p=d;; 4) p=e;; 5) p=f;; 6) p=g;; 7) p=h;;
170 # Convert integer to slice name
182 # Convert disk (type, unit, slice, partition) to minor number
185 echo $(($1 << 25 | ($2 / 32) << 21 | ($2 % 32) << 3 | $3 << 16 | $4))
188 # Override mknod(2) to add extra handling to it.
192 4) /sbin/mknod "$@" root:wheel || die 2 "/sbin/mknod $@ failed";;
193 5) /sbin/mknod "$@" || die 2 "/sbin/mknod $@ failed";;
194 *) die 2 "bad node: mknod $@";;
198 # Convert tape (ctrl, unit, mode, access) to minor number
201 echo $(($1 << 29 | ($2 / 16) << 16 | ($2 % 16) << 4 | $3 << 2 | $4))
204 # Convert the last character of a tty name to a minor number.
209 a) m=10;; b) m=11;; c) m=12;; d) m=13;; e) m=14;; f) m=15;; g) m=16;;
210 h) m=17;; i) m=18;; j) m=19;; k) m=20;; l) m=21;; m) m=22;; n) m=23;;
211 o) m=24;; p) m=25;; q) m=26;; r) m=27;; s) m=28;; t) m=29;; u) m=30;;
218 # Raw partition for disks
221 # Compatibility slice for disks
224 # Raw slice for disks
228 disk_umask=037 # allow group operator to read disks
229 tape_umask=017 # allow group operator to read/write tapes
235 sh MAKEDEV std # standard
236 sh MAKEDEV fd0 fd1 # bdev, floppy disk
237 sh MAKEDEV da0 da1 da2 da3 # bdev, SCSI disk
238 sh MAKEDEV ad0 ad1 ad2 ad3 # bdev, ATA disk
239 sh MAKEDEV acd0 afd0 ast0 # bdev, ATAPI devices
240 sh MAKEDEV wd0 wd1 wd2 wd3 # bdev, OLD disk
241 sh MAKEDEV wcd0 wfd0 wst0 # bdev, OLD ATAPI devs
242 sh MAKEDEV vn0 # bdev, virtual disk
243 sh MAKEDEV cd0 matcd0 mcd0 scd0 # bdev, cdrom
244 sh MAKEDEV sa0 wt0 # bdev, tape
245 sh MAKEDEV vty12 # cdev, virtual tty
246 sh MAKEDEV cuaa0 cuaa1 cuaa2 cuaa3 # cdev, serial tty
247 sh MAKEDEV pty0 # cdev, pseudo tty
248 sh MAKEDEV ttyd0 ttyd1 ttyd2 ttyd3 # cdev, serial tty
249 sh MAKEDEV kbd0 kbd1 # cdev, keyboard
250 sh MAKEDEV mse0 psm0 sysmouse # cdev, mouse
251 sh MAKEDEV pcaudio speaker # cdev, noise
252 sh MAKEDEV lpt0 lpt1 lpt2 # cdev, printer
253 sh MAKEDEV ppi0 ppi1 ppi2 # cdev, parallel port
254 sh MAKEDEV iic0 iic1 # cdev, I2C device
255 sh MAKEDEV smb0 smb1 # cdev, SMBus device
256 sh MAKEDEV usb usb0 uhid0 ums0 ulpt0 ugen0 # cdev, USB devices
257 sh MAKEDEV urio0 # cdev, USB devices too
258 sh MAKEDEV bpf0 bpf1 bpf2 bpf3 # cdev, network
259 sh MAKEDEV ipl tun0 tun1 tun2 tun3 # cdev, network
260 sh MAKEDEV tap0 tap1 tap2 tap3 # cdev, network
261 sh MAKEDEV ch0 perfmon tw0 # cdev, miscellaneous
262 sh MAKEDEV apm apmctl card0 card1 card2 card3 # cdev, laptop
263 sh MAKEDEV pass4 xpt2 # cdev, CAM
264 sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN
265 sh MAKEDEV i4btel0 i4btel1 i4bteld0 i4bteld1 # cdev, ISDN
266 sh MAKEDEV i4brbch0 i4brbch1 # cdev, ISDN
267 sh MAKEDEV agpgart # cdev, AGP
270 # a much restricted set of the above, to save precious i-nodes on the
273 sh MAKEDEV std # standard
274 sh MAKEDEV fd0 # bdev, floppy disk
275 sh MAKEDEV da0 # bdev, SCSI disk
276 sh MAKEDEV ad0 # bdev, ATA disk
277 sh MAKEDEV acd0 afd0 ast0 # bdev, ATAPI devices
278 sh MAKEDEV wd0 # bdev, OLD disk
279 sh MAKEDEV wcd0 wfd0 wst0 # bdev, OLD ATAPI devs
280 sh MAKEDEV vn0 # bdev, virtual disk
281 sh MAKEDEV cd0 # bdev, cdrom
282 sh MAKEDEV sa0 # bdev, tape
283 sh MAKEDEV vty2 # cdev, virtual tty
284 sh MAKEDEV cuaa0 # cdev, serial tty
285 sh MAKEDEV pty0 # cdev, pseudo tty
286 sh MAKEDEV ttyd0 # cdev, serial tty
287 sh MAKEDEV kbd0 # cdev, keyboard
288 sh MAKEDEV mse0 psm0 sysmouse # cdev, mouse
289 sh MAKEDEV lpt0 # cdev, printer
290 sh MAKEDEV ppi0 # cdev, parallel port
291 sh MAKEDEV iic0 # cdev, I2C device
292 sh MAKEDEV smb0 # cdev, SMBus device
293 sh MAKEDEV ums0 # cdev, USB devices
294 sh MAKEDEV tun0 # cdev, network
295 sh MAKEDEV tap0 # cdev, network
296 sh MAKEDEV ch0 # cdev, miscellaneous
297 sh MAKEDEV apm apmctl card0 # cdev, laptop
298 sh MAKEDEV pass1 xpt1 # cdev, CAM
299 sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN
300 sh MAKEDEV i4btel0 i4bteld0 # cdev, ISDN
301 sh MAKEDEV i4brbch0 # cdev, ISDN
306 mknod console c 0 0; chmod 600 console
307 mknod kmem c 2 1 root:kmem; chmod 640 kmem
308 mknod mem c 2 0 root:kmem; chmod 640 mem
309 mknod null c 2 2; chmod 666 null
310 mknod random c 2 3; chmod 644 random
312 mknod zero c 2 12; chmod 666 zero
313 mknod io c 2 14; chmod 600 io
314 mknod tty c 1 0; chmod 666 tty
315 mknod klog c 7 0; chmod 600 klog
316 mknod pci c 78 0; chmod 644 pci
319 while [ $i -lt 64 ]; do
333 rm mem kmem pci io klog console # for security
334 ln -sf null mem # for libkvm (ab)users
335 ln -sf null kmem # --//--
344 mknod timezone c 26 0
347 # Create device files for new Archive/Wangtek QIC-02 tape driver (vak)
350 u=`expr $i : '..\(.*\)'`
351 if [ -z "${u}" ]; then u=0; fi
352 # default density, 512b blocks
353 mknod rwt${u} c 10 `expr 0 + $u` root:operator
354 mknod nrwt${u} c 10 `expr 4 + $u` root:operator
355 # default density, 1024b blocks
356 # mknod rWt${u} c 10 `expr 64 + $u` root:operator
357 # mknod nrWt${u} c 10 `expr 68 + $u` root:operator
358 mknod rwt${u}b c 10 `expr 16 + $u` root:operator # 60 megabytes
359 mknod nrwt${u}b c 10 `expr 20 + $u` root:operator
360 mknod rwt${u}c c 10 `expr 24 + $u` root:operator # 120 megabytes
361 mknod nrwt${u}c c 10 `expr 28 + $u` root:operator
362 mknod rwt${u}d c 10 `expr 32 + $u` root:operator # 150 megabytes
363 mknod nrwt${u}d c 10 `expr 36 + $u` root:operator
364 # mknod rwt${u}e c 10 `expr 40 + $u` root:operator # 300 megabytes?
365 # mknod nrwt${u}e c 10 `expr 44 + $u` root:operator
366 # mknod rwt${u}f c 10 `expr 48 + $u` root:operator # 600 megabytes?
367 # mknod nrwt${u}f c 10 `expr 52 + $u` root:operator
372 ad*s*|afd*s*|amrd*s*|da*s*|fla*s*|idad*s*|md*s*|mlxd*s*|twed*s*|vn*s*|wd*s*|wfd*s*)
375 ad*s*) name=ad; chr=116;;
376 afd*s*) name=afd; chr=118;;
377 amrd*s*) name=amrd; chr=133;;
378 da*s*) name=da; chr=13;;
379 fla*s*) name=fla; chr=102;;
380 idad*s*) name=idad; chr=109;;
381 md*s*) name=md; chr=95;;
382 mlxd*s*) name=mlxd; chr=131;;
383 twed*s*) name=twed; chr=147;;
384 vn*s*) name=vn; chr=43;;
385 wd*s*) name=wd; chr=3;;
386 wfd*s*) name=wfd; chr=87;;
389 amrd*s*|idad*s*|mlxd*s*|twed*s*)
390 unit=`expr $i : '....\([0-9]*\)s'`
391 slice=`expr $i : '....[0-9]*s\([0-9]*\)'`
392 part=`expr $i : '....[0-9]*s[0-9]*\(.*\)'`
394 afd*s*|fla*s*|wfd*s*)
395 unit=`expr $i : '...\([0-9]*\)s'`
396 slice=`expr $i : '...[0-9]*s\([0-9]*\)'`
397 part=`expr $i : '...[0-9]*s[0-9]*\(.*\)'`
400 unit=`expr $i : '..\([0-9]*\)s'`
401 slice=`expr $i : '..[0-9]*s\([0-9]*\)'`
402 part=`expr $i : '..[0-9]*s[0-9]*\(.*\)'`
406 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
411 slicename=`dkitos $slice`
412 minor=`dkminor 0 $unit $slice $dkrawpart`
413 mknod $name$unit$slicename c $chr $minor root:operator
414 ln -f $name$unit$slicename r$name$unit$slicename
418 0) slice=$oldslice ;;
420 for part in 0 1 2 3 4 5 6 7
422 minor=`dkminor 0 $unit $slice $part`
423 partname=`dkitop $part`
424 mknod $name$unit$slicename$partname \
425 c $chr $minor root:operator
426 ln -f $name$unit$slicename$partname \
427 r$name$unit$slicename$partname
433 echo bad partition for disk in: $i
438 echo bad slice for disk in: $i
443 echo bad unit for disk in: $i "(unit=$unit, slice=$slice, part=$part)"
451 unit=`expr $i : '..\(.*\)'`
455 mknod ${name}${unit} c $chr `expr $unit '*' 64` root:operator
456 ln -f ${name}${unit} r${name}${unit}
457 # Fake BSD partitions
458 for i in a b c d e f g h
460 ln -f ${name}${unit} ${name}${unit}$i
461 ln -f r${name}${unit} r${name}${unit}$i
463 # User-readable and programmer-readable name sets
465 mknod ${name}${unit}.1720 c $chr `expr $unit '*' 64 + 1` \
467 ln -f ${name}${unit}.1720 r${name}${unit}.1720
468 # ln -f ${name}${unit}.1720 ${name}${unit}135hs21
469 # ln -f r${name}${unit}.1720 r${name}${unit}135hs21
471 mknod ${name}${unit}.1480 c $chr `expr $unit '*' 64 + 2` \
473 ln -f ${name}${unit}.1480 r${name}${unit}.1480
474 # ln -f ${name}${unit}.1480 ${name}${unit}135hs18
475 # ln -f r${name}${unit}.1480 r${name}${unit}135hs18
476 # ln -f ${name}${unit}.1480 ${name}${unit}96hs18
477 # ln -f r${name}${unit}.1480 r${name}${unit}96hs18
479 mknod ${name}${unit}.1440 c $chr `expr $unit '*' 64 + 3` \
481 ln -f ${name}${unit}.1440 r${name}${unit}.1440
482 # ln -f ${name}${unit}.1440 ${name}${unit}135
483 # ln -f r${name}${unit}.1440 r${name}${unit}135
484 # ln -f ${name}${unit}.1440 ${name}${unit}135ds18
485 # ln -f r${name}${unit}.1440 r${name}${unit}135ds18
486 # ln -f ${name}${unit}.1440 ${name}${unit}96ds18
487 # ln -f r${name}${unit}.1440 r${name}${unit}96ds18
489 mknod ${name}${unit}.1200 c $chr `expr $unit '*' 64 + 4` \
491 ln -f ${name}${unit}.1200 r${name}${unit}.1200
492 # ln -f ${name}${unit}.1200 ${name}${unit}96
493 # ln -f r${name}${unit}.1200 r${name}${unit}96
494 # ln -f ${name}${unit}.1200 ${name}${unit}96ds15
495 # ln -f r${name}${unit}.1200 r${name}${unit}96ds15
496 # ln -f ${name}${unit}.1200 ${name}${unit}135ds15
497 # ln -f r${name}${unit}.1200 r${name}${unit}135ds15
499 mknod ${name}${unit}.820 c $chr `expr $unit '*' 64 + 5` \
501 ln -f ${name}${unit}.820 r${name}${unit}.820
502 # ln -f ${name}${unit}.820 ${name}${unit}96hs10
503 # ln -f r${name}${unit}.820 r${name}${unit}96hs10
504 # ln -f ${name}${unit}.820 ${name}${unit}135hs10
505 # ln -f r${name}${unit}.820 r${name}${unit}135hs10
507 mknod ${name}${unit}.800 c $chr `expr $unit '*' 64 + 6` \
509 ln -f ${name}${unit}.800 r${name}${unit}.800
510 # ln -f ${name}${unit}.800 ${name}${unit}96ds10
511 # ln -f r${name}${unit}.800 r${name}${unit}96ds10
512 # ln -f ${name}${unit}.800 ${name}${unit}135ds10
513 # ln -f r${name}${unit}.800 r${name}${unit}135ds10
515 mknod ${name}${unit}.720 c $chr `expr $unit '*' 64 + 7` \
517 ln -f ${name}${unit}.720 r${name}${unit}.720
518 # ln -f ${name}${unit}.720 ${name}${unit}96ds9
519 # ln -f r${name}${unit}.720 r${name}${unit}96ds9
520 # ln -f ${name}${unit}.720 ${name}${unit}135ds9
521 # ln -f r${name}${unit}.720 r${name}${unit}135ds9
523 mknod ${name}${unit}.360 c $chr `expr $unit '*' 64 + 8` \
525 ln -f ${name}${unit}.360 r${name}${unit}.360
526 # ln -f ${name}${unit}.360 ${name}${unit}48
527 # ln -f r${name}${unit}.360 r${name}${unit}48
528 # ln -f ${name}${unit}.360 ${name}${unit}48ds9
529 # ln -f r${name}${unit}.360 r${name}${unit}48ds9
531 mknod ${name}${unit}.640 c $chr `expr $unit '*' 64 + 9` \
533 ln -f ${name}${unit}.640 r${name}${unit}.640
534 # ln -f ${name}${unit}.640 ${name}${unit}96ds8
535 # ln -f r${name}${unit}.640 r${name}${unit}96ds8
536 # ln -f ${name}${unit}.640 ${name}${unit}135ds8
537 # ln -f r${name}${unit}.640 r${name}${unit}135ds8
539 mknod ${name}${unit}.1232 c $chr `expr $unit '*' 64 + 10` \
541 ln -f ${name}${unit}.1232 r${name}${unit}.1232
542 # ln -f ${name}${unit}.1232 ${name}${unit}96ds8
543 # ln -f r${name}${unit}.1232 r${name}${unit}96ds8
544 # ln -f ${name}${unit}.1232 ${name}${unit}135ds8
545 # ln -f r${name}${unit}.1232 r${name}${unit}135ds8
548 echo bad unit for disk in: $i
554 ad*|afd*|amrd*|da*|fla*|idad*|md*|mlxd*|twed*|vn*|wd*|wfd*)
557 ad*) name=ad; chr=116;;
558 afd*) name=afd; chr=118;;
559 amrd*) name=amrd; chr=133;;
560 da*) name=da; chr=13;;
561 fla*) name=fla; chr=102;;
562 idad*) name=idad; chr=109;;
563 md*) name=md; chr=95;;
564 mlxd*) name=mlxd; chr=131;;
565 twed*) name=twed; chr=147;;
566 vn*) name=vn; chr=43;;
567 wd*) name=wd; chr=3;;
568 wfd*) name=wfd; chr=87;;
571 amrd*|idad*|mlxd*|twed*)
572 unit=`expr $i : '....\(.*\)'`
575 unit=`expr $i : '...\(.*\)'`
578 unit=`expr $i : '..\(.*\)'`
582 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
583 for slicepartname in s0h s1 s2 s3 s4
585 sh MAKEDEV $name$unit$slicepartname
589 echo bad unit for disk in: $i
599 unit=`expr $i : '...\(.*\)'`
601 [0-9]|[0-9][0-9]|[0-4][0-9][0-9]|50[0-9]|51[0-1])
602 for part in 0 1 2 3 4 5 6 7
604 minor=`dkminor 0 $unit 0 $part`
605 partname=`dkitop $part`
606 mknod $name$unit$partname c $chr $minor root:operator
607 ln -f $name$unit$partname r$name$unit$partname
611 echo bad unit for disk in: $i
617 # SCSI processor type driver
621 unit=`expr $i : 'pt\([0-9][0-9]*\)'`
622 if [ -z "${unit}" ]; then
625 unit=`expr $unit + 1 - 1`
626 mknod ${name}${unit} c $chr $unit
629 # SCSI SES/SAF-TE type driver
633 unit=`expr $i : 'ses\([0-9][0-9]*\)'`
634 if [ -z "${unit}" ]; then
637 unit=`expr $unit + 1 - 1`
638 mknod ${name}${unit} c $chr $unit
640 # SCSI target mode sample driver
644 unit=`expr $i : 'targ\([0-9][0-9]*\)'`
645 if [ -z "${unit}" ]; then
648 unit=`expr $unit + 1 - 1`
649 mknod ${name}${unit} c $chr $unit
650 mknod ${name}.ctl c $chr 0xffff00ff
653 # CAM transport layer device
655 # This major number is temporary
658 units=`expr $i : 'xpt\(.*\)'`
659 if [ -z "${units}" ]; then
663 while [ $i -lt $units ]; do
665 rm -rf $dname r$dname
666 mknod $dname c $chr $i root:operator
671 # CAM passthrough device
673 # This major number is temporary
676 units=`expr $i : 'pass\(.*\)'`
677 if [ -z "${units}" ]; then
681 while [ $i -lt $units ]; do
683 rm -rf $dname r$dname
684 mknod $dname c $chr $i root:operator
689 class=`expr $i : 'pty\(.*\)'`
692 1) offset=32 name=q;;
693 2) offset=64 name=r;;
694 3) offset=96 name=s;;
695 # Note that xterm (at least) only look at p-s.
696 4) offset=128 name=P;;
697 5) offset=160 name=Q;;
698 6) offset=192 name=R;;
699 7) offset=224 name=S;;
700 # This still leaves [tuTU].
701 *) echo bad unit for pty in: $i;;
707 while [ $i -lt 32 ]; do
708 # This was an awk substr() before.
709 c=$(echo 0123456789abcdefghijklmnopqrstuv |
710 dd bs=1 skip=$i count=1 2>/dev/null)
711 mknod tty$name$c c 5 $(($offset + $i))
712 mknod pty$name$c c 6 $(($offset + $i))
722 unit=`expr $i : '..\(.*\)'`
726 [0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9])
727 mknod sa${unit}.ctl c $chr `saminor 1 ${unit} 0 0`
728 ln -f sa${unit}.ctl rsa${unit}.ctl
731 mknod sa${unit}.${m} c $chr \
732 `saminor 0 ${unit} ${m} 0` root:operator
733 ln -f sa${unit}.${m} rsa${unit}.${m}
734 mknod nsa${unit}.${m} c $chr \
735 `saminor 0 ${unit} ${m} 1` root:operator
736 ln -f nsa${unit}.${m} nrsa${unit}.${m}
737 mknod esa${unit}.${m} c $chr \
738 `saminor 0 ${unit} ${m} 2` root:operator
739 ln -f esa${unit}.${m} ersa${unit}.${m}
741 ln -f sa${unit}.0 sa${unit}
742 ln -f sa${unit}.0 rsa${unit}.0
743 ln -f sa${unit}.0 rsa${unit}
744 ln -f nsa${unit}.0 nsa${unit}
745 ln -f nsa${unit}.0 nrsa${unit}.0
746 ln -f nsa${unit}.0 nrsa${unit}
747 ln -f esa${unit}.0 esa${unit}
748 ln -f esa${unit}.0 ersa${unit}.0
749 ln -f esa${unit}.0 ersa${unit}
752 echo bad unit for tape in: $i
760 unit=`expr $i : '..\(.*\)'`
762 ch*) name=ch; chr=17;;
766 mknod ${name}${unit} c $chr $unit root:operator
769 echo bad unit for media changer in: $i
777 unit=`expr $i : '...\(.*\)'`
781 mknod rast${unit} c $chr `expr $unit '*' 8 + 0` root:operator
782 chmod 640 rast${unit}
783 mknod nrast${unit} c $chr `expr $unit '*' 8 + 1` root:operator
784 chmod 640 nrast${unit}
787 echo bad unit for tape in: $i
796 acd*) units=`expr $i : '...\(.*\)'`; name=acd; chr=117;;
797 cd*) units=`expr $i : '..\(.*\)'`; name=cd; chr=15;;
798 mcd*) units=`expr $i : '...\(.*\)'`; name=mcd; chr=29;;
799 scd*) units=`expr $i : '...\(.*\)'`; name=scd; chr=45;;
801 if [ -z "${units}" -o "${units}" -le 0 ]; then
804 if [ "${units}" -le 31 ]; then
806 while [ $i -le $units ]; do
808 rm -rf ${dname}* r${dname}*
809 mknod ${dname}a c $chr $(($i * 8)) root:operator
810 mknod ${dname}c c $chr $(($i * 8 + 2)) root:operator
811 ln -f ${dname}a r${dname}a
812 ln -f ${dname}c r${dname}c
816 echo "$i is invalid -- can't have more than 32 cd devices"
824 matcd*) unit=`expr $i : '.....\(.*\)'`; name=matcd; chr=46;;
827 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15)
828 mknod ${name}${unit}a c $chr `expr $unit '*' 8 + 0` \
830 mknod ${name}${unit}c c $chr `expr $unit '*' 8 + 2` \
832 ln -f ${name}${unit}a r${name}${unit}a
833 ln -f ${name}${unit}c r${name}${unit}c
834 chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
836 mknod ${name}${unit}la c $chr `expr $unit '*' 8 + 128` \
838 mknod ${name}${unit}lc c $chr `expr $unit '*' 8 + 130` \
840 ln -f ${name}${unit}la r${name}${unit}la
841 ln -f ${name}${unit}lc r${name}${unit}lc
842 chmod 640 ${name}${unit}l[a-h] r${name}${unit}l[a-h]
845 echo bad unit for disk in: $i
853 unit=`expr $i : '...\(.*\)'`
857 mknod wcd${unit}a c $chr `expr $unit '*' 8 + 0` root:operator
858 mknod wcd${unit}c c $chr `expr $unit '*' 8 + 2` root:operator
859 ln -f wcd${unit}a rwcd${unit}a
860 ln -f wcd${unit}c rwcd${unit}c
861 chmod 640 wcd${unit}[a-h] rwcd${unit}[a-h]
864 echo bad unit for disk in: $i
872 unit=`expr $i : '...\(.*\)'`
876 mknod rwst${unit} c $chr `expr $unit '*' 8 + 0` root:operator
877 chmod 640 rwst${unit}
884 unit=`expr $i : 'iic\(.*\)'`
885 mknod iic$unit c 105 $unit
889 unit=`expr $i : 'smb\(.*\)'`
890 mknod smb$unit c 106 $unit
894 unit=`expr $i : 'pcfclock\(.*\)'`
895 mknod pcfclock$unit c 140 $unit
899 unit=`expr $i : 'ppi\(.*\)'`
900 mknod ppi$unit c 82 $unit
904 unit=`expr $i : 'pps\(.*\)'`
905 mknod pps$unit c 89 $unit
909 mknod usb$unit c 108 255 root:operator
914 unit=`expr $i : 'usb\(.*\)'`
915 mknod usb$unit c 108 $unit root:operator
920 unit=`expr $i : 'uhid\(.*\)'`
921 mknod uhid$unit c 122 $unit
925 unit=`expr $i : 'ums\(.*\)'`
926 mknod ums$unit c 111 $unit
930 unit=`expr $i : 'ulpt\(.*\)'`
932 mknod ulpt$unit c 113 $minor
933 minor=`expr $unit + 64`
934 mknod unlpt$unit c 113 $minor # and the 'no prime' version
938 unit=`expr $i : 'ugen\([0-9][0-9]*\)'`
939 endpoint=`expr $i : 'ugen.*\.\([0-9][0-9]*\)'`
940 if [ -z "${unit}" ]; then
941 echo $i - Invalid unit number
943 if [ -z "${endpoint}" ]; then # ugen0 & ugen0.1 - ugen0.15
944 mknod ugen$unit c 114 $(($unit * 16))
946 while [ $i -lt 16 ]; do
947 mknod ugen$unit.$i c 114 $(($unit * 16 + $i))
951 minor=$(($unit * 16 + $endpoint))
952 mknod ugen$unit.$endpoint c 114 $minor
957 unit=`expr $i : 'urio\(.*\)'`
958 mknod urio$unit c 143 $unit
962 unit=`expr $i : 'usio\(.*\)'`
963 minor=$(($minor + 128))
964 mknod usio$unit c 138 $minor
968 unit=`expr $i : 'lpt\(.*\)'`
969 mknod lpt$unit c 16 $unit
970 mknod lpctl$unit c 16 `expr $unit + 128`
974 unit=`expr $i : 'tw\(.*\)'`
975 mknod tw$unit c 19 $unit root:operator
978 # Use this to create virtual consoles for syscons, pcvt or codrv
980 # use as MAKEDEV vtyNN to create NN entries
983 units=`expr $i : 'vty\(.*\)'`
985 while [ $i -lt $units ]; do
986 mknod ttyv$(printf %01x $i) c $chr $i
989 ln -fs ttyv0 vga # XXX X still needs this pccons relic
993 nbpf=`expr $i : 'bpf\(.*\)$'`
995 while [ $unit -le $nbpf ]; do
996 mknod bpf$unit c 23 $unit
1002 mknod speaker c 26 0
1007 unit=`expr $i : 'cua.*\(.\)$'`
1009 mknod cuaa$unit c 28 `expr $m + 128` uucp:dialer
1010 mknod cuaia$unit c 28 `expr $m + 32 + 128` uucp:dialer
1011 mknod cuala$unit c 28 `expr $m + 64 + 128` uucp:dialer
1016 unit=`expr $i : 'tty.*\(.\)$'`
1018 mknod ttyd$unit c 28 $m
1019 mknod ttyid$unit c 28 `expr $m + 32`
1020 mknod ttyld$unit c 28 `expr $m + 64`
1025 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1026 g h i j k l m n o p q r s t u v"
1028 card=`expr $i : 'cua.*\(.\)$'`
1029 for unit in $portlist
1031 minor=`ttyminor $unit`
1032 minor=`expr $card \* 65536 + $minor`
1034 mknod cuac$name c $major `expr $minor + 128` uucp:dialer
1035 mknod cuaic$name c $major `expr $minor + 32 + 128` uucp:dialer
1036 mknod cualc$name c $major `expr $minor + 64 + 128` uucp:dialer
1042 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f
1043 g h i j k l m n o p q r s t u v"
1045 card=`expr $i : 'tty.*\(.\)$'`
1046 for unit in $portlist
1048 minor=`ttyminor $unit`
1049 minor=`expr $card \* 65536 + $minor`
1051 mknod ttyc$name c $major $minor
1052 mknod ttyic$name c $major `expr $minor + 32`
1053 mknod ttylc$name c $major `expr $minor + 64`
1057 # RISCom8 'rc' driver entries
1061 unit=`expr $i : 'cua.*\(.\)$'`
1063 mknod cuam$unit c 63 `expr $m + 128` uucp:dialer
1068 unit=`expr $i : 'tty.*\(.\)$'`
1070 mknod ttym$unit c 63 $m
1074 # Note: these are 'base 1' to match the numbers on the panels, and to match
1075 # the manual that comes with the system.
1078 nports=`expr $i : 'ttyA\(.*\)$'`
1080 while [ $port -le $nports ]; do
1081 minor=$(expr $port - 1)
1082 name=$(printf %02d $port)
1083 mknod ttyA$name c $major $minor
1084 mknod ttyiA$name c $major `expr $minor + 65536`
1085 mknod ttylA$name c $major `expr $minor + 131072`
1088 # For the user-mode control program, 'sicontrol'
1089 mknod si_control c 68 262144
1095 nports=`expr $i : 'cuaA\(.*\)$'`
1097 while [ $port -le $nports ]; do
1098 minor=$(expr $port - 1)
1099 name=$(printf %02d $port)
1100 mknod cuaA$name c $major `expr $minor + 128` uucp:dialer
1101 mknod cuaiA$name c $major `expr $minor + 128 + 65536` \
1103 mknod cualA$name c $major `expr $minor + 128 + 131072` \
1110 # Digiboard PC/?? 16 port card.
1111 # The current scheme of minor numbering is:
1113 # unused{14} CARD{2} major{8} CALLOUT{1} LOCK{1} INIT{1} PORT{5}
1115 # CARD bitfield in future versions may be extended to 3 bits.
1120 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1122 card=`expr $i : 'tty.*\(.\)$'`
1123 for unit in $portlist
1125 minor=`ttyminor $unit`
1126 minor=`expr $card \* 65536 + $minor`
1128 mknod ttyD$name c $major $minor
1129 mknod ttyiD$name c $major `expr $minor + 32`
1130 mknod ttylD$name c $major `expr $minor + 64`
1136 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1138 card=`expr $i : 'cua.*\(.\)$'`
1139 for unit in $portlist
1141 minor=`ttyminor $unit`
1142 minor=`expr $card \* 65536 + $minor`
1144 mknod cuaD$name c $major `expr $minor + 128` uucp:dialer
1145 mknod cuaiD$name c $major `expr $minor + 32 + 128` uucp:dialer
1146 mknod cualD$name c $major `expr $minor + 64 + 128` uucp:dialer
1152 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1153 modulelist="a b c d"
1155 card=`expr $i : 'tty.*\(.\)$'`
1156 for unit in $modulelist
1158 moduleminor=`ttyminor $unit`
1159 moduleminor=`expr $moduleminor % 10 \* 16`
1162 for unit in $portlist
1164 minor=`ttyminor $unit`
1165 minor=`expr $card \* 65536 + $minor + $moduleminor`
1166 name=$card$modulename$unit
1168 mknod ttyM$name c $major $minor
1169 mknod ttyiM$name c $major `expr $minor + 64`
1170 mknod ttylM$name c $major `expr $minor + 128`
1177 portlist="0 1 2 3 4 5 6 7 8 9 a b c d e f"
1178 modulelist="a b c d"
1180 card=`expr $i : 'cua.*\(.\)$'`
1181 for unit in $modulelist
1183 moduleminor=`ttyminor $unit`
1184 moduleminor=`expr $moduleminor % 10 \* 16`
1187 for unit in $portlist
1189 minor=`ttyminor $unit`
1190 minor=`expr $card \* 65536 + $minor + $moduleminor`
1191 name=$card$modulename$unit
1193 mknod cuaM$name c $major `expr $minor + 262144` \
1195 mknod cuaiM$name c $major `expr $minor + 64 + 262144` \
1197 mknod cualM$name c $major `expr $minor + 128 + 262144` \
1207 MINOR=$(($BOARD * 65536))
1209 dmesg | while read first rest; do
1217 rm -f /dev/ttyR* /dev/ttyiR* /dev/ttylR*
1218 for i in $controllers; do
1220 dmesg | while read first bar ports rest; do
1228 echo -n "Creating $ndevices devices for $i: "
1230 while [ $dev -lt $ndevices ]; do
1231 mknod /dev/ttyR$Rnum c $major $MINOR
1232 mknod /dev/ttyiR$Rnum c $major $(($MINOR + 32))
1233 mknod /dev/ttylR$Rnum c $major $(($MINOR + 64))
1235 MINOR=$(($MINOR + 1))
1238 BOARD=$(($BOARD + 1))
1239 MINOR=$(($BOARD * 65536))
1247 MINOR=$(($BOARD * 65536))
1249 dmesg | while read first rest; do
1257 rm -f /dev/cuaR* /dev/cuaiR* /dev/cualR*
1258 for i in $controllers; do
1260 dmesg | while read first bar ports rest; do
1268 echo -n "Creating $ndevices devices for $i: "
1270 while [ $dev -lt $ndevices ]; do
1271 mknod /dev/cuaR$Rnum c $major $(($MINOR + 128)) uucp:dialer
1272 mknod /dev/cuaiR$Rnum c $major $(($MINOR + 128 + 32)) \
1274 mknod /dev/cualR$Rnum c $major $(($MINOR + 128 + 64)) \
1277 MINOR=$(($MINOR + 1))
1280 BOARD=$(($BOARD + 1))
1281 MINOR=$(($BOARD * 65536))
1287 unit=`expr $i : 'mse\(.*\)'`
1289 mknod mse$unit c $chr `expr $unit '*' 2 + 1` # non-blocking for X11
1293 unit=`expr $i : 'psm\(.*\)'`
1295 mknod psm$unit c $chr `expr $unit '*' 2 + 1` # non-blocking for X11
1299 name=`expr $i : 'mouse\(.*\)'`
1300 if [ ! -c $name ]; then
1301 $0 $name # make the appropriate device
1307 mknod pcaudio c 24 0
1308 mknod pcaudioctl c 24 128
1312 mknod socksys c 41 0
1315 chmod 666 socksys nfsd spx
1320 # changes from Linux voxware
1321 # minor Linux FreeBSD
1322 # 8 sequencer2 (aka music0) music0
1323 # 17 patmgr0 sequencer1
1324 # 33 patmgr1 sequencer2
1327 unit=`expr $i : 'snd\(.*\)'`
1330 # XXX write this less verbosely, like std
1331 snd_security_hole=0 # XXX
1332 umask $snd_security_hole
1334 ln -fs mixer$unit mixer
1335 ln -fs sequencer$unit sequencer
1337 ln -fs audio$unit audio
1338 ln -fs dspW$unit dspW
1339 ln -fs music$unit music
1342 mknod mixer$unit c $chr `expr $unit '*' 16 + 0`
1343 mknod sequencer$unit c $chr `expr $unit '*' 16 + 1`
1344 mknod midi$unit c $chr `expr $unit '*' 16 + 2`
1345 mknod dsp$unit c $chr `expr $unit '*' 16 + 3`
1346 mknod audio$unit c $chr `expr $unit '*' 16 + 4`
1347 mknod dspW$unit c $chr `expr $unit '*' 16 + 5`
1348 mknod sndstat c $chr 6
1349 # minor number 7 is unused
1350 mknod music$unit c $chr `expr $unit '*' 16 + 8`
1351 mknod pss$unit c $chr `expr $unit '*' 16 + 9`
1352 # minor number 10 is unused
1353 mknod midistat c $chr 11
1354 # minor numbers 12-15 are unused
1359 mknod vatio c 25 128
1364 unit=`expr $i : 'gsc\(.*\)'`
1365 mknod gsc${unit} c 47 $unit
1366 mknod gsc${unit}p c 47 $(($unit + 8))
1367 mknod gsc${unit}d c 47 $(($unit + 32))
1368 mknod gsc${unit}pd c 47 $(($unit + 40))
1369 chmod 666 gsc${unit}*
1373 mknod apm c 39 0 root:operator
1378 mknod apmctl c 39 8 root:operator
1383 unit=`expr $i : 'card\(.*\)'`
1385 mknod card$unit c $chr $unit
1391 *0) unit=0;; *1) unit=1;; *2) unit=2;; *3) unit=3;;
1392 *4) unit=4;; *5) unit=5;; *6) unit=6;; *7) unit=7;;
1393 *8) unit=8;; *9) unit=9;; *a) unit=10;; *b) unit=11;;
1394 *c) unit=12;; *d) unit=13;; *e) unit=14;; *f) unit=15;;
1397 ttyy?) unit=`expr $unit \+ 16`;;
1398 ttyz?) unit=`expr $unit \+ 32`;;
1404 mknod cronyx c 42 63
1408 mknod joy0 c 51 0 root:operator
1409 mknod joy1 c 51 1 root:operator
1419 unit=`expr $i : 'ctx\(.*\)'`
1420 mknod ctx$unit c 40 $unit
1425 unit=`expr $i : 'meteor\(.*\)'`
1426 mknod meteor$unit c 67 $unit
1427 chmod 444 meteor$unit
1431 unit=`expr $i : 'bktr\(.*\)'`
1432 mknod bktr$unit c 92 $unit
1433 mknod tuner$unit c 92 $((16 + $unit ))
1434 mknod vbi$unit c 92 $((32 + $unit ))
1435 chmod 444 bktr$unit tuner$unit vbi$unit
1439 ntun=`expr $i : 'tun\(.*\)$'`
1441 while [ $unit -le $ntun ]; do
1442 mknod tun$unit c 52 $unit uucp:dialer
1448 ntap=`expr $i : 'tap\(.*\)$'`
1450 while [ $unit -le $ntap ]; do
1451 mknod tap$unit c 149 $unit root:network
1457 mknod sysmouse c 12 128
1458 mknod consolectl c 12 255
1462 unit=`expr $i : 'snp\(.*\)'`
1463 mknod snp$unit c 53 $unit
1466 # dufault@hda.com: If I do much more work on other A-D boards
1467 # then eventually we'll have a "ad" and "dio" interface and some of these
1468 # "labpcaio" ones will be gone.
1469 # labpcaio: D-A and A-D.
1470 # labpcdio: Digital in and Digital out.
1477 unit=`expr $i : 'labpcaio\(.*\)'`
1478 all="0 1 2 3 4 5 6 7"
1483 unit=`expr $i : 'labpcdio\(.*\)'`
1488 die 3 "Don't know LabPC type $i"
1491 if [ -z "${unit}" ]; then
1496 mknod $name$unit c 66 `expr $offset + $unit `
1501 mknod $name$i c 66 `expr $offset + $i `
1505 echo "No such LabPC unit: $unit"
1512 mknod perfmon c 2 32 root:kmem
1519 mknod ipstate c 79 2
1524 unit=`expr $i : 'kbd\(.*\)'`
1526 mknod kbd$unit c $chr $unit
1538 unit=`expr $i : 'i4brbch\(.*\)'`
1539 mknod i4brbch$unit c 57 $unit
1544 unit=`expr $i : 'i4bteld\(.*\)'`
1545 mknod i4bteld$unit c 56 `expr $offset + $unit `
1549 unit=`expr $i : 'i4btel\(.*\)'`
1550 mknod i4btel$unit c 56 $unit
1554 unit=`expr $i : 'i4btrc\(.*\)'`
1555 mknod i4btrc$unit c 59 $unit
1559 unit=`expr $i : 'mlx\(.*\)'`
1560 mknod mlx$unit c 130 $unit
1564 unit=`expr $i : '3dfx\(.*\)'`
1565 mknod 3dfx$unit c 107 $unit
1566 ln -sf 3dfx$unit 3dfx
1570 mknod agpgart c 148 0
1574 unit=`expr $i : 'twe\(.*\)'`
1575 mknod twe$unit c 146 $unit
1579 umask 0 # XXX should be elsewhere
1585 echo $i - no such device name