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