MAKEDEV revision 1.19
1#!/bin/sh - 2# 3# THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. 4# generated from: 5# 6# OpenBSD: etc.armv7/MAKEDEV.md,v 1.12 2016/05/21 21:30:22 kettenis Exp 7# OpenBSD: MAKEDEV.common,v 1.88 2016/05/21 15:17:49 deraadt Exp 8# OpenBSD: MAKEDEV.mi,v 1.82 2016/03/12 17:58:59 espie 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# ulpt* Printer devices 59# usb* Bus control devices used by usbd for attach/detach 60# Special purpose devices: 61# apm Power management device 62# audio* Audio devices 63# bio ioctl tunnel pseudo-device 64# bktr* Video frame grabbers 65# bpf Berkeley Packet Filter 66# diskmap Disk mapper 67# fd fd/* nodes 68# fuse Userland Filesystem 69# gpio* General Purpose Input/Output 70# hotplug devices hot plugging 71# pci* PCI bus devices 72# pf* Packet Filter 73# pppx* PPP Multiplexer 74# radio* FM tuner devices 75# *random In-kernel random data source 76# rmidi* Raw MIDI devices 77# tun* Network tunnel driver 78# tap* Ethernet tunnel driver 79# uk* Unknown SCSI devices 80# tuner* Tuner devices 81# video* Video V4L2 devices 82# vscsi* Virtual SCSI controller 83PATH=/sbin:/usr/sbin:/bin:/usr/bin 84T=$0 85 86# set this to echo for Echo-Only debugging 87[ "$eo" ] || eo= 88 89hex() 90{ 91 case $1 in 92 [0-9]) echo -n $1;; 93 10) echo -n a;; 94 11) echo -n b;; 95 12) echo -n c;; 96 13) echo -n d;; 97 14) echo -n e;; 98 15) echo -n f;; 99 esac 100} 101 102alph2d() 103{ 104 local t="$1" 105 local p="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" 106 local sub=${p%${t}*} 107 echo ${#sub} 108} 109 110h2d() 111{ 112 local s="$1" 113 local f=${s%*[0-9a-f]} n=${s#[0-9a-f]*} 114 115 echo $(($(_h2d $f)*16+ $(_h2d $n) )) 116} 117 118_h2d() 119{ 120 case $1 in 121 [0-9]) echo -n $1;; 122 a) echo -n 10;; 123 b) echo -n 11;; 124 c) echo -n 12;; 125 d) echo -n 13;; 126 e) echo -n 14;; 127 f) echo -n 15;; 128 esac 129} 130 131unt() 132{ 133 # XXX pdksh can't seem to deal with locally scoped variables 134 # in ${foo#$bar} expansions 135 arg="$1" 136 tmp="${arg#[a-zA-Z]*}" 137 tmp="${tmp%*[a-zA-Z]}" 138 while [ "$tmp" != "$arg" ] 139 do 140 arg=$tmp 141 tmp="${arg#[a-zA-Z]*}" 142 tmp="${tmp%*[a-zA-Z]}" 143 done 144 echo $arg 145} 146 147dodisk() 148{ 149 [ "$DEBUG" ] && set -x 150 n=$(($((${5}*${7:-16}))+${6})) count=0 151 [ 0$7 -ne 8 ] && l="i j k l m n o p" 152 for d in a b c d e f g h $l 153 do 154 M $1$2$d b $3 $(($n+$count)) 640 operator 155 M r$1$2$d c $4 $(($n+$count)) 640 operator 156 let count=count+1 157 done 158} 159 160dodisk2() 161{ 162 n=$(($(($5*${7:-16}))+$6)) 163 M $1$2a b $3 $n 640 operator 164 M r$1$2a c $4 $n 640 operator 165 n=$(($n+2)) 166 M $1$2c b $3 $n 640 operator 167 M r$1$2c c $4 $n 640 operator 168} 169 170# M name b/c major minor [mode] [group] 171RMlist[0]="rm -f" 172 173mkl() { 174 : ${mklist[0]:=";mknod"} 175 mklist[${#mklist[*]}]=" -m $1 $2 $3 $4 $5" 176} 177 178M() { 179 RMlist[${#RMlist[*]}]=$1 180 mkl ${5-666} $1 $2 $3 $4 181 G=${6:-wheel} 182 [ "$7" ] && { 183 MKlist[${#MKlist[*]}]="&& chown $7:$G $1" 184 } || { 185 case $G in 186 wheel) 187 [ ${#whlist[*]} = 0 ] && whlist[0]="&& chgrp wheel" 188 whlist[${#whlist[*]}]="$1" 189 ;; 190 operator) 191 [ ${#oplist[*]} = 0 ] && oplist[0]="&& chgrp operator" 192 oplist[${#oplist[*]}]="$1" 193 ;; 194 *) 195 MKlist[${#MKlist[*]}]="&& chgrp $G $1"; 196 esac 197 } 198 return 0 199} 200 201R() { 202[ "$DEBUG" ] && set -x 203for i in "$@" 204do 205U=`unt $i` 206[ "$U" ] || U=0 207 208case $i in 209ramdisk) 210 R std bpf wd0 wd1 sd0 tty00 rd0 wsmouse 211 R st0 ttyC0 wskbd0 apm bio diskmap random 212 ;; 213 214std) 215 M console c 0 0 600 216 M tty c 1 0 217 M mem c 2 0 640 kmem 218 M kmem c 2 1 640 kmem 219 M null c 2 2 220 M zero c 2 12 221 M stdin c 7 0 222 M stdout c 7 1 223 M stderr c 7 2 224 M ksyms c 8 0 640 kmem 225 M klog c 6 0 600 226 M openprom c 82 0 600 227 ;; 228 229vscsi*) 230 M vscsi$U c 100 $U 600 231 ;; 232 233video*) 234 M video$U c 38 $U 600 235 MKlist[${#MKlist[*]}]=";[ -e video ] || ln -s video$U video" 236 ;; 237 238tuner*) 239 M tuner$U c 75 $(($(($U*2))+16)) 644 240 ;; 241 242uk*) 243 M uk$U c 28 $U 640 operator 244 ;; 245 246tap*) 247 M tap$U c 104 $U 600 248 ;; 249 250tun*) 251 M tun$U c 33 $U 600 252 ;; 253 254rmidi*) 255 M rmidi$U c 57 $U 666 256 ;; 257 258*random) 259 n=0 260 for pre in " " s u a 261 do 262 M ${pre}random c 40 $n 644 263 n=$(($n+1)) 264 done 265 ;; 266 267radio*) 268 M radio$U c 97 $U 269 MKlist[${#MKlist[*]}]=";[ -e radio ] || ln -s radio$U radio" 270 ;; 271 272pppx*) 273 M pppx$U c 103 $U 600 274 ;; 275 276pf*) 277 M pf c 46 0 600 278 ;; 279 280pci*) 281 M pci$U c 88 $U 600 282 MKlist[${#MKlist[*]}]=";[ -h pci ] || ln -sf pci0 pci" 283 ;; 284 285hotplug) 286 M hotplug c 37 $U 400 287 ;; 288 289gpio*) 290 M gpio$U c 13 $U 600 291 ;; 292 293fuse) 294 M fuse$U c 77 $U 600 295 ;; 296 297fd) 298 RMlist[${#RMlist[*]}]=";mkdir -p fd;rm -f" n=0 299 while [ $n -lt 64 ];do M fd/$n c 7 $n;n=$(($n+1));done 300 MKlist[${#MKlist[*]}]=";chmod 555 fd" 301 ;; 302 303diskmap) 304 M diskmap c 102 0 640 operator 305 ;; 306 307bpf) 308 M bpf c 22 0 600 309 M bpf0 c 22 0 600 310 ;; 311 312bktr*) 313 M bktr$U c 75 $U 644 314 ;; 315 316bio) 317 M bio c 52 0 600 318 ;; 319 320audio*) 321 M sound$U c 36 $U 322 M mixer$U c 36 $(($U+16)) 323 M audio$U c 36 $(($U+128)) 324 M audioctl$U c 36 $(($U+192)) 325 MKlist[${#MKlist[*]}]=";[ -e audio ] || ln -s audio$U audio" 326 MKlist[${#MKlist[*]}]=";[ -e mixer ] || ln -s mixer$U mixer" 327 MKlist[${#MKlist[*]}]=";[ -e sound ] || ln -s sound$U sound" 328 MKlist[${#MKlist[*]}]=";[ -e audioctl ] || ln -s audioctl$U audioctl" 329 ;; 330 331apm*) 332 M apm c 34 0 644 333 M apmctl c 34 8 644 334 ;; 335 336usb*) 337 [ "$i" = "usb" ] && u= || u=$U 338 M usb$u c 64 $U 660 339 ;; 340 341ulpt*) 342 M ulpt$U c 66 $U 660 343 ;; 344 345uhid*) 346 M uhid$U c 65 $U 660 347 ;; 348 349ugen*) 350 n=$(($U*16)) 351 for j in 0{0,1,2,3,4,5,6,7,8,9} 1{0,1,2,3,4,5} 352 do 353 M ugen$U.$j c 70 $(($n+10#$j)) 660 354 done 355 ;; 356 357uall) 358 R ttyU0 ttyU1 ttyU2 ttyU3 ugen0 ugen1 ugen2 ugen3 ugen4 ugen5 359 R ugen6 ugen7 ulpt0 ulpt1 uhid0 uhid1 uhid2 uhid3 usb0 usb1 360 R usb2 usb3 usb4 usb5 usb6 usb7 361 ;; 362 363ttyU[0-9a-zA-Z]) 364 U=${i#ttyU*} 365 o=$(alph2d $U) 366 M ttyU$U c 68 $o 660 dialer uucp 367 M cuaU$U c 68 $(($o+128)) 660 dialer uucp 368 ;; 369 370wsmux|wsmouse|wskbd) 371 M wsmouse c 63 0 600 372 M wskbd c 63 1 600 373 ;; 374 375wsmouse[0-9]*) 376 M wsmouse$U c 62 $U 600 377 ;; 378 379wskbd[0-9]*) 380 M wskbd$U c 61 $U 600 381 ;; 382 383wscons) 384 R wsmouse0 wsmouse1 wsmouse2 wsmouse3 wskbd0 wskbd1 wskbd2 385 R wskbd3 wsmux ttyCcfg ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5 386 R ttyC6 ttyC7 ttyC8 ttyC9 ttyCa ttyCb 387 ;; 388 389tty[C-J]*) 390 U=${i##tty[C-J]} 391 case $i in 392 ttyC*) n=C m=0;; 393 ttyD*) n=D m=256;; 394 ttyE*) n=E m=512;; 395 ttyF*) n=F m=768;; 396 ttyG*) n=G m=1024;; 397 ttyH*) n=H m=1280;; 398 ttyI*) n=I m=1536;; 399 ttyJ*) n=J m=1792;; 400 esac 401 case $U in 402 [0-9a-f]) M tty$n$U c 60 $((16#$U+$m)) 600;; 403 cfg) M tty${n}cfg c 60 $((255+$m)) 600;; 404 *) echo bad unit $U for $i; exit 1;; 405 esac 406 ;; 407 408pty*) 409 if [ $U -gt 15 ]; then 410 echo bad unit for pty in: $i 411 continue 412 fi 413 set -A letters p q r s t u v w x y z P Q R S T 414 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 \ 415 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 \ 416 Y Z 417 418 name=${letters[$U]} 419 n=0 420 while [ $n -lt 62 ] 421 do 422 nam=$name${suffixes[$n]} 423 off=$(($U*62)) 424 M tty$nam c 4 $(($off+$n)) 425 M pty$nam c 5 $(($off+$n)) 426 n=$(($n+1)) 427 done 428 ;; 429 430ptm) 431 M ptm c 98 0 666 432 ;; 433 434tty[0-7][0-9a-f]) 435 U=${i#tty*} 436 o=$(h2d $U) 437 M tty$U c 12 $o 660 dialer uucp 438 M cua$U c 12 $(($o+128)) 660 dialer uucp 439 ;; 440 441st*) 442 n=$(($U*16)) 443 for pre in " " n e en 444 do 445 M ${pre}st$U b 25 $n 660 operator 446 M ${pre}rst$U c 25 $n 660 operator 447 n=$(($n+1)) 448 done 449 ;; 450 451vnd*) 452 dodisk vnd $U 19 19 $U 0 453 ;; 454 455rd*) 456 dodisk2 rd $U 18 18 $U 0 457 ;; 458 459ch*) 460 M ch$U c 27 $U 660 operator 461 ;; 462 463cd*) 464 dodisk2 cd $U 26 26 $U 0 465 ;; 466 467local) 468 test -s $T.local && sh $T.local 469 ;; 470 471all) 472 R gpio0 gpio1 gpio2 gpio3 gpio4 gpio5 gpio6 gpio7 gpio8 vnd0 473 R vnd1 vnd2 vnd3 sd0 sd1 sd2 sd3 sd4 sd5 sd6 sd7 sd8 sd9 cd0 474 R cd1 rd0 tap0 tap1 tap2 tap3 tun0 tun1 tun2 tun3 bio pty0 475 R diskmap vscsi0 ch0 bpf fuse pppx hotplug ptm local wscons 476 R pci0 pci1 pci2 pci3 uall rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 477 R rmidi5 rmidi6 rmidi7 tuner0 radio0 video0 video1 uk0 random 478 R tty00 tty01 tty02 tty03 tty04 tty05 tty06 tty07 tty08 tty09 479 R tty0a tty0b apm pf wd0 wd1 wd2 wd3 std st0 st1 fd 480 ;; 481 482wd*|sd*) 483 case $i in 484 wd*) dodisk wd $U 16 16 $U 0;; 485 sd*) dodisk sd $U 24 24 $U 0;; 486 esac 487 ;; 488 489*) 490 echo $i: unknown device 491 ;; 492esac 493done 494} 495R "$@" 496{ 497echo -n ${RMlist[*]} 498echo -n ${mklist[*]} 499echo -n ${MKlist[*]} 500echo -n ${whlist[*]} 501echo ${oplist[*]} 502} | if [ "$eo" = "echo" ]; then 503 cat 504else 505 sh 506fi 507