MAKEDEV.mi revision 1.10
1include(MAKEDEV.sub)dnl 2dnl 3vers(a,{-$OpenBSD: MAKEDEV.mi,v 1.10 2002/01/08 00:52:06 todd Exp $-})dnl 4dnl 5divert(1)dnl 6{-#-} 7{-#-} Copyright (c) 2001 Todd T. Fries <todd@OpenBSD.org> 8{-#-} All rights reserved. 9{-#-} 10{-#-} Redistribution and use in source and binary forms, with or without 11{-#-} modification, are permitted provided that the following conditions 12{-#-} are met: 13{-#-} 1. Redistributions of source code must retain the above copyright 14{-#-} notice, this list of conditions and the following disclaimer. 15{-#-} 2. The name of the author may not be used to endorse or promote products 16{-#-} derived from this software without specific prior written permission. 17{-#-} 18{-#-} THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 19{-#-} INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 20{-#-} AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21{-#-} THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22{-#-} EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23{-#-} PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 24{-#-} OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25{-#-} WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26{-#-} OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 27{-#-} ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28{-#-} 29dnl 30dnl Diversions: (upon termination, concatenated output queues) 31dnl 32dnl 0 - very top 33dnl 1 - descriptions of devices 34dnl 2 - init of script, function definitions, etc 35dnl 3 - beginning of global recursive R() function 36dnl 7 - body of MAKEDEV, device creations, etc 37dnl 9 - end 38dnl 39dnl HOW TO ADD A DEVICE: 40dnl 41dnl In this file, you must use at least two macros: 42dnl 43dnl Use '__devitem(uniqueid,name-pattern,description)' to create an entry 44dnl in the description at the top of the generated MAKEDEV file: 45dnl 46dnl __devitem(sca,sca*,Sugar Generic device)dnl 47dnl 48dnl This is ultimately shown as: 49dnl 50dnl # sca* Sugar Generic device 51dnl 52dnl Use '_mkdev(uniqueid,shell-pattern,{-shell-script-})dnl' to create 53dnl a shell script fragment used to 'create' the device (be sure to match 54dnl the uniqueid from above): 55dnl 56dnl _mkdev(sca,sca*,{-M sca$U c major_sca_c $U 57dnl M rsca$U b major_sca_b Add($U,128)-})dnl 58dnl 59dnl This is ultimately expanded into: 60dnl 61dnl sca*) M sca$U c 24 $U 62dnl M sca$U b 42 $(($U+128));; 63dnl 64dnl In the MAKEDEV.md file, add a '_DEV(uniqueid,charmajor,blockmajor)' 65dnl entry: 66dnl 67dnl _DEV(sca,24,42) 68dnl 69dnl Final step is to add an entry to the 'all' entry below. For a short 70dnl example: 71dnl 72dnl _mkdev({-all-},{-all-},{-dnl 73dnl _dl({-std-},{-std-},{-sca-},{-sca0 sca1 sca2 sca3-})-})dnl 74dnl 75dnl would expand to: 76dnl 77dnl all) 78dnl R std sca0 sca1 sca2 sca3 79dnl ;; 80dnl 81dnl presuming '_DEV(sca..' and '_DEV(std)' were in the MAKEDEV.md file. 82dnl 83dnl 84dnl Everything is 'automatically' added to 'MAKEDEV' based on whether or 85dnl not the '_DEV()' entry has a corresponding _mkdev() and __devitem() 86dnl entry in MAKEDEV.sub (this file). 87dnl 88dnl Note: be very wary of adding whitespace, carriage returns, or not 89dnl finishing a macro with ')dnl' .. otherwise, extra blank lines show up 90dnl in the output. 91dnl 92_mkdev(loc,local,{-test -s $T.local && sh $T.local-})dnl 93dnl 94__devtitle(make,Device "make" file. Valid arguments)dnl 95__devitem({-all-},{-all-}, 96{-makes all known devices{-,-} including local devices. 97{-#-} Tries to make the ``standard'' number of each type.-})dnl 98dnl 99dnl 'all' is special. The 'D'evice 'L'ist (or _dl) macro checks to see if 100dnl a particular devices is in the MAKEDEV.md file, and if so, includes the 101dnl necessary devices. Otherwise the devices are not included in the 'all' 102dnl target. Note this keeps line lengths to less than column 70. For the 103dnl gory details see the definition of '_dl' in MAKEDEV.sub 104dnl 105_mkdev(all,{-all-},{-dnl 106_dl({-std-},{-std-}, 107{-fdesc-},{-fd-}, 108{-sd-},{-sd0 sd1 sd2 sd3 sd4-}, 109{-aflo-},{-sd5 sd6 sd7 sd8 sd9-}, 110{-pty-},{-pty0 pty1-}, 111{-st-},{-st0 st1-}, 112{-ch-},{-ch0-}, 113{-cd-},{-cd0 cd1-}, 114{-mcd-},{-mcd0-}, 115{-vnd-},{-vnd0 vnd1 vnd2 vnd3-}, 116{-ccd-},{-ccd0 ccd1 ccd2 ccd3-}, 117{-wd-},{-wd0 wd1 wd2 wd3-}, 118{-raid-},{-raid0 raid1 raid2 raid3-}, 119{-ofdisk-},{-ofdisk0 ofdisk1 ofdisk2 ofdisk3 ofdisk4-}, 120{-xy-},{-xy0 xy1 xy2 xy3-}, 121{-xd-},{-xd0 xd1 xd2 xd3-}, 122{-hd-},{-hd0 hd1 hd2 hd3 hd4-}, 123{-rz-},{-rz0 rz1 rz2 rz3 rz4-}, 124{-rd-},{-rd0-}, 125{-flo-},{-fd0 fd0B fd0C fd0D fd0E fd0F fd0G fd0H-}, 126{-flo-},{-fd1 fd1B fd1C fd1D fd1E fd1F fd1G fd1H-}, 127{-aflo-},{-fd0 fd1 fd2 fd3-}, 128{-bpf-},{-bpf0 bpf1 bpf2 bpf3 bpf4 bpf5 bpf6 bpf7 bpf8 bpf9-}, 129{-tun-},{-tun0 tun1 tun2 tun3-}, 130{-pctr-},{-pctr-}, 131{-bktr-},{-bktr0-}, 132{-altq-},{-altq-}, 133{-pf-},{-pf-}, 134{-cry-},{-crypto-}, 135{-apm-},{-apm-}, 136{-tth-},{-ttyh0 ttyh1-}, 137{-ttyB-},{-ttyB0 ttyB1 ttyB2 ttyB3 ttyB4 ttyB5-}, 138{-attyB-},{-ttyB0 ttyB1 ttyB2 ttyB3 ttyB4-}, 139{-tty0-},{-tty00 tty01 tty02 tty03-}, 140{-tzs-},{-ttya ttyb ttyc ttyd-}, 141{-czs-},{-cuaa cuab cuac cuad-}, 142{-lkm-},{-lkm-}, 143{-iop-},{-iop0 iop1-}, 144{-mmcl-},{-mmclock-},dnl 145{-lpt-},{-lpa0 lpt0 lpa1 lpt1 lpa2 lpt2-}, 146{-joy-},{-joy0 joy1-}, 147{-rnd-},{-random-}, 148{-ses-},{-ses0-}, 149{-uk-},{-uk0 uk1-}, 150{-ss-},{-ss0 ss1-}, 151{-wt-},{-wt0-}, 152{-wdt-},{-wdt0-}, 153{-ttyc-},{-ttyc0 ttyc1 ttyc2 ttyc3 ttyc4 ttyc5 ttyc6 ttyc7-}, 154{-com-},{-tty00 tty01 tty02 tty03-}, 155{-ttye-},{-ttye0 ttye1 ttye2 ttye3 ttye4 ttye5 ttye6-}, 156{-xfs-},{-xfs0-}, 157{-au-},{-audio0-}, 158{-music-},{-music0-}, 159{-radio-},{-radio0-}, 160{-tuner-},{-tuner0-}, 161{-rmidi-},{-rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7-}, 162{-usbs-},{-usbs-}, 163{-pci-},{-pci-}, 164{-wsmouse-},{-wscons-}, 165{-btw-},{-bwtwo0-}, 166{-cgt-},{-cgtwo0-}, 167{-cfr-},{-cgfour0-}, 168{-grf-},{-grf0 grf1 grf2 grf3 grf4 grf5 grf6-}, 169{-par-},{-par0-}, 170{-amouse-},{-mouse0 mouse1-}, 171{-akbd-},{-kbd-}, 172{-ppi-},{-ppi0-}, 173{-view-},{-view00 view01-}, 174{-local-},{-local-})-})dnl 175__devitem(floppy,floppy,devices to be put on install floppies)dnl 176__devitem(std,{-std-},standard devices)dnl 177dnl 178dnl _std 179dnl 180dnl $1: tty 181dnl $2: memstuff 182dnl $3: ksyms 183dnl $4: drum 184dnl $5: klog 185dnl 186define({-_std-},{-dnl 187std) 188 M console c 0 0 600 189 M tty c $1 0 190 M mem c $2 0 640 kmem 191 M kmem c $2 1 640 kmem 192 M null c $2 2 193 M zero c $2 12 194 M stdin c major_fdesc_c 0 195 M stdout c major_fdesc_c 1 196 M stderr c major_fdesc_c 2 197 M ksyms c $3 0 640 kmem 198 M drum c $4 0 640 kmem 199 M klog c $5 0 600-})dnl 200dnl 201__devitem({-usbs-},usbs,make USB devices)dnl 202_mkdev(usbs,usbs,{-dnl 203_dl({-usb-},{-usb0 usb1-}, 204{-urio-},{-urio-}, 205{-uscan-},{-uscanner0-}, 206{-uhid-},{-uhid0 uhid1 uhid2 uhid3-}, 207{-ulpt-},{-ulpt0 ulpt1-}, 208{-ugen-},{-ugen0 ugen1-}, 209{-utty-},{-utty0 utty1-})-})dnl 210__devtitle(tap,Tapes)dnl 211__devitem(wt,{-wt* -},QIC-interface (e.g. not SCSI) 3M cartridge tape)dnl 212_mkdev(wt,wt*, 213{-name=wt 214 n=Mult($U,8) m=Add($n,4) 215 M $name$U b major_wt_b $n 640 operator 216 M r$name$U c major_wt_c $n 640 operator 217 M n$name$U b major_wt_b $m 640 operator 218 M nr$name$U c major_wt_c $m 640 operator-})dnl 219__devitem(tz,tz*,{-SCSI tapes{-,-} DEC TK50 cartridge tape-})dnl 220__devitem(st,{-st*-},SCSI tapes)dnl 221_mkdev(st,st*,{-n=Mult($U,16) 222 for pre in " " n e en 223 do 224 M ${pre}st$U b major_st_b $n 660 operator 225 M ${pre}rst$U c major_st_c $n 660 operator 226 n=Add($n,1) 227 done-})dnl 228_mkdev(st_hp300,ct*|mt*|st*, 229{-case $i in 230 ct*) name=ct blk=major_ct_b chr=major_ct_c;; 231 mt*) name=mt blk=major_mt_b chr=major_mt_c;; 232 st*) name=st blk=major_st_hp300_b chr=major_st_hp300_c;; 233 esac 234 case $U in 235 [0-7]) 236 four=Add($U,4) eight=Add($U,8) 237 twelve=Add($U,12) twenty=Add($U,20) 238 M r$name$U c $chr $U 660 operator 239 M r$name$four c $chr $four 660 operator 240 M r$name$eight c $chr $eight 660 operator 241 M r$name$twelve c $chr $twelve 660 operator 242 MKlist="$MKlist;ln r$name$four nr$name$U";: sanity w/pdp11 v7 243 MKlist="$MKlist;ln r$name$twelve nr$name$eight";: ditto 244 RMlist="$RMlist nr$name$U nr$name$eight" 245 ;; 246 *) 247 echo bad unit for tape in: $1 248 ;; 249 esac-})dnl 250__devitem(st_hp300,st*,Exabyte tape)dnl 251__devitem(ct,ct*,HP300 HP-IB cartridge tape)dnl 252__devitem(mt,mt*,(Magnetic) 9-track reel tape)dnl 253__devtitle(dis,Disks)dnl 254__devitem(rz,rz*,SCSI disks)dnl 255__devitem(sd,{-sd*-},SCSI disks{-,-} includes flopticals)dnl 256__devitem(ofdisk,ofdisk*,OpenFirmware disks)dnl 257__devitem(hd,{-hd*-},HP300 HP-IB disks)dnl 258__devitem(cd,{-cd*-},SCSI cdrom drives)dnl 259__devitem(acd,acd*,ATAPI cdrom drives)dnl 260_mkdev(cd,cd*,{-dodisk2 cd $U major_cd_b major_cd_c $U 0{--}ifstep(cd)-})dnl 261__devitem(mcd,mcd*,Mitsumi cdrom drives)dnl 262_mkdev(mcd,mcd*,{-dodisk2 mcd $U major_mcd_b major_mcd_c $U 0{--}ifstep(mcd)dnl 263-})dnl 264__devitem(ch,{-ch*-},SCSI media changer)dnl 265_mcdev(ch,ch*,ch,{-major_ch_c-},660,operator)dnl 266__devitem(uk,uk*,SCSI Unknown device)dnl 267_mcdev(uk,uk*,uk,{-major_uk_c-},640,operator)dnl 268__devitem(ss,ss*,SCSI scanners)dnl 269_mkdev(ss,ss*,{-M ss$U c major_ss_c $U 440 operator 270 RMlist="$RMlist scan$U" 271 MKlist="$MKlist;umask 77;ln -s ss$U scan$U"-})dnl 272__devitem(ses,ses*,SES/SAF-TE SCSI devices)dnl 273_mkdev(ses,ses*,{-M ses$U c major_ses_c $U 640 operator-})dnl 274__devitem(ramd,ramdisk,makes all devices for a ramdisk kernel)dnl arc 275__devitem(rd,{-rd*-},"ramdisk" pseudo-disks)dnl 276_mkdev(rd,rd*,{-dodisk2 rd $U major_rd_b major_rd_c $U 0{--}ifstep(rd)-})dnl 277__devitem(xd,xd*,Xylogic 753/7053 disks)dnl 278__devitem(xy,xy*,{- Xylogic 450/451 disks-})dnl 279__devitem(flo,{-fd*-},{-Floppy disk drives (3 1/2"{-,-} 5 1/4")-})dnl 280_mkdev(flo,fd*, 281{-typnam=$U${i#fd[01]*} 282 case $typnam in 283 0|1) typnum=0;; # no type specified, assume A 284 *A) typnam=0; typnum=0;; 285 *B) typnum=1;; 286 *C) typnum=2;; 287 *D) typnum=3;; 288 *E) typnum=4;; 289 *F) typnum=5;; 290 *G) typnum=6;; 291 *H) typnum=7;; 292 *) echo bad type $typnam for $i; exit 1;; 293 esac 294 case $U in 295 0|1) blk=major_flo_b; chr=major_flo_c;; 296 *) echo bad unit $U for $i; exit 1;; 297 esac 298 nam=fd${typnam} 299 n=Add(Mult($U,128),Mult($typnum,16)) 300 M ${nam}a b $blk $n 640 operator 301 M ${nam}b b $blk Add($n,1) 640 operator 302 M ${nam}c b $blk Add($n,2) 640 operator 303 M r${nam}a c $chr $n 640 operator 304 M r${nam}b c $chr Add($n,1) 640 operator 305 M r${nam}c c $chr Add($n,2) 640 operator-},664)dnl 306__devitem(aflo,floppy,devices needed for install floppies)dnl 307_mkdev(aflo,fd*,{-case $U in 0|1|2|3) 308 M fd${U}a b major_aflo_b Mult($U,16) 640 operator 309 M fd${U}b b major_aflo_b Add(Mult($U,16),1) 640 operator 310 M rfd${U}a c major_aflo_c Mult($U,16) 640 operator 311 M rfd${U}b c major_aflo_c Add(Mult($U,16),1) 640 operator;; 312 *) echo bad unit for floppy disk in: $i;; 313 esac-})dnl 314__devitem(iop,iop*,I2O controller device)dnl 315_mcdev(iop,iop*,iop,{-major_iop_c-},660)dnl 316__devitem(wdt,wdt0,watchdog timer)dnl 317_mcdev(wdt,wdt0,wdt,{-major_wdt_c-},440,operator)dnl 318__devitem(local,local,configuration specific devices)dnl 319__devitem(wd,{-wd*-},{-"winchester" disk drives (ST506,IDE,ESDI,RLL,...)-})dnl 320__devitem(ccd,ccd*,concatenated disk devices)dnl 321__devitem(raid,raid*,RAIDframe disk devices)dnl 322__devitem(vnd,vnd*,"file" pseudo-disks)dnl 323_mkdev(vnd,vnd*,{-dodisk vnd $U major_vnd_b major_vnd_c $U 0{--}ifstep(vnd) 324 dodisk svnd $U major_vnd_b major_vnd_c $U 128{--}ifstep(vnd)-})dnl 325dnl 326dnl For normal disk devices, add a disk_q entry; anything else define like 327dnl the rest (such as vnd above). 328dnl 329disk_q({-xy-})dnl 330disk_q({-xd-})dnl 331disk_q({-hd-})dnl 332disk_q({-ofdisk-})dnl 333disk_q({-rz-})dnl 334disk_q({-wd-})dnl 335disk_q({-raid-})dnl 336disk_q({-ccd-})dnl 337disk_q({-sd-})dnl 338dnl 339__devitem(loc,local,configuration specific devices)dnl 340_mkdev(loc,local,{-test -s $T.local && sh $T.local-})dnl 341_mkdev({-disks-},{-undefine({-C_ase-})show_disks()undefine({-C_ase-})-}, 342{-case $i in 343show_disks2()dnl 344 esac-})dnl 345__mkdev({-disks-}){--}dnl 346dnl 347__devtitle(cons,Console ports)dnl 348__devitem(ttyv0,ttyv0,pccons or pcvt screen 0)dnl 349__devitem(ttyv,ttyv*,pcvt)dnl 350__devitem(ttye,ttye*,ite bitmapped consoles)dnl 351__devitem(wscons,ttyC0,wscons screen 0)dnl 352_mkdev({-wscons-},{-wscons-},{-dnl 353_dl(dnl 354{-wscons-},{-ttyCcfg-}, 355{-wsdisp-},{-ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5 ttyC6 ttyC7 ttyC8 ttyC9-}, 356{-wsdisp-},{-ttyCa ttyCb-}, 357{-wsmux-},{-wsmux-}, 358{-wskbd-},{-wskbd0 wskbd1 wskbd2 wskbd3-}, 359{-wsmouse-},{-wsmouse0 wsmouse1 wsmouse2 wsmouse3-})-})dnl 360__devitem(wsdisp,ttyC*,wscons virtual consoles)dnl 361_mkdev({-wsdisp-},ttyC*,{-U=${i##ttyC} 362 case $U in 363 [0-9a-f]) M ttyC$U c major_wsdisp_c {-$(( 16#$U ))-} 600;; 364 cfg) M ttyCcfg c major_wsdisp_c 255 600;; 365 *) echo bad unit $U for $i; exit 1;; 366 esac-})dnl 367__devitem(wskbd,wskbd*,wscons keyboards)dnl 368_mkdev(wskbd,wskbd*,{-M wskbd$U c major_wskbd_c $U 600-})dnl 369__devitem(wsmux,wsmux,wscons keyboard/mouse mux devices)dnl 370_mkdev(wsmux,wsmux|wsmouse|wskbd,{-M wsmouse c major_wsmux_c 0 600 371 M wskbd c major_wsmux_c 1 600-})dnl 372__devitem(pcons,console,PROM console)dnl 373__devtitle(point,Pointing devices)dnl 374__devitem(wsmouse,wsmouse*,wscons mice)dnl 375_mkdev(wsmouse,wsmouse*,{-M wsmouse$U c major_wsmouse_c $U 600-})dnl 376__devitem(quad,quadmouse,"quadrature mouse")dnl 377__devtitle(pty,Pseudo terminals)dnl 378__devitem(tty,tty*,set of 16 slave psuedo terminals)dnl 379__devitem(pty,pty*,set of 16 master pseudo terminals)dnl 380_mkdev(pty,pty*,{-case $U in 381 0) off=0 name=p;; 382 1) off=16 name=q;; 383 2) off=32 name=r;; 384 3) off=48 name=s;; 385# Note that telnetd, rlogind, and xterm (at least) only look at p-s. 386 4) off=64 name=t;; 387 5) off=80 name=u;; 388 6) off=96 name=v;; 389 7) off=112 name=w;; 390 8) off=128 name=x;; 391 9) off=144 name=y;; 392 10) off=160 name=z;; 393 11) off=176 name=P;; 394 12) off=192 name=Q;; 395 13) off=206 name=R;; 396 14) off=224 name=S;; 397 15) off=240 name=T;; 398 *) echo bad unit for pty in: $i; continue;; 399 esac 400 n=0 401 while [ $n -lt 16 ] 402 do 403 nam=$name$(hex $n) 404 M tty$nam c major_tty_c Add($off,$n) 405 M pty$nam c major_pty_c Add($off,$n) 406 n=Add($n,1) 407 done-})dnl 408__devitem(dc,dc*,{-4 channel serial interface (keyboard{-,-} mouse{-,-}modem{-,-} printer)-})dnl 409__devtitle(prn,Printers)dnl 410__devitem(par,par*,motherboard parallel port)dnl 411__devitem(lpt,lpt*,IEEE 1284 centronics printer)dnl 412_mkdev(lpt,lpt*|lpa*, 413{-case $i in 414 lpt*) n=lpt f=0;; 415 lpa*) n=lpa f=128;; 416 esac 417 M $n$U c major_lpt_c Add($U,$f) 600-})dnl 418__devitem(lpa,lpa*,interruptless lp)dnl 419__devitem(ppi,ppi*,HP-IB plotters)dnl 420__devtitle({-usb-},USB devices)dnl 421__devitem({-usb-},usb*,Bus control devices used by usbd for attach/detach)dnl 422_mkdev({-usb-},usb*,{-[ "$i" = "usb" ] && u= || u=$U 423 M usb$u c major_usb_c $U 660-})dnl 424__devitem(uhid,uhid*,Generic HID devices)dnl 425_mcdev({-uhid-},uhid*,{-uhid-},{-major_uhid_c-},660)dnl 426__devitem(ulpt,ulpt*,Printer devices)dnl 427_mcdev({-ulpt-},ulpt*,{-ulpt-},{-major_ulpt_c-},660)dnl 428__devitem(utty,utty*,Serial ports)dnl 429_mcdev({-utty-},utty*,{-utty-},{-major_utty_c-},660)dnl 430__devitem(urio,urio*,Diamond Multimedia Rio 500)dnl 431_mcdev({-urio-},urio*,{-urio-},{-major_urio_c-},660)dnl 432__devitem(uscan,uscanner*,Scanners)dnl 433_mcdev({-uscan-},uscanner*,{-uscanner-},{-major_uscan_c-},660)dnl 434__devitem(ugen,ugen*,Generic device)dnl 435_mkdev(ugen,ugen*,{-n=Mult($U,16) 436 for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 437 do 438 M ugen$U.$j c major_ugen_c Add($n,$j) 660 439 done-})dnl 440__devtitle(cpu,Cpus)dnl 441__devitem(cpu,cpu*,cpus)dnl 442__devtitle(call,Call units)dnl 443__devtitle(term,Terminal ports)dnl 444__devtitle(termp,Terminal multiplexers)dnl 445__devitem(dca,dca*,HP200/300 single port serial interface)dnl 446__devitem(dcm,dcm*,HP200/300 4 port serial mux interface)dnl 447__devitem(apci,apci*,HP400 4 port serial mux interface)dnl 448__devitem({-com-},{-tty0*-},NS16x50 serial ports)dnl 449_mkdev(com,{-tty0*-},{-M tty$U c major_com_c $U 660 dialer uucp 450 M cua$U c major_com_c Add($U,128) 660 dialer uucp-})dnl 451__devitem(ttyc,ttyc*,Cyclades serial ports)dnl 452__devitem(tzs,tty[a-z]*,Zilog 8530 Serial Port)dnl 453_mkdev(tzs,{-tty[a-z]-},{-u=${i#tty*} 454 case $u in 455 a) n=0 ;; 456 b) n=1 ;; 457 c) n=4 ;; 458 d) n=5 ;; 459 *) echo unknown tty device $i ;; 460 esac 461 M tty$u c major_tzs_c $n 660 dialer uucp-})dnl 462__devitem(tth,ttyh*,Sab82532 serial devices)dnl 463_mkdev(tth,ttyh*,{-M ttyh$U c major_tth_c $U 660 dialer uucp-})dnl 464__devitem(czs,cua[a-z]*,Zilog 8530 Serial Port)dnl 465_mkdev(czs,cua[a-z],{-u=${i#cua*} 466 case $u in 467 a) n=0 ;; 468 b) n=1 ;; 469 c) n=4 ;; 470 d) n=5 ;; 471 *) echo unknown cua device $i ;; 472 esac 473 M cua$u c major_czs_c Add($n,128) 660 dialer uucp-})dnl 474__devitem(arm_tty,tty*,{-alias for PC COM ports{-,-} this is what the system really wants-})dnl 475__devitem(tty0,tty00,standard serial port)dnl 476__devitem(ttyA,ttyA*,mfc serial ports)dnl 477__devitem(attyB,ttyB*,ISA COM ports)dnl amiga 478__devitem(ttyz,tty[a-d],onboard zs serial ports)dnl 479__devitem(cuaz,cua[a-d],onboard zs serial ports)dnl 480__devitem(ttyB,ttyB?,DEC 3000 ZS8530 ("scc") serial ports)dnl 481__devitem(scc,scc*,82530 serial interface)dnl 482__devitem(arc_ttyC,ttyC0,pccons)dnl 483__devitem(i386_ttyC,ttyC*,pcvt)dnl 484__devitem(ttyC,ttyC?,{-AlphaStation NS16550 ("com serial ports")-})dnl 485__devitem(ttyE,ttyE?,Workstation console (framebuffer & keyboard) tty emulators)dnl 486__devitem(ser02,ser02,{-serial2 port (channel A on 8530)-})dnl 487__devitem(mdm02,mdm02,{-modem2 port (channel B on 8530)-})dnl 488__devtitle(spec,Special purpose devices)dnl 489__devitem(apm,apm ,power management device)dnl 490_mkdev(apm,apm*,{-M apm c major_apm_c 0 644 491 M apmctl c major_apm_c 8 644-})dnl 492__devitem(pcmcia,pcmcia*,PCMCIA card drivers)dnl 493__devitem(pctr,pctr*,PC Performance Tuning Register access device)dnl 494_mkdev(pctr,pctr,{-M pctr c major_pctr_c 0 644-})dnl 495__devitem(au,audio*,audio device)dnl 496_mkdev(au,audio*,{-M sound$U c major_au_c $U 497 M mixer$U c major_au_c Add($U,16) 498 M audio$U c major_au_c Add($U,128) 499 M audioctl$U c major_au_c Add($U,192) 500 MKlist="$MKlist;[ -e audio ] || ln -s audio$U audio" 501 MKlist="$MKlist;[ -e mixer ] || ln -s mixer$U mixer" 502 MKlist="$MKlist;[ -e sound ] || ln -s sound$U sound" 503 MKlist="$MKlist;[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl 504__devitem(music,music*,midi devices)dnl 505_mkdev(music,music*,{-M music$U c major_music_c $U 506 M sequencer$U c major_music_c Add($U,128) 507 MKlist="$MKlist;[ -e music ] || ln -s music$U music" 508 MKlist="$MKlist;[ -e sequencer ] || ln -s sequencer$U sequencer"-})dnl 509__devitem(radio,radio*,FM tuner device)dnl 510_mkdev(radio,radio*,{-M radio$U c major_radio_c $U 644 511 MKlist="$MKlist;[ -e radio ] || ln -s radio$U radio"-})dnl 512__devitem(fdesc,fd,makes fd/* for the fdescfs)dnl 513_mkdev(fdesc,fd,{-RMlist="mkdir -p fd;$RMlist" n=0 514 while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n,1);done 515 MKlist="$MKlist;chmod 555 fd"-})dnl 516__devtitle(graph,Graphics devices)dnl 517__devitem(grf,grf*,{-custom chip (grf0){-,-} Retina Z2/Z3 (grf1/grf2){-,-} 518{-#-} Cirrus boards (grf3){-,-} A2410 (grf4) video or 519{-#-} CyberVision 64 (grf5)-})dnl 520__devitem(grf_amiga,grf*,{-Motherboard bitmapped video.-})dnl 521__devitem(grf_hp300,grf*,raw interface to HP300 graphics devices)dnl 522__devitem(ite,ite*,terminal emulator interface to HP300 graphics devices)dnl 523__devitem({-hil-},{-hil-},HP300 HIL input devices)dnl 524__devitem(oppr,openprom)dnl 525_cdev(oppr,openprom,70,0)dnl 526__devitem(btw,bwtwo*)dnl 527_mcdev(btw,bwtwo*,bwtwo,{-major_btw_c-},666)dnl 528__devitem(ctw,cgtwo*)dnl 529_mcdev(ctw,cgtwo*,cgtwo,{-major_ctw_c-},666)dnl 530__devitem(ctr,cgthree*)dnl 531_mcdev(ctr,cgthree*,cgthree,{-major_ctr_c-},666)dnl 532__devitem(cfr,cgfour*)dnl 533_mcdev(cfr,cgfour*,cgfour,{-major_cfr_c-},666)dnl 534__devitem(csx,cgsix*)dnl 535_mcdev(csx,cgsix*,cgsix,{-major_csx_c-},666)dnl 536__devitem(ceg,cgeight*)dnl 537_mcdev(ceg,cgeight*,cgeight,{-major_ceg_c-},666)dnl 538__devitem(cfo,cgfourteen*)dnl 539_mcdev(cfo,cgfourteen*,cgfourteen,{-major_cfo_c-})dnl 540__devitem(tcx,tcx*)dnl 541_mcdev(tcx,tcx*,tcx,{-major_tcx_c-})dnl 542__devitem(cry,crypto,hardware crypto access driver)dnl 543_mkdev(cry,crypto,{-M crypto c major_cry_c-} 0)dnl 544__devitem(pf,pf*,Packet Filter)dnl 545_mkdev(pf,{-pf*-},{-M pf c major_pf_c 0 600-})dnl 546__devitem(bpf,bpf*,Berkeley Packet Filter)dnl 547_mkdev(bpf,{-bpf*-},{-M bpf$U c major_bpf_c $U 600-},600)dnl 548_mkdev(tun,{-tun*-},{-M tun$U c major_tun_c $U 600-},600)dnl 549__devitem(altq,altq/,ALTQ control interface)dnl 550_mkdev(altq,altq,{-RMlist="mkdir -p altq;$RMlist" 551 for d in altq cbq wfq afm fifoq red rio localq hfsc cdnr blue priq; do 552 M altq/$d c major_altq_c $U 644 553 U=Add($U,1) 554 done-})dnl 555__devitem(speak,speaker,pc speaker)dnl 556_mcdev(speak,speaker,speaker,{-major_speak_c-},600)dnl 557__devitem(kbd,kbd,keyboard (provides events, for X11))dnl 558_cdev(kbd,kbd,{-major_kbd_c-},0,600)dnl 559__devitem(kbd_atari,kbd,Atari keyboard)dnl 560__devitem(akbd,kbd,Amiga keyboard)dnl 561__devitem(rkbd,kbd,raw keyboard)dnl 562__devitem(kbdctl,kbdctl,keyboard control)dnl 563__devitem(beep,beep,riscpc speaker)dnl 564__devitem(iic,iic*,IIC bus device)dnl 565__devitem(rtc,rtc*,RTC device)dnl 566__devitem(view,view*,generic interface to graphic displays)dnl 567__devitem(aconf,aconf,{-autoconfig information (not yet)-})dnl 568__devitem(mouse-,mouse-*,"mouse link")dnl 569__devitem(mouse,mouse,mouse (provides events, for X11))dnl 570__devitem(amouse,mouse*,Amiga mice)dnl 571__devitem(lkm,lkm,loadable kernel modules interface)dnl 572_cdev(lkm,lkm,{-major_lkm_c-},0,640,kmem)dnl 573__devitem(mmcl,mmclock,memory mapped clock)dnl 574__devitem(tun,tun*,network tunnel driver)dnl 575__devitem(rnd,*random,inkernel random data source)dnl 576_mkdev(rnd,*random,{-n=0 577 for pre in " " s u p a 578 do 579 M ${pre}random c major_rnd_c $n 644 580 n=Add($n,1) 581 done-},644)dnl 582__devitem(joy,joy*,joystick driver)dnl 583_mcdev(joy,joy*,joy,{-major_joy_c-},666)dnl 584__devitem(mag,magma*,magma card (makes 16 tty and 2 bpp))dnl 585__devitem(xfs,xfs*,XFS filesystem devices)dnl 586_mcdev(xfs,xfs*,xfs,{-major_xfs_c-},600)dnl 587__devitem(hil,hil,HIL input devices)dnl 588__devitem(rmidi,rmidi*,raw midi devices)dnl 589_mcdev(rmidi,rmidi*,rmidi,{-major_rmidi_c-},666)dnl 590__devtitle(plat,Platform-specific devices)dnl 591__devitem(fb,fb*,framebuffer device)dnl 592__devitem(bktr,bktr*,video capturing)dnl 593_mcdev(bktr,bktr*,bktr,{-major_bktr_c-},644)dnl 594__devitem(tuner,tuner*,tuner device)dnl 595_mkdev(tuner,tuner*,{-M tuner$U c major_tuner_c Add(Mult($U,2),16) 644-},644)dnl 596__devitem(pci,pci,PCI bus device)dnl 597_mkdev(pci,pci,{-M pci c major_pci_c 0 664-},664)dnl 598_mkdev(local,local,{-test -s $T.local && sh $T.local-},666)dnl 599dnl 600divert(1)dnl 601include(etc.MACHINE/MAKEDEV.md)dnl 602dnl 603dnl 604divert(0)dnl 605#!/bin/sh - 606# 607# THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. 608# generated from: 609# 610show_vers()dnl <-- now that all files are included, show versions 611# 612{-#-} $Open{--}BSD$ 613dnl 614divert(2)dnl 615PATH=/sbin:/usr/sbin:/bin:/usr/bin 616T=$0 617 618# set this to echo for Echo-Only debugging 619[ "$eo" ] || eo= 620 621hex() 622{ 623 case ${--}1 in 624 [0-9]) echo -n {-$-}1;; 625 10) echo -n a;; 626 11) echo -n b;; 627 12) echo -n c;; 628 13) echo -n d;; 629 14) echo -n e;; 630 15) echo -n f;; 631 esac 632} 633trunc() 634{ 635 # XXX pdksh can't seem to deal with locally scoped variables 636 # in ${foo#$bar} expansions 637 arg1="{-$-}1" 638 arg2="{-$-}2" 639 case {-$-}3 in 640 l) echo ${arg2#$arg1} ;; 641 r|*) echo ${arg1#$arg2} ;; 642 esac 643} 644unt() 645{ 646 # XXX pdksh can't seem to deal with locally scoped variables 647 # in ${foo#$bar} expansions 648 arg="{-$-}1" 649 tmp="${arg#[a-zA-Z]*}" 650 tmp="${tmp%*[a-zA-Z]}" 651 while [ "$tmp" != "$arg" ] 652 do 653 arg=$tmp 654 tmp="${arg#[a-zA-Z]*}" 655 tmp="${tmp%*[a-zA-Z]}" 656 done 657 echo $arg 658} 659dnl 660dnl dodisk(name,unit,blkmaj,chrmaj,unit,off[,stepping]) 661dnl arg: 1 2 3 4 5 6 7 662dnl 663dodisk() 664{ 665 n=Add(Mult(${5},${7:-16}),${6}) count=0 666 RMlist="$RMlist {-$-}1{-$-}2? r{-$-}1{-$-}2?" 667 for d in a b c d e f g h i j k l m n o p 668 do 669 M {-$-}1{-$-}2$d b {-$-}3 Add($n,$count) 640 670 M r{-$-}1{-$-}2$d c {-$-}4 Add($n,$count) 640 671 let count=count+1 672 done 673 MKlist="$MKlist;chown root.operator {-$-}1{-$-}2? r{-$-}1{-$-}2?" 674} 675dnl 676dnl dodisk2(name,unit,blkmaj,chrmaj,unit,off[,stepping]) 677dnl 678dnl 1. name - prefix name of the device 679dnl 2. unit - beginning unit number for block devices 680dnl 3. blkmaj - block device major number 681dnl 4. chrmaj - character device major number 682dnl 5. unit - beginning unit number for character devices 683dnl 6. off - offset from 0 for all minor numbers (see svnd for an example) 684dnl 7. step - optional, defaults to 16, number of partitions per device 685dnl 686dodisk2() 687{ 688 n=Add(Mult({-$-}5,${7:-16}),{-$-}6) 689 M {-$-}1{-$-}2a b {-$-}3 $n 640 operator 690 M r{-$-}1{-$-}2a c {-$-}4 $n 640 operator 691 n=Add($n,2) 692 M {-$-}1{-$-}2c b {-$-}3 $n 640 operator 693 M r{-$-}1{-$-}2c c {-$-}4 $n 640 operator 694} 695 696# M name b/c major minor [mode] [group] 697RMlist="rm -f" 698MKlist=":" 699mkl() { 700dnl 701dnl uncomment if multi mknod happens 702dnl 703ifelse(1,0, 704[ "${mklist[{-$-}1]}" ] && mklist[{-$-}1]="${mklist[{-$-}1]} {-$-}2 {-$-}3 {-$-}4 {-$-}5" || { 705 mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5" 706 modes="$modes {-$-}1" 707 }, 708dnl 709dnl non multi mknod 710dnl 711 [ "${mklist[{-$-}1]}" ] && { 712 mklist[{-$-}1]="${mklist[{-$-}1]};mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5" 713 } || { 714 mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5" 715 modes="$modes {-$-}1" 716 }) 717} 718M() { 719 RMlist="$RMlist {-$-}1" 720 mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4 721 mklist="$mklist {-$-}1" 722 G={-$-}{6:-wheel} 723 [ "{-$-}7" ] && { 724 MKlist="$MKlist;chown {-$-}7.{-$-}G {-$-}1" 725 } || { 726 case $G in 727 wheel)g=0;;kmem)g=2;;operator)g=5;;tty)g=4;;dialer)g=117;; 728 esac 729 [ "${grplist[$g]}" ] && { 730 grplist[$g]="${grplist[$g]} {-$-}1" 731 } || { 732 groups="$groups $g" 733 grplist[$g]="chgrp $G {-$-}1" 734 } 735 } 736 return 0 737} 738divert(7)dnl 739dnl 740dnl there is no blank line at the end of etc.arch/MAKEDEV.md files, so add one 741dnl on the following line: 742 743show_devs()dnl 744dnl 745divert(9)dnl 746*) 747 echo $i: unknown device 748 ;; 749esac 750done 751} 752_recurse "$@" 753if [ "$os" = "SunOS" ]; then 754 eo=transform 755 transform() { 756 case $mode in 757 600) mask=077;; 758 640) mask=027;; 759 660) mask=007;; 760 644) mask=022;; 761 666) mask=0;; 762 440) mask=227;; 763 esac 764 echo `echo "$@"|sed \ 765 's/mknod -m \([0-9]*\) /umask '$mask';mknod /;s/-m [0-9]* //g;\ 766 s/operator/5/g;s/root.kmem/root.2/g;s/root\./root:/g'` 767 } 768fi 769list="$RMlist" 770for mode in $modes; do 771 list="$list;${mklist[$mode]}" 772done 773for group in $groups; do 774 list="$list;${grplist[$group]}" 775done 776list="$list;$MKlist" 777if [ "$eo" = "echo" -o "$eo" = "transform" ]; then 778 $eo "$list" 779else 780 echo "$list" | sh 781fi 782divert(3)dnl 783dnl 784R() { 785for i in "$@" 786do 787U=`unt $i` 788[ "$U" ] || U=0 789 790case $i in 791dnl 792