1#!/bin/sh - 2# 3# THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. 4# generated from: 5# 6# OpenBSD: etc.armv7/MAKEDEV.md,v 1.21 2021/11/11 09:47:32 claudio Exp 7# OpenBSD: MAKEDEV.common,v 1.114 2021/11/11 09:47:32 claudio 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# ujoy ujoy/* nodes 60# ulpt* Printer devices 61# usb* Bus control devices used by usbd for attach/detach 62# Special purpose devices: 63# apm Power management device 64# audio* Audio devices 65# bio ioctl tunnel pseudo-device 66# bktr* Video frame grabbers 67# bpf Berkeley Packet Filter 68# dt Dynamic Tracer 69# diskmap Disk mapper 70# fd fd/* nodes 71# fuse Userland Filesystem 72# gpio* General Purpose Input/Output 73# hotplug devices hot plugging 74# pci* PCI bus devices 75# pf* Packet Filter 76# pppx* PPP Multiplexer 77# pppac* PPP Access Concentrator 78# radio* FM tuner devices 79# *random In-kernel random data source 80# rmidi* Raw MIDI devices 81# tun* Network tunnel driver 82# tap* Ethernet tunnel driver 83# uk* Unknown SCSI devices 84# tuner* Tuner devices 85# video* Video V4L2 devices 86# vscsi* Virtual SCSI controller 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 238vscsi*) 239 M vscsi$U c 100 $U 600 240 ;; 241 242video*) 243 M video$U c 38 $U 600 244 MKlist[${#MKlist[*]}]=";[ -e video ] || ln -s video$U video" 245 ;; 246 247tuner*) 248 M tuner$U c 75 $(($(($U*2))+16)) 644 249 ;; 250 251uk*) 252 M uk$U c 28 $U 640 operator 253 ;; 254 255tap*) 256 M tap$U c 104 $U 600 257 ;; 258 259tun*) 260 M tun$U c 33 $U 600 261 ;; 262 263rmidi*) 264 M rmidi$U c 57 $U 660 _sndiop 265 ;; 266 267*random) 268 M urandom c 40 0 644 269 RMlist[${#RMlist[*]}]=random 270 MKlist[${#MKlist[*]}]=";ln -s urandom random" 271 ;; 272 273radio*) 274 M radio$U c 97 $U 275 MKlist[${#MKlist[*]}]=";[ -e radio ] || ln -s radio$U radio" 276 ;; 277 278pppac*) 279 M pppac$U c 107 $U 600 280 ;; 281 282pppx*) 283 M pppx$U c 103 $U 600 284 ;; 285 286pf*) 287 M pf c 46 0 600 288 ;; 289 290pci*) 291 M pci$U c 88 $U 600 292 MKlist[${#MKlist[*]}]=";[ -h pci ] || ln -sf pci0 pci" 293 ;; 294 295hotplug) 296 M hotplug c 37 $U 400 297 ;; 298 299gpio*) 300 M gpio$U c 13 $U 600 301 ;; 302 303fuse) 304 M fuse$U c 77 $U 600 305 ;; 306 307fd) 308 RMlist[${#RMlist[*]}]=";mkdir -p fd;rm -f" n=0 309 while [ $n -lt 64 ];do M fd/$n c 7 $n;n=$(($n+1));done 310 MKlist[${#MKlist[*]}]=";chmod 555 fd" 311 ;; 312 313diskmap) 314 M diskmap c 102 0 640 operator 315 ;; 316 317dt) 318 M dt c 30 0 600 319 ;; 320 321bpf) 322 M bpf c 22 0 600 323 M bpf0 c 22 0 600 324 ;; 325 326bktr*) 327 M bktr$U c 75 $U 644 328 ;; 329 330bio) 331 M bio c 52 0 600 332 ;; 333 334audio*) 335 M audio$U c 36 $U 660 _sndiop 336 M audioctl$U c 36 $(($U+192)) 660 _sndiop 337 ;; 338 339apm*) 340 M apm c 34 0 644 341 M apmctl c 34 8 644 342 ;; 343 344usb*) 345 [ "$i" = "usb" ] && u= || u=$U 346 M usb$u c 64 $U 640 347 ;; 348 349ulpt*) 350 M ulpt$U c 66 $U 600 351 ;; 352 353ujoy) 354 RMlist[${#RMlist[*]}]=";mkdir -p ujoy;rm -f" n=0 355 while [ $n -lt 4 ];do M ujoy/$n c 108 $n 444;n=$(($n+1));done 356 MKlist[${#MKlist[*]}]=";chmod 555 ujoy" 357 ;; 358 359fido) 360 RMlist[${#RMlist[*]}]=";mkdir -p fido;rm -f" n=0 361 while [ $n -lt 4 ];do M fido/$n c 106 $n 666;n=$(($n+1));done 362 MKlist[${#MKlist[*]}]=";chmod 555 fido" 363 ;; 364 365uhid*) 366 M uhid$U c 65 $U 600 367 ;; 368 369ugen*) 370 n=$(($U*16)) 371 for j in 0{0,1,2,3,4,5,6,7,8,9} 1{0,1,2,3,4,5} 372 do 373 M ugen$U.$j c 70 $(($n+10#$j)) 600 374 done 375 ;; 376 377uall) 378 R ttyU0 ttyU1 ttyU2 ttyU3 ugen0 ugen1 ugen2 ugen3 ugen4 ugen5 379 R ugen6 ugen7 ulpt0 ulpt1 ujoy fido uhid0 uhid1 uhid2 uhid3 380 R uhid4 uhid5 uhid6 uhid7 usb0 usb1 usb2 usb3 usb4 usb5 usb6 381 R usb7 382 ;; 383 384ttyU[0-9a-zA-Z]) 385 U=${i#ttyU*} 386 o=$(alph2d $U) 387 M ttyU$U c 68 $o 660 dialer root 388 M cuaU$U c 68 $(($o+128)) 660 dialer root 389 ;; 390 391wsmux|wsmouse|wskbd) 392 M wsmouse c 63 0 600 393 M wskbd c 63 1 600 394 ;; 395 396wsmouse[0-9]*) 397 M wsmouse$U c 62 $U 600 398 ;; 399 400wskbd[0-9]*) 401 M wskbd$U c 61 $U 600 402 ;; 403 404wscons) 405 R wsmouse0 wsmouse1 wsmouse2 wsmouse3 wsmouse4 wsmouse5 406 R wsmouse6 wsmouse7 wsmouse8 wsmouse9 wskbd0 wskbd1 wskbd2 407 R wskbd3 wsmux ttyCcfg ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5 408 R ttyC6 ttyC7 ttyC8 ttyC9 ttyCa ttyCb 409 ;; 410 411tty[C-J]*) 412 U=${i##tty[C-J]} 413 case $i in 414 ttyC*) n=C m=0;; 415 ttyD*) n=D m=256;; 416 ttyE*) n=E m=512;; 417 ttyF*) n=F m=768;; 418 ttyG*) n=G m=1024;; 419 ttyH*) n=H m=1280;; 420 ttyI*) n=I m=1536;; 421 ttyJ*) n=J m=1792;; 422 esac 423 case $U in 424 [0-9a-f]) M tty$n$U c 60 $((16#$U+$m)) 600;; 425 cfg) M tty${n}cfg c 60 $((255+$m)) 600;; 426 *) echo bad unit $U for $i; exit 1;; 427 esac 428 ;; 429 430pty*) 431 if [ $U -gt 15 ]; then 432 echo bad unit for pty in: $i 433 continue 434 fi 435 set -A letters p q r s t u v w x y z P Q R S T 436 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 \ 437 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 \ 438 Y Z 439 440 name=${letters[$U]} 441 n=0 442 while [ $n -lt 62 ] 443 do 444 nam=$name${suffixes[$n]} 445 off=$(($U*62)) 446 M tty$nam c 4 $(($off+$n)) 447 M pty$nam c 5 $(($off+$n)) 448 n=$(($n+1)) 449 done 450 ;; 451 452ptm) 453 M ptm c 98 0 666 454 ;; 455 456tty[0-7][0-9a-f]) 457 U=${i#tty*} 458 o=$(h2d $U) 459 M tty$U c 12 $o 660 dialer root 460 M cua$U c 12 $(($o+128)) 660 dialer root 461 ;; 462 463st*) 464 n=$(($U*16)) 465 for pre in " " n e en 466 do 467 M ${pre}rst$U c 25 $n 660 operator 468 n=$(($n+1)) 469 done 470 ;; 471 472vnd*) 473 dodisk vnd $U 19 19 $U 0 474 ;; 475 476rd*) 477 dodisk2 rd $U 18 18 $U 0 478 ;; 479 480ch*) 481 M ch$U c 27 $U 660 operator 482 ;; 483 484cd*) 485 dodisk2 cd $U 26 26 $U 0 486 ;; 487 488local) 489 test -s $T.local && sh $T.local 490 ;; 491 492all) 493 R gpio0 gpio1 gpio2 gpio3 gpio4 gpio5 gpio6 gpio7 gpio8 vnd0 494 R vnd1 vnd2 vnd3 sd0 sd1 sd2 sd3 sd4 sd5 sd6 sd7 sd8 sd9 cd0 495 R cd1 rd0 tap0 tap1 tap2 tap3 tun0 tun1 tun2 tun3 bio pty0 496 R diskmap vscsi0 ch0 audio0 audio1 audio2 kstat dt bpf fuse 497 R pppac pppx hotplug ptm local wscons pci0 pci1 pci2 pci3 uall 498 R rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7 499 R tuner0 radio0 video0 video1 uk0 random tty00 tty01 tty02 500 R tty03 tty04 tty05 tty06 tty07 tty08 tty09 tty0a tty0b apm pf 501 R wd0 wd1 wd2 wd3 std st0 st1 fd 502 ;; 503 504wd*|sd*) 505 case $i in 506 wd*) dodisk wd $U 16 16 $U 0;; 507 sd*) dodisk sd $U 24 24 $U 0;; 508 esac 509 ;; 510 511*) 512 echo $i: unknown device 513 ;; 514esac 515done 516} 517R "$@" 518{ 519echo -n ${RMlist[*]} 520echo -n ${mklist[*]} 521echo -n ${MKlist[*]} 522echo -n ${whlist[*]} 523echo ${oplist[*]} 524} | if [ "$eo" = "echo" ]; then 525 cat 526else 527 sh 528fi 529