Annotation of kernel/src/MAKEDEV/MAKEDEV.csh, revision 1.1.1.1

1.1       root        1: #!/bin/sh -
                      2: 
                      3: ##
                      4: # Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      5: #
                      6: # @APPLE_LICENSE_HEADER_START@
                      7: # 
                      8: # Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      9: # Reserved.  This file contains Original Code and/or Modifications of
                     10: # Original Code as defined in and that are subject to the Apple Public
                     11: # Source License Version 1.1 (the "License").  You may not use this file
                     12: # except in compliance with the License.  Please obtain a copy of the
                     13: # License at http://www.apple.com/publicsource and read it before using
                     14: # this file.
                     15: # 
                     16: # The Original Code and all software distributed under the License are
                     17: # distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     18: # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     19: # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     20: # FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     21: # License for the specific language governing rights and limitations
                     22: # under the License.
                     23: # 
                     24: # @APPLE_LICENSE_HEADER_END@
                     25: ##
                     26: 
                     27: #
                     28: #      @(#)MAKEDEV     8.1 (Berkeley) 6/9/93
                     29: #
                     30: # Device "make" file.  Valid arguments:
                     31: #      std     standard devices
                     32: #      rhapsody        devices for rhapsody
                     33: #      local   configuration specific devices
                     34: # Tapes:
                     35: #      st*     SCSI mag tape driver
                     36: # Disks:
                     37: #      rd*     RAM disk
                     38: #      od*     Optical disk
                     39: #      oc      Optical disk controller
                     40: #      hd*     IDE disks
                     41: #      sd*     SCSI disks
                     42: #      fd*     Floppy disks
                     43: # Terminal multiplexors:
                     44: #      tty[ab] scc terminal drivers
                     45: # Pseudo terminals:
                     46: #      pty*    set of 16 master and slave pseudo terminals
                     47: # Printers:
                     48: #      np*     NeXT Printer
                     49: # Call units:
                     50: #      NONE
                     51: # Special purpose devices:
                     52: #      vid*    frame buffer
                     53: #      ev*     event driver
                     54: #      sg*     Generic SCSI Driver
                     55: #      nvram   Nonvolatile RAM driver
                     56: #      hfs_sd* HFS partitions on SCSI disks
                     57: #      hfs_hd* HFS partitions on IDE disks
                     58: #      hfs_fd* HFS partition on floppy disks
                     59: umask 77
                     60: PATH=/sbin:/bin/:/usr/bin:/usr/sbin:$PATH
                     61: export PATH
                     62: for i
                     63: do
                     64: case $i in
                     65: 
                     66: rhapsody)
                     67:        $0 std hd0 hd1 hfs_hd0 hfs_hd1 oc od0 od1 sd0 sd1 sd2 sd3 sd4 sd5 sd6 sd7 sd8 sd9 sd10 sd11 sd12 sd13 sd14 sd15 sc sg0 sg1 sg2 sg3 st0 st1 fd0 fd1 hfs_fd0 hfs_fd1 fc vol pty0 pty1 vid0 ev0 evs0 np0 nps0 pp nvram hfs_sd0 hfs_sd1 hfs_sd2 hfs_sd3 hfs_sd4 hfs_sd5 hfs_sd6 hfs_sd7 hfs_sd8 hfs_sd9 hfs_sd10 hfs_sd11 hfs_sd12 hfs_sd13 hfs_sd14 hfs_sd15
                     68:        ;;
                     69: 
                     70: std)
                     71:        mknod console   c 0 0   ; chmod 622 console
                     72:        mknod tty       c 2 0   ; chmod 666 tty
                     73:        mknod mem       c 3 0   ; chmod 640 mem ; chgrp kmem mem
                     74:        mknod kmem      c 3 1   ; chmod 640 kmem ; chgrp kmem kmem
                     75:        mknod null      c 3 2   ; chmod 666 null
                     76:        mknod dsp       c 3 3   ; chmod 666 dsp
                     77:        mknod klog      c 6 0   ; chmod 600 klog
                     78:        mknod drum      c 7 0   ; chmod 640 drum ; chgrp kmem drum
                     79:        mknod dialup0   c 16 0  ; chmod 600 dialup0
                     80:        mknod dialup1   c 16 1  ; chmod 600 dialup1
                     81:        mknod sound     c 36 0  ; chmod 600 sound
                     82:        ;;
                     83: 
                     84: od*|rd*|sd*|hd*)
                     85:        umask 2 ; unit=`expr $i : '..\(.*\)'`
                     86:        case $i in
                     87:        od*) name=od; blk=2; chr=9;;
                     88:        rd*) name=rd; blk=5; chr=15;;
                     89:        sd*) name=sd; blk=6; chr=14;;
                     90:        hd*) name=hd; blk=3; chr=15;;
                     91:        esac
                     92:        case $unit in
                     93:        0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|\
                     94:        17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)
                     95:                mknod ${name}${unit}a   b $blk `expr $unit '*' 8 + 0`
                     96:                mknod ${name}${unit}b   b $blk `expr $unit '*' 8 + 1`
                     97:                mknod ${name}${unit}c   b $blk `expr $unit '*' 8 + 2`
                     98:                mknod ${name}${unit}g   b $blk `expr $unit '*' 8 + 6`
                     99:                mknod r${name}${unit}a  c $chr `expr $unit '*' 8 + 0`
                    100:                mknod r${name}${unit}b  c $chr `expr $unit '*' 8 + 1`
                    101:                mknod r${name}${unit}c  c $chr `expr $unit '*' 8 + 2`
                    102:                mknod r${name}${unit}g  c $chr `expr $unit '*' 8 + 6`
                    103:                mknod ${name}${unit}d   b $blk `expr $unit '*' 8 + 3`
                    104:                mknod ${name}${unit}e   b $blk `expr $unit '*' 8 + 4`
                    105:                mknod ${name}${unit}f   b $blk `expr $unit '*' 8 + 5`
                    106:                mknod ${name}${unit}h   b $blk `expr $unit '*' 8 + 7`
                    107:                mknod r${name}${unit}d  c $chr `expr $unit '*' 8 + 3`
                    108:                mknod r${name}${unit}e  c $chr `expr $unit '*' 8 + 4`
                    109:                mknod r${name}${unit}f  c $chr `expr $unit '*' 8 + 5`
                    110:                mknod r${name}${unit}h  c $chr `expr $unit '*' 8 + 7`
                    111:                chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
                    112:                chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
                    113:                ;;
                    114:        *)
                    115:                echo bad unit for disk in: $i
                    116:                ;;
                    117:        esac
                    118:        umask 77
                    119:        ;;
                    120: 
                    121: # bknight - This case must precede the next one because it is a special case.
                    122: 
                    123: hfs_fd*)
                    124:        umask 2 ; unit=`expr $i : '......\(.*\)'`
                    125:        case $i in
                    126:        hfs_fd*) name=fd; blk=1; chr=41;;
                    127:        esac
                    128:        case $unit in
                    129:        0|1|2|3|4|5|6|7)
                    130:                mknod ${name}${unit}_hfs_a      b $blk `expr $unit '*' 8 + 128 + 0`
                    131:                chgrp operator ${name}${unit}_hfs_a
                    132:                chmod 660 ${name}${unit}_hfs_a
                    133:                ;;
                    134:        *)
                    135:                echo bad unit for HFS disk in: $i
                    136:                ;;
                    137:        esac
                    138:        umask 77
                    139:        ;;
                    140: 
                    141: hfs_*)
                    142:        umask 2 ; unit=`expr $i : '......\(.*\)'`
                    143:        case $i in
                    144:        hfs_sd*) name=sd; blk=6; chr=14;;
                    145:        hfs_hd*) name=hd; blk=3; chr=15;;
                    146:        esac
                    147:        case $unit in
                    148:        0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15)
                    149:                mknod ${name}${unit}_hfs_a      b $blk `expr $unit '*' 8 + 128 + 0`
                    150:                mknod ${name}${unit}_hfs_b      b $blk `expr $unit '*' 8 + 128 + 1`
                    151:                mknod ${name}${unit}_hfs_c      b $blk `expr $unit '*' 8 + 128 + 2`
                    152:                mknod ${name}${unit}_hfs_g      b $blk `expr $unit '*' 8 + 128 + 6`
                    153:                mknod ${name}${unit}_hfs_d      b $blk `expr $unit '*' 8 + 128 + 3`
                    154:                mknod ${name}${unit}_hfs_e      b $blk `expr $unit '*' 8 + 128 + 4`
                    155:                mknod ${name}${unit}_hfs_f      b $blk `expr $unit '*' 8 + 128 + 5`
                    156:                mknod ${name}${unit}_hfs_h      b $blk `expr $unit '*' 8 + 128 + 7`
                    157:                chgrp operator ${name}${unit}_hfs_[a-h]
                    158:                chmod 640 ${name}${unit}_hfs_[a-h]
                    159:                ;;
                    160:        *)
                    161:                echo bad unit for HFS disk in: $i
                    162:                ;;
                    163:        esac
                    164:        umask 77
                    165:        ;;
                    166: 
                    167: fd*)
                    168:        umask 2 ; unit=`expr $i : '..\(.*\)'`
                    169:        name=fd; blk=1; chr=41;
                    170:        case $unit in
                    171:        0|1|2|3|4|5|6|7)
                    172:                mknod ${name}${unit}a   b $blk `expr $unit '*' 8 + 0`
                    173:                mknod r${name}${unit}a  c $chr `expr $unit '*' 8 + 0`
                    174:                mknod r${name}${unit}b  c $chr `expr $unit '*' 8 + 1`
                    175:                chgrp operator ${name}${unit}[a-b] r${name}${unit}[a-b]
                    176:                chmod 660 ${name}${unit}[a-b] r${name}${unit}[a-b]
                    177:                ;;
                    178:        *)
                    179:                echo bad unit for disk in: $i
                    180:                ;;
                    181:        esac
                    182:        umask 77
                    183:        ;;
                    184:        
                    185: oc)
                    186:        mknod odc0      c 9 255         ; chmod 644 odc0
                    187:        ;;
                    188: 
                    189: fc)
                    190:        mknod fdc0      c 41 64         ; chmod 644 fdc0
                    191:        ;;
                    192: 
                    193: sc)
                    194:        mknod sdc0      c 14 128        ; chmod 644 sdc0
                    195:        ;;
                    196: 
                    197: vol)
                    198:        mknod vol0      c 42 0          ; chmod 644 vol0
                    199:        ;;
                    200: 
                    201: pp)
                    202:        mknod pp0       c 40 0          ; chmod 666 pp0
                    203:        ;;
                    204: 
                    205: nvram)
                    206:        mknod nvram     c 37 0          ; chmod 600 nvram
                    207:        ;;
                    208: 
                    209: sg*)
                    210:        umask 2 ; unit=`expr $i : '..\(.*\)'`
                    211:        case $i in
                    212:        sg*) chr=33;;
                    213:        esac
                    214:        case $unit in
                    215:        0|1|2|3)
                    216:                mknod $i        c $chr $unit
                    217:                chgrp operator $i
                    218:                chmod 666 $i 
                    219:                ;;
                    220:        *)
                    221:                echo bad unit for device in: $i
                    222:                ;;
                    223:        esac
                    224:        umask 77
                    225:        ;;
                    226: 
                    227: st*)
                    228:        umask 2 ; unit=`expr $i : '..\(.*\)'`
                    229:        case $i in
                    230:        st*) chr=34;;
                    231:        esac
                    232:        case $unit in
                    233:        0|1)
                    234:                one=`expr $unit '*' 8 + 1`
                    235:                two=`expr $unit '*' 8 + 2`
                    236:                three=`expr $unit '*' 8 + 3`
                    237:                mknod rst$unit  c $chr `expr $unit '*' 8`
                    238:                mknod nrst$unit c $chr $one
                    239:                mknod rxt$unit  c $chr $two
                    240:                mknod nrxt$unit c $chr $three
                    241:                chgrp operator rst$unit
                    242:                chgrp operator nrst$unit
                    243:                chgrp operator rxt$unit
                    244:                chgrp operator nrxt$unit
                    245:                chmod 666 rst$unit 
                    246:                chmod 666 nrst$unit 
                    247:                chmod 666 rxt$unit 
                    248:                chmod 666 nrxt$unit 
                    249:                ;;
                    250:        *)
                    251:                echo bad unit for device in: $i
                    252:                ;;
                    253:        esac
                    254:        umask 77
                    255:        ;;
                    256: 
                    257: pty*)
                    258:        class=`expr $i : 'pty\(.*\)'`
                    259:        case $class in
                    260:        0) offset=0 name=p;;
                    261:        1) offset=16 name=q;;
                    262:        2) offset=32 name=r;;
                    263:        3) offset=48 name=s;;
                    264:        4) offset=64 name=t;;
                    265:        5) offset=80 name=u;;
                    266:        *) echo bad unit for pty in: $i;;
                    267:        esac
                    268:        case $class in
                    269:        0|1|2|3|4|5)
                    270:                umask 0
                    271:                eval `echo $offset $name | awk ' { b=$1; n=$2 } END {
                    272:                        for (i = 0; i < 16; i++)
                    273:                                printf("mknod tty%s%x c 4 %d; \
                    274:                                        mknod pty%s%x c 5 %d; ", \
                    275:                                        n, i, b+i, n, i, b+i); }'`
                    276:                umask 77
                    277:                ;;
                    278:        esac
                    279:        ;;
                    280: 
                    281: vid*)
                    282:        name=vid; chr=13;
                    283:        unit=`expr $i : 'vid\(.*\)'`
                    284:        case $unit in
                    285: 
                    286:        0|1|2|3|4|5|6|7)
                    287:                umask 0
                    288:                mknod ${name}${unit} c ${chr} ${unit}
                    289:                chmod 600 vid${unit}
                    290:                umask 77
                    291:                ;;
                    292:        *)
                    293:                echo bad unit for ${name} in: $i
                    294:                ;;
                    295:        esac
                    296:        ;;
                    297: 
                    298: ev*|evs*|np*|nps*|midi*|ipl*)
                    299:        case $i in
                    300:        nps*)
                    301:                name=nps; chr=39;
                    302:                unit=`expr $i : 'nps\(.*\)'`
                    303:                ;;
                    304:        np*)
                    305:                name=np; chr=8;
                    306:                unit=`expr $i : 'np\(.*\)'`
                    307:                ;;
                    308:        ev?)
                    309:                name=ev; chr=10;
                    310:                unit=`expr $i : 'ev\(.*\)'`
                    311:                ;;
                    312:        evs?)
                    313:                name=evs; chr=40;
                    314:                unit=`expr $i : 'evs\(.*\)'`
                    315:                ;;
                    316:        ipl*)
                    317:                name=ipl; chr=35;
                    318:                unit=`expr $i : 'ipl\(.*\)'`
                    319:                ;;
                    320:        esac
                    321:        case $unit in
                    322: 
                    323:        0|1|2|3|4|5|6|7)
                    324:                umask 0
                    325:                mknod ${name}${unit} c ${chr} ${unit}
                    326:                umask 77
                    327:                ;;
                    328:        *)
                    329:                echo bad unit for ${name} in: $i
                    330:                ;;
                    331:        esac
                    332:        ;;
                    333: 
                    334: tty?)
                    335:        case $i in
                    336:        tty?)
                    337:                name=tty; chr=11;
                    338:                unit=`expr $i : 'tty\(.*\)'`
                    339:                ;;
                    340:        esac
                    341:        case $unit in
                    342:        a|b)
                    343:                numunit=`echo $unit | tr ab 01`
                    344:                umask 0
                    345:                mknod ${name}${unit} c ${chr} ${numunit}
                    346:                umask 77
                    347:                ;;
                    348:        *)
                    349:                echo bad unit for ${name} in: $i
                    350:                ;;
                    351:        esac
                    352:        ;;
                    353: 
                    354: local)
                    355:        sh /private/dev/MAKEDEV.local
                    356:        ;;
                    357: esac
                    358: done

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.