1#!/bin/sh - 2# 3# THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. 4# generated from: 5# 6# OpenBSD: etc.armv7/MAKEDEV.md,v 1.18 2020/07/06 06:11:26 dlg Exp 7# OpenBSD: MAKEDEV.common,v 1.111 2020/07/06 06:11:26 dlg Exp 8# OpenBSD: MAKEDEV.mi,v 1.83 2016/09/11 03:06:31 deraadt Exp 9# OpenBSD: MAKEDEV.sub,v 1.14 2005/02/07 06:14:18 david Exp 10# 11# 12# Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org> 13# 14# Permission to use, copy, modify, and distribute this software for any 15# purpose with or without fee is hereby granted, provided that the above 16# copyright notice and this permission notice appear in all copies. 17# 18# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 19# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 20# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 21# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 22# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 23# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 24# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 25# 26# Device "make" file. Valid arguments: 27# all makes all known devices, including local devices. 28# Tries to make the ``standard'' number of each type. 29# ramdisk Ramdisk kernel devices 30# std Standard devices 31# local Configuration specific devices 32# Disks: 33# cd* ATAPI and SCSI CD-ROM drives 34# ch* SCSI media changers 35# rd* "rd" pseudo-disks 36# sd* SCSI disks, including flopticals 37# vnd* "file" pseudo-disk devices 38# wd* "winchester" disk drives (ST506, IDE, ESDI, RLL, ...) 39# Tapes: 40# st* SCSI tape drives 41# Terminal ports: 42# tty[0-7][0-9a-f] NS16x50 serial ports 43# Pseudo terminals: 44# ptm pty master device 45# pty* Set of 62 master pseudo terminals 46# tty* Set of 62 slave pseudo terminals 47# Console ports: 48# ttyC-J* wscons display devices 49# wscons Minimal wscons devices 50# wskbd* wscons keyboards 51# wsmouse* wscons mice 52# wsmux wscons keyboard/mouse mux devices 53# USB devices: 54# ttyU* USB serial ports 55# uall All USB devices 56# ugen* Generic USB devices 57# uhid* Generic HID devices 58# fido fido/* nodes 59# ulpt* Printer devices 60# usb* Bus control devices used by usbd for attach/detach 61# Special purpose devices: 62# apm Power management device 63# audio* Audio devices 64# bio ioctl tunnel pseudo-device 65# bktr* Video frame grabbers 66# bpf Berkeley Packet Filter 67# dt Dynamic Tracer 68# diskmap Disk mapper 69# fd fd/* nodes 70# fuse Userland Filesystem 71# gpio* General Purpose Input/Output 72# hotplug devices hot plugging 73# pci* PCI bus devices 74# pf* Packet Filter 75# pppx* PPP Multiplexer 76# pppac* PPP Access Concentrator 77# radio* FM tuner devices 78# *random In-kernel random data source 79# rmidi* Raw MIDI devices 80# tun* Network tunnel driver 81# tap* Ethernet tunnel driver 82# uk* Unknown SCSI devices 83# tuner* Tuner devices 84# video* Video V4L2 devices 85# vscsi* Virtual SCSI controller 86# switch* Switch driver 87# kstat Kernel Statistics 88PATH=/sbin:/usr/sbin:/bin:/usr/bin 89T=$0 90 91# set this to echo for Echo-Only debugging 92[ "$eo" ] || eo= 93 94hex() 95{ 96 case $1 in 97 [0-9]) echo -n $1;; 98 10) echo -n a;; 99 11) echo -n b;; 100 12) echo -n c;; 101 13) echo -n d;; 102 14) echo -n e;; 103 15) echo -n f;; 104 esac 105} 106 107alph2d() 108{ 109 local t="$1" 110 local p="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" 111 local sub=${p%${t}*} 112 echo ${#sub} 113} 114 115h2d() 116{ 117 local s="$1" 118 local f=${s%*[0-9a-f]} n=${s#[0-9a-f]*} 119 120 echo $(($(_h2d $f)*16+ $(_h2d $n) )) 121} 122 123_h2d() 124{ 125 case $1 in 126 [0-9]) echo -n $1;; 127 a) echo -n 10;; 128 b) echo -n 11;; 129 c) echo -n 12;; 130 d) echo -n 13;; 131 e) echo -n 14;; 132 f) echo -n 15;; 133 esac 134} 135 136unt() 137{ 138 # XXX pdksh can't seem to deal with locally scoped variables 139 # in ${foo#$bar} expansions 140 arg="$1" 141 tmp="${arg#[a-zA-Z]*}" 142 tmp="${tmp%*[a-zA-Z]}" 143 while [ "$tmp" != "$arg" ] 144 do 145 arg=$tmp 146 tmp="${arg#[a-zA-Z]*}" 147 tmp="${tmp%*[a-zA-Z]}" 148 done 149 echo $arg 150} 151 152dodisk() 153{ 154 [ "$DEBUG" ] && set -x 155 n=$(($((${5}*${7:-16}))+${6})) count=0 156 [ 0$7 -ne 8 ] && l="i j k l m n o p" 157 for d in a b c d e f g h $l 158 do 159 M $1$2$d b $3 $(($n+$count)) 640 operator 160 M r$1$2$d c $4 $(($n+$count)) 640 operator 161 let count=count+1 162 done 163} 164 165dodisk2() 166{ 167 n=$(($(($5*${7:-16}))+$6)) 168 M $1$2a b $3 $n 640 operator 169 M r$1$2a c $4 $n 640 operator 170 n=$(($n+2)) 171 M $1$2c b $3 $n 640 operator 172 M r$1$2c c $4 $n 640 operator 173} 174 175# M name b/c major minor [mode] [group] 176RMlist[0]="rm -f" 177 178mkl() { 179 : ${mklist[0]:=";mknod"} 180 mklist[${#mklist[*]}]=" -m $1 $2 $3 $4 $5" 181} 182 183M() { 184 RMlist[${#RMlist[*]}]=$1 185 mkl ${5-666} $1 $2 $3 $4 186 G=${6:-wheel} 187 [ "$7" ] && { 188 MKlist[${#MKlist[*]}]="&& chown $7:$G $1" 189 } || { 190 case $G in 191 wheel) 192 [ ${#whlist[*]} = 0 ] && whlist[0]="&& chgrp wheel" 193 whlist[${#whlist[*]}]="$1" 194 ;; 195 operator) 196 [ ${#oplist[*]} = 0 ] && oplist[0]="&& chgrp operator" 197 oplist[${#oplist[*]}]="$1" 198 ;; 199 *) 200 MKlist[${#MKlist[*]}]="&& chgrp $G $1"; 201 esac 202 } 203 return 0 204} 205 206R() { 207[ "$DEBUG" ] && set -x 208for i in "$@" 209do 210U=`unt $i` 211[ "$U" ] || U=0 212 213case $i in 214ramdisk) 215 R std bpf wd0 wd1 sd0 tty00 rd0 wsmouse 216 R st0 ttyC0 wskbd0 apm bio diskmap random 217 ;; 218 219std) 220 M console c 0 0 600 221 M tty c 1 0 222 M mem c 2 0 640 kmem 223 M kmem c 2 1 640 kmem 224 M null c 2 2 225 M zero c 2 12 226 M stdin c 7 0 227 M stdout c 7 1 228 M stderr c 7 2 229 M ksyms c 8 0 640 kmem 230 M klog c 6 0 600 231 M openprom c 82 0 600 232 ;; 233 234kstat) 235 M kstat c 51 0 640 236 ;; 237 238switch*) 239 M switch$U c 105 $U 600 240 ;; 241 242vscsi*) 243 M vscsi$U c 100 $U 600 244 ;; 245 246video*) 247 M video$U c 38 $U 600 248 MKlist[${#MKlist[*]}]=";[ -e video ] || ln -s video$U video" 249 ;; 250 251tuner*) 252 M tuner$U c 75 $(($(($U*2))+16)) 644 253 ;; 254 255uk*) 256 M uk$U c 28 $U 640 operator 257 ;; 258 259tap*) 260 M tap$U c 104 $U 600 261 ;; 262 263tun*) 264 M tun$U c 33 $U 600 265 ;; 266 267rmidi*) 268 M rmidi$U c 57 $U 660 _sndiop 269 ;; 270 271*random) 272 M urandom c 40 0 644 273 RMlist[${#RMlist[*]}]=random 274 MKlist[${#MKlist[*]}]=";ln -s urandom random" 275 ;; 276 277radio*) 278 M radio$U c 97 $U 279 MKlist[${#MKlist[*]}]=";[ -e radio ] || ln -s radio$U radio" 280 ;; 281 282pppac*) 283 M pppac$U c 107 $U 600 284 ;; 285 286pppx*) 287 M pppx$U c 103 $U 600 288 ;; 289 290pf*) 291 M pf c 46 0 600 292 ;; 293 294pci*) 295 M pci$U c 88 $U 600 296 MKlist[${#MKlist[*]}]=";[ -h pci ] || ln -sf pci0 pci" 297 ;; 298 299hotplug) 300 M hotplug c 37 $U 400 301 ;; 302 303gpio*) 304 M gpio$U c 13 $U 600 305 ;; 306 307fuse) 308 M fuse$U c 77 $U 600 309 ;; 310 311fd) 312 RMlist[${#RMlist[*]}]=";mkdir -p fd;rm -f" n=0 313 while [ $n -lt 64 ];do M fd/$n c 7 $n;n=$(($n+1));done 314 MKlist[${#MKlist[*]}]=";chmod 555 fd" 315 ;; 316 317diskmap) 318 M diskmap c 102 0 640 operator 319 ;; 320 321dt) 322 M dt c 30 0 600 323 ;; 324 325bpf) 326 M bpf c 22 0 600 327 M bpf0 c 22 0 600 328 ;; 329 330bktr*) 331 M bktr$U c 75 $U 644 332 ;; 333 334bio) 335 M bio c 52 0 600 336 ;; 337 338audio*) 339 M audio$U c 36 $U 660 _sndiop 340 M audioctl$U c 36 $(($U+192)) 660 _sndiop 341 ;; 342 343apm*) 344 M apm c 34 0 644 345 M apmctl c 34 8 644 346 ;; 347 348usb*) 349 [ "$i" = "usb" ] && u= || u=$U 350 M usb$u c 64 $U 640 351 ;; 352 353ulpt*) 354 M ulpt$U c 66 $U 600 355 ;; 356 357fido) 358 RMlist[${#RMlist[*]}]=";mkdir -p fido;rm -f" n=0 359 while [ $n -lt 4 ];do M fido/$n c 106 $n 666;n=$(($n+1));done 360 MKlist[${#MKlist[*]}]=";chmod 555 fido" 361 ;; 362 363uhid*) 364 M uhid$U c 65 $U 600 365 ;; 366 367ugen*) 368 n=$(($U*16)) 369 for j in 0{0,1,2,3,4,5,6,7,8,9} 1{0,1,2,3,4,5} 370 do 371 M ugen$U.$j c 70 $(($n+10#$j)) 600 372 done 373 ;; 374 375uall) 376 R ttyU0 ttyU1 ttyU2 ttyU3 ugen0 ugen1 ugen2 ugen3 ugen4 ugen5 377 R ugen6 ugen7 ulpt0 ulpt1 fido uhid0 uhid1 uhid2 uhid3 uhid4 378 R uhid5 uhid6 uhid7 usb0 usb1 usb2 usb3 usb4 usb5 usb6 usb7 379 ;; 380 381ttyU[0-9a-zA-Z]) 382 U=${i#ttyU*} 383 o=$(alph2d $U) 384 M ttyU$U c 68 $o 660 dialer root 385 M cuaU$U c 68 $(($o+128)) 660 dialer root 386 ;; 387 388wsmux|wsmouse|wskbd) 389 M wsmouse c 63 0 600 390 M wskbd c 63 1 600 391 ;; 392 393wsmouse[0-9]*) 394 M wsmouse$U c 62 $U 600 395 ;; 396 397wskbd[0-9]*) 398 M wskbd$U c 61 $U 600 399 ;; 400 401wscons) 402 R wsmouse0 wsmouse1 wsmouse2 wsmouse3 wsmouse4 wsmouse5 403 R wsmouse6 wsmouse7 wsmouse8 wsmouse9 wskbd0 wskbd1 wskbd2 404 R wskbd3 wsmux ttyCcfg ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5 405 R ttyC6 ttyC7 ttyC8 ttyC9 ttyCa ttyCb 406 ;; 407 408tty[C-J]*) 409 U=${i##tty[C-J]} 410 case $i in 411 ttyC*) n=C m=0;; 412 ttyD*) n=D m=256;; 413 ttyE*) n=E m=512;; 414 ttyF*) n=F m=768;; 415 ttyG*) n=G m=1024;; 416 ttyH*) n=H m=1280;; 417 ttyI*) n=I m=1536;; 418 ttyJ*) n=J m=1792;; 419 esac 420 case $U in 421 [0-9a-f]) M tty$n$U c 60 $((16#$U+$m)) 600;; 422 cfg) M tty${n}cfg c 60 $((255+$m)) 600;; 423 *) echo bad unit $U for $i; exit 1;; 424 esac 425 ;; 426 427pty*) 428 if [ $U -gt 15 ]; then 429 echo bad unit for pty in: $i 430 continue 431 fi 432 set -A letters p q r s t u v w x y z P Q R S T 433 set -A suffixes 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q \ 434 r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X \ 435 Y Z 436 437 name=${letters[$U]} 438 n=0 439 while [ $n -lt 62 ] 440 do 441 nam=$name${suffixes[$n]} 442 off=$(($U*62)) 443 M tty$nam c 4 $(($off+$n)) 444 M pty$nam c 5 $(($off+$n)) 445 n=$(($n+1)) 446 done 447 ;; 448 449ptm) 450 M ptm c 98 0 666 451 ;; 452 453tty[0-7][0-9a-f]) 454 U=${i#tty*} 455 o=$(h2d $U) 456 M tty$U c 12 $o 660 dialer root 457 M cua$U c 12 $(($o+128)) 660 dialer root 458 ;; 459 460st*) 461 n=$(($U*16)) 462 for pre in " " n e en 463 do 464 M ${pre}rst$U c 25 $n 660 operator 465 n=$(($n+1)) 466 done 467 ;; 468 469vnd*) 470 dodisk vnd $U 19 19 $U 0 471 ;; 472 473rd*) 474 dodisk2 rd $U 18 18 $U 0 475 ;; 476 477ch*) 478 M ch$U c 27 $U 660 operator 479 ;; 480 481cd*) 482 dodisk2 cd $U 26 26 $U 0 483 ;; 484 485local) 486 test -s $T.local && sh $T.local 487 ;; 488 489all) 490 R gpio0 gpio1 gpio2 gpio3 gpio4 gpio5 gpio6 gpio7 gpio8 491 R switch0 switch1 switch2 switch3 vnd0 vnd1 vnd2 vnd3 sd0 sd1 492 R sd2 sd3 sd4 sd5 sd6 sd7 sd8 sd9 cd0 cd1 rd0 tap0 tap1 tap2 493 R tap3 tun0 tun1 tun2 tun3 bio pty0 diskmap vscsi0 ch0 kstat 494 R dt bpf fuse pppac pppx hotplug ptm local wscons pci0 pci1 495 R pci2 pci3 uall rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 496 R rmidi6 rmidi7 tuner0 radio0 video0 video1 uk0 random tty00 497 R tty01 tty02 tty03 tty04 tty05 tty06 tty07 tty08 tty09 tty0a 498 R tty0b apm pf wd0 wd1 wd2 wd3 std st0 st1 fd 499 ;; 500 501wd*|sd*) 502 case $i in 503 wd*) dodisk wd $U 16 16 $U 0;; 504 sd*) dodisk sd $U 24 24 $U 0;; 505 esac 506 ;; 507 508*) 509 echo $i: unknown device 510 ;; 511esac 512done 513} 514R "$@" 515{ 516echo -n ${RMlist[*]} 517echo -n ${mklist[*]} 518echo -n ${MKlist[*]} 519echo -n ${whlist[*]} 520echo ${oplist[*]} 521} | if [ "$eo" = "echo" ]; then 522 cat 523else 524 sh 525fi 526