[BACK]Return to MAKEDEV.tmpl CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / etc

Annotation of src/etc/MAKEDEV.tmpl, Revision 1.119

1.1       jdolecek    1: #!/bin/sh -
1.119   ! apb         2: #      $NetBSD: MAKEDEV.tmpl,v 1.118 2008/11/28 16:04:31 joerg Exp $
1.1       jdolecek    3: #
1.104     apb         4: # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
1.1       jdolecek    5: # All rights reserved.
                      6: #
                      7: # Redistribution and use in source and binary forms, with or without
                      8: # modification, are permitted provided that the following conditions
                      9: # are met:
                     10: # 1. Redistributions of source code must retain the above copyright
                     11: #    notice, this list of conditions and the following disclaimer.
                     12: # 2. Redistributions in binary form must reproduce the above copyright
                     13: #    notice, this list of conditions and the following disclaimer in the
                     14: #    documentation and/or other materials provided with the distribution.
                     15: #
                     16: # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     17: # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     18: # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     19: # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     20: # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     21: # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     22: # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     23: # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     24: # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     25: # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     26: # POSSIBILITY OF SUCH DAMAGE.
                     27: #
                     28: #
                     29: ###########################################################################
                     30: #
                     31: #   PLEASE RUN "cd ../share/man/man8 ; make makedevs"
                     32: #   AFTER CHANGING THIS FILE, AND COMMIT THE UPDATED MANPAGE!
                     33: #
                     34: ###########################################################################
                     35: #
1.19      jdolecek   36: # Device "make" file.  Valid special arguments:
1.1       jdolecek   37: #      all     makes all known devices, including local devices.
                     38: #              Tries to make the 'standard' number of each type.
                     39: #      init    A set of devices that is used for MFS /dev by init.
                     40: #              May be equal to "all".
                     41: #      floppy  devices to be put on install floppies
                     42: #      ramdisk devices to be put into INSTALL kernel ramdisks.
                     43: #      std     standard devices
                     44: #      local   configuration specific devices
1.19      jdolecek   45: #      wscons  make wscons devices
1.1       jdolecek   46: #      usbs    make USB devices
                     47: #      isdns   make ISDN devices
                     48: #
                     49: # Tapes:
                     50: #      st*     SCSI tapes
                     51: #      wt*     QIC-interfaced (e.g. not SCSI) 3M cartridge tape
                     52: #      ht*     MASSBUS TM03 and TU??
                     53: #      mt*     MSCP tapes (e.g. TU81, TK50)
                     54: #      tm*     UNIBUS TM11 and TE10 emulations (e.g. Emulex TC-11)
                     55: #      ts*     UNIBUS TS11
                     56: #      ut*     UNIBUS TU45 emulations (e.g. si 9700)
                     57: #      uu*     TU58 cassettes on DL11 controller
                     58: #
                     59: # Disks:
                     60: #      ccd*    concatenated disk devices
                     61: #      cd*     SCSI or ATAPI CD-ROM
                     62: #      cgd*    cryptographic disk devices
                     63: #      raid*   RAIDframe disk devices
                     64: #      sd*     SCSI disks
                     65: #      wd*     "winchester" disk drives (ST506,IDE,ESDI,RLL,...)
                     66: #      bmd*    Nereid bank memory disks
                     67: #      ed*     IBM PS/2 ESDI disk devices
                     68: #      fd*     "floppy" disk drives (3 1/2", 5 1/4")
1.11      hannken    69: #      fss*    Files system snapshot devices
1.1       jdolecek   70: #      gdrom*  Dreamcast "gigadisc" CD-ROM drive
                     71: #      hk*     UNIBUS RK06 and RK07
                     72: #      hp*     MASSBUS RM??
                     73: #      ld*     Logical disk devices (e.g., hardware RAID)
                     74: #      mcd*    Mitsumi CD-ROM
                     75: #      md*     memory pseudo-disk devices
                     76: #      ofdisk* OpenFirmware disk devices
                     77: #      ra*     MSCP disks (RA??, RD??)
                     78: #      rb*     730 IDC w/ RB80 and/or RB02
                     79: #      rd*     HDC9224 RD disks on VS2000
                     80: #      rl*     UNIBUS RL02
                     81: #      rx*     MSCP floppy disk (RX33/50/...)
                     82: #      up*     other UNIBUS devices (e.g. on Emulex SC-21V controller)
                     83: #      vnd*    "file" pseudo-disks
1.39      bouyer     84: #      xbd*    Xen virtual disks
1.1       jdolecek   85: #      xd*     Xylogic 753/7053 disks
                     86: #      xy*     Xylogic 450/451 disks
                     87: #
                     88: # Pointing devices:
                     89: #      wsmouse* wscons mouse events
                     90: #      lms*    Logitech bus mouse
                     91: #      mms*    Microsoft bus mouse
                     92: #      qms*    "quadrature mouse"
                     93: #      pms*    PS/2 mouse
                     94: #      mouse   mouse (provides events, for X11)
                     95: #
                     96: # Keyboard devices:
                     97: #      wskbd*  wscons keyboard events
                     98: #      kbd     raw keyboard (provides events, for X11)
                     99: #      kbdctl  keyboard control
                    100: #
                    101: # Terminals/Console ports:
                    102: #      tty[01]*        standard serial ports
                    103: #      tty0*   SB1250 ("sbscn") serial ports (sbmips)
                    104: #      ttyE*   wscons - Workstation console ("wscons") glass-tty emulators
                    105: #      ttyCZ?  Cyclades-Z multiport serial boards.  Each "unit"
                    106: #              makes 64 ports.
                    107: #      ttyCY?  Cyclom-Y multiport serial boards. Each "unit" makes
                    108: #              32 ports.
                    109: #      ttye*   ITE bitmapped consoles
                    110: #      ttyv0   pccons
                    111: #      ttyC?   NS16550 ("com") serial ports
                    112: #      ttyS*   SA1110 serial port (hpcarm)
                    113: #      ttyTX?  TX39 internal serial ports (hpcmips)
                    114: #      ttyB?   DEC 3000 ZS8530 ("scc") serial ports (alpha)
                    115: #      ttyA*   mfc serial ports (amiga)
                    116: #      ttyB*   msc serial ports (amiga)
                    117: #      ttyC*   com style serial ports (DraCo, HyperCom) (amiga)
                    118: #              On the DraCo, units 0 and 1 are the built-in "modem" and
                    119: #              "mouse" ports, if configured.
                    120: #      ttyA0   8530 Channel A (formerly ser02) (atari)
                    121: #      ttyA1   8530 Channel B (formerly mdm02) (atari)
                    122: #      ttyB0   UART on first 68901 (formerly mdm01) (atari)
                    123: #      ixpcom  IXP12x0 COM ports
1.34      joff      124: #      epcom   EP93xx COM ports
1.9       tsutsui   125: #      ttyM?   HP200/300 4 port serial mux interface (hp300)
1.6       jdolecek  126: #      ttya    "ttya" system console (luna68k)
1.1       jdolecek  127: #      ttyb    second system serial port (luna68k)
                    128: #      tty*    Onboard serial ports (mvme68k)
                    129: #              On the mvme147 these are: ttyZ1, ttyZ2 and ttyZ3.
                    130: #              On the mvme167, and '177: ttyC1, ttyC2 and ttyC3.
                    131: #              Note that tty[CZ]0 is grabbed by the console device
                    132: #              so is not created by default
                    133: #      dc*     PMAX 4 channel serial interface (kbd, mouse, modem, printer)
                    134: #      scc*    82530 serial interface (pmax)
                    135: #      ttyZ*   Zilog 8530 ("zstty") serial ports
                    136: #      tty[abcd]       Built-in serial ports (sparc)
                    137: #      tty*    Z88530 serial controllers (sparc64)
                    138: #      ttyh*   SAB82532 serial controllers (sparc64)
                    139: #      tty[a-j]        Built-in serial ports (sun2, sun3)
                    140: #      ttyC?   pccons (arc)
                    141: #      dz*     UNIBUS DZ11 and DZ32 (vax)
                    142: #      dh*     UNIBUS DH11 and emulations (e.g. Able DMAX, Emulex CS-11) (vax)
                    143: #      dmf*    UNIBUS DMF32 (vax)
                    144: #      dhu*    UNIBUS DHU11 (vax)
                    145: #      dmz*    UNIBUS DMZ32 (vax)
                    146: #      dl*     UNIBUS DL11 (vax)
1.39      bouyer    147: #      xencons Xen virtual console
1.1       jdolecek  148: #
                    149: # Terminal multiplexors:
                    150: #      dc*     4 channel serial interface (keyboard, mouse, modem, printer)
                    151: #      dh*     UNIBUS DH11 and emulations (e.g. Able DMAX, Emulex CS-11)
                    152: #      dhu*    UNIBUS DHU11
                    153: #      dl*     UNIBUS DL11
                    154: #      dmf*    UNIBUS DMF32
                    155: #      dmz*    UNIBUS DMZ32
                    156: #      dz*     UNIBUS DZ11 and DZ32
                    157: #      scc*    82530 serial interface
                    158: #
                    159: # Call units:
                    160: #      dn*     UNIBUS DN11 and emulations (e.g. Able Quadracall)
                    161: #
                    162: # Pseudo terminals:
1.109     apb       163: #      ptm     pty multiplexor device, and pts directory
1.26      christos  164: #      pty*    set of 16 master and slave pseudo terminals
1.1       jdolecek  165: #      opty    first 16 ptys, to save inodes on install media
                    166: #      ipty    first 2 ptys, for install media use only
                    167: #
                    168: # Printers:
                    169: #      arcpp*  Archimedes parallel port
                    170: #      lpt*    stock lp
                    171: #      lpa*    interruptless lp
                    172: #      par*    Amiga motherboard parallel port
1.108     hauke     173: #      cpi*    Macintosh Nubus CSI parallel printer card
1.1       jdolecek  174: #
                    175: # USB devices:
                    176: #      usb*    USB control devices
                    177: #      uhid*   USB generic HID devices
                    178: #      ulpt*   USB printer devices
                    179: #      ugen*   USB generic devices
                    180: #      urio*   USB Diamond Rio 500 devices
                    181: #      uscanner*       USB scanners
                    182: #      ttyU*   USB modems
1.47      skrll     183: #      ttyY*   USB serial adapters
1.1       jdolecek  184: #
                    185: # ISDN devices:
                    186: #      isdn    communication between userland isdnd and kernel
                    187: #      isdnctl control device
                    188: #      isdnbchan* raw b-channel access
                    189: #      isdntel*        telephony device
                    190: #      isdnteld*       telephony dialout device
                    191: #      isdntrc*        trace device
                    192: #
                    193: # Video devices:
                    194: #      bwtwo*  monochromatic frame buffer
                    195: #      cgtwo*  8-bit color frame buffer
                    196: #      cgthree*        8-bit color frame buffer
                    197: #      cgfour* 8-bit color frame buffer
                    198: #      cgsix*  accelerated 8-bit color frame buffer
                    199: #      cgeight*        24-bit color frame buffer
1.6       jdolecek  200: #      etvme   Tseng et-compatible cards on VME (atari)
1.1       jdolecek  201: #      ik*     UNIBUS interface to Ikonas frame buffer
1.6       jdolecek  202: #      leo     Circad Leonardo VME-bus true color (atari)
1.1       jdolecek  203: #      ps*     UNIBUS interface to Picture System 2
                    204: #      qv*     QVSS (MicroVAX) display
                    205: #      tcx*    accelerated 8/24-bit color frame buffer
                    206: #
                    207: # Maple bus devices:
                    208: #      maple   Maple bus control devices
                    209: #      mlcd*   Maple bus LCD devices
                    210: #      mmem*   Maple bus storage devices
                    211: #
1.46      kiyohara  212: # IEEE1394 bus devices:
                    213: #      fw*     IEEE1394 bus generic node access devices
                    214: #      fwmem*  IEEE1394 bus physical memory of the remote node access devices
                    215: #
1.1       jdolecek  216: # Special purpose devices:
                    217: #      ad*     UNIBUS interface to Data Translation A/D converter
                    218: #      agp*    AGP GART devices
                    219: #      altq    ALTQ control interface
1.56      bouyer    220: #      amr*    AMI MegaRaid control device
1.1       jdolecek  221: #      apm     power management device
                    222: #      audio*  audio devices
1.10      isaki     223: #      bell*   OPM bell device (x68k)
1.1       jdolecek  224: #      bktr    Brooktree 848/849/878/879 based TV cards
1.32      christos  225: #      bpf     packet filter
1.62      plunky    226: #      bthub   Bluetooth Device Hub control interface
1.1       jdolecek  227: #      cfs*    Coda file system device
                    228: #      ch*     SCSI media changer
                    229: #      cir*    Consumer IR
                    230: #      clockctl clock control for non root users
1.87      ad        231: #      cpuctl  CPU control
1.1       jdolecek  232: #      crypto  hardware crypto access driver
                    233: #      dmoverio hardware-assisted data movers
                    234: #      dpt*    DPT/Adaptec EATA RAID management interface
                    235: #      dpti*   DPT/Adaptec I2O RAID management interface
1.6       jdolecek  236: #      fb*     PMAX generic framebuffer pseudo-device
1.1       jdolecek  237: #      fd      file descriptors
                    238: #      grf*    graphics frame buffer device
                    239: #      hil     HP300 HIL input devices
                    240: #      icp     ICP-Vortex/Intel RAID control interface
                    241: #      iic*    IIC bus device
1.69      ad        242: #      io      x86 IOPL access for COMPAT_10, COMPAT_FREEBSD
1.1       jdolecek  243: #      iop*    I2O IOP control interface
                    244: #      ipl     IP Filter
                    245: #      irframe* IrDA physical frame
                    246: #      ite*    terminal emulator interface to HP300 graphics devices
                    247: #      joy*    joystick device
                    248: #      kttcp   kernel ttcp helper device
1.61      ad        249: #      lockstat kernel locking statistics
1.1       jdolecek  250: #      magma*  Magma multiport serial/parallel cards
                    251: #      midi*   MIDI
                    252: #      mlx*    Mylex DAC960 control interface
                    253: #      mly*    Mylex AcceleRAID/eXtremeRAID control interface
                    254: #      np*     UNIBUS Ethernet co-processor interface, for downloading.
                    255: #      nsmb*   SMB requester
                    256: #      openfirm OpenFirmware accessor
1.89      jmcneill  257: #      pad*    Pseudo-audio device driver
1.1       jdolecek  258: #      pci*    PCI bus access devices
1.31      peter     259: #      pf      PF packet filter
1.10      isaki     260: #      pow*    power management device (x68k)
1.90      pooka     261: #      putter  Pass-to-Userspace Transporter
1.1       jdolecek  262: #      px*     PixelStamp Xserver access
                    263: #      radio*  radio devices
1.8       jdolecek  264: #      random  Random number generator
1.6       jdolecek  265: #      rtc*    RealTimeClock
1.1       jdolecek  266: #      satlink* PlanetConnect satellite receiver driver
1.8       jdolecek  267: #      scsibus* SCSI busses
1.1       jdolecek  268: #      se*     SCSI Ethernet
                    269: #      ses*    SES/SAF-TE SCSI Devices
                    270: #      speaker PC speaker              (XXX - installed)
1.10      isaki     271: #      sram    battery backuped memory (x68k)
1.1       jdolecek  272: #      ss*     SCSI scanner
                    273: #      stic*   PixelStamp interface chip
                    274: #      sysmon  System Monitoring hardware
1.38      cube      275: #      tap*    virtual Ethernet device
1.1       jdolecek  276: #      tun*    network tunnel driver
1.66      manu      277: #      twa     3ware Apache control interface
1.1       jdolecek  278: #      twe     3ware Escalade control interface
                    279: #      uk*     unknown SCSI device
                    280: #      veriexec verified executable fingerprint loader
1.110     jmcneill  281: #      video*  video capture devices
                    282: #      view*   generic interface to graphic displays (Amiga)
1.1       jdolecek  283: #      vmegen* generic VME access
                    284: #      wsfont* console font control
                    285: #      wsmux*  wscons event multiplexor
1.39      bouyer    286: #      xenevt  Xen event interface
1.1       jdolecek  287:
1.15      lukem     288:
1.79      apb       289: #
1.119   ! apb       290: # NOTE:
1.79      apb       291: #
1.119   ! apb       292: # * MAKEDEV is used both as a standalone script (via "sh ./MAKEDEV
        !           293: #   all" or similar), and as a function library for MAKEDEV.local (via
        !           294: #   "MAKEDEV_AS_LIBRARY=1 . MAKEDEV").  Because of this, the script
        !           295: #   should consist almost entirely of function definitions, apart from a
        !           296: #   few lines right at the end.
        !           297: #
        !           298: # * MAKEDEV may be executed in an environment that is missing some
        !           299: #   common commands.  For example, it may be executed from a minimal
        !           300: #   system used during installation, or it may be executed early in the
        !           301: #   boot sequence before most file systems have been mounted.  It may
        !           302: #   also be executed in a cross-build environment on a non-NetBSD host.
1.79      apb       303: #
                    304:
                    305: usage()
                    306: {
                    307:        cat 1>&2 << _USAGE_
1.104     apb       308: Usage: ${0##*/} [-fMs] [-m mknod] [-p pax] [-t mtree] special [...]
1.79      apb       309:        Create listed special devices.  Options:
                    310:        -f              Force permissions to be updated on existing devices.
1.94      apb       311:        -M              Create memory file system.
1.79      apb       312:        -m mknod        Name of mknod(8) program.  [\$TOOL_MKNOD or mknod]
1.104     apb       313:        -p pax          Name of pax(1) program.  [\$TOOL_PAX or pax]
1.79      apb       314:        -s              Generate mtree(8) specfile instead of creating devices.
1.104     apb       315:        -t mtree        Name of mtree(8) program.  [\$TOOL_MTREE or mtree]
1.79      apb       316:
                    317: _USAGE_
                    318:        exit 1
                    319: }
                    320:
                    321: # zeropad width number
                    322: #      display number with a zero (`0') padding of width digits.
                    323: #
                    324: zeropad()
                    325: {
                    326:        case $(($1 - ${#2})) in
                    327:        5)      echo 00000$2;;
                    328:        4)      echo 0000$2;;
                    329:        3)      echo 000$2;;
                    330:        2)      echo 00$2;;
                    331:        1)      echo 0$2;;
                    332:        0)      echo $2;;
1.104     apb       333:        *)      die "bad padding" ;;
1.79      apb       334:        esac
                    335: }
                    336:
                    337: # hexprint number
                    338: #      display (base10) number as hexadecimal
                    339: #
                    340: hexprint()
                    341: {
1.81      dsl       342:        val="$(($1 + 0))"
                    343:        hex=
                    344:        set -- 0 1 2 3 4 5 6 7 8 9 a b c d e f
                    345:        while [ "$val" -gt 0 ]; do
                    346:                eval hex=\$$(($val % 16 + 1))\$hex
                    347:                val="$(($val / 16))"
                    348:        done
                    349:        echo "${hex:-0}"
1.79      apb       350: }
                    351:
1.92      apb       352: # linecount multiline_string
                    353: #      count the number of lines in the string
                    354: #
                    355: linecount()
                    356: {
                    357:        local IFS='
                    358: ' # just a newline, no other white space between the quotes
                    359:        set -- $1
                    360:        echo $#
                    361: }
                    362:
1.97      apb       363: # nooutput -12 cmd [args...]
                    364: #      run a command with stdout and/or stderr ignored.
1.105     apb       365: #      "nooutput -1 cmd" is like "cmd >/dev/null";
                    366: #      "nooutput -2 cmd" is like "{ cmd ; } 2>/dev/null";
                    367: #      "nooutput -12 cmd" is like "{ cmd ; } >/dev/null 2>&1";
                    368: #      except they should work even if /dev/null doesn't [yet] exist.
                    369: #
                    370: #      The "{...}" wrapper used in cases where stderr is redirected
                    371: #      serves to capture shell error messages such as "cmd: not found".
1.97      apb       372: #
                    373: nooutput()
                    374: {
                    375:        local flags="$1" ; shift
                    376:        local junk
                    377:        case "$flags" in
                    378:        "-1")   junk="$( "$@" )" ;;
1.105     apb       379:        "-2")   exec 4>&1 ; junk="$( { "$@" ; } 2>&1 1>&4 )" ; exec 4>&- ;;
                    380:        "-12")  junk="$( { "$@" ; } 2>&1 )" ;;
1.97      apb       381:        *)      warn "Incorrect use of nooutput" ;;
                    382:        esac
                    383: }
                    384:
1.96      apb       385: # check_pax path_to_pax
1.104     apb       386: #      Check whether pax exists and supports the command line options
                    387: #      and input format that we will want to use.
1.96      apb       388: #
                    389: check_pax()
                    390: {
                    391:        local pax="$1"
1.97      apb       392:        echo ". type=dir optional" | nooutput -12 "${pax}" -r -w -M -pe .
1.96      apb       393: }
                    394:
1.104     apb       395: # check_mtree path_to_mtree
                    396: #      Check whether mtree exists and supports the command line options
                    397: #      and input format that we will want to use.
                    398: #
                    399: check_mtree()
                    400: {
                    401:        local mtree="$1"
                    402:        echo ". type=dir optional" | nooutput -12 "${mtree}" -e -U
                    403: }
                    404:
1.96      apb       405: # setup args...
                    406: #      Parse command line arguments, exit on error.
                    407: #      Callers should shift $((OPTIND - 1)) afterwards.
                    408: #
1.79      apb       409: setup()
                    410: {
                    411:        PATH=/sbin:/usr/sbin:/bin:/usr/bin:/rescue
                    412:
1.104     apb       413:        : ${TOOL_MKNOD:=mknod}
                    414:        : ${TOOL_MTREE:=mtree}
                    415:        : ${TOOL_PAX:=pax}
1.82      apb       416:        do_create_mfs=false
1.79      apb       417:        do_force=false
1.94      apb       418:        do_mknod=false
1.82      apb       419:        do_pax=false
1.104     apb       420:        do_mtree=false
1.82      apb       421:        do_redirect=false
1.79      apb       422:        do_specfile=false
1.82      apb       423:        opts=
1.104     apb       424:        while getopts Mfm:p:st: ch; do
                    425:                # Note that $opts is only for options pased through to
                    426:                # MAKEDEV.local, not for all options.
1.79      apb       427:                case ${ch} in
1.84      dyoung    428:                M)
1.82      apb       429:                        # "-M" sets do_create_mfs;
1.94      apb       430:                        # "-M -M" is for use from init(8), and sets do_redirect
1.82      apb       431:                        do_redirect=$do_create_mfs
                    432:                        do_create_mfs=true
                    433:                        ;;
                    434:                f)      do_force=true
                    435:                        opts="${opts} -f"
                    436:                        ;;
                    437:                m)      TOOL_MKNOD=${OPTARG}
1.94      apb       438:                        do_mknod=true
1.82      apb       439:                        opts="${opts} -m ${OPTARG}"
                    440:                        ;;
                    441:                p)      TOOL_PAX="${OPTARG}"
1.96      apb       442:                        if check_pax "${TOOL_PAX}"; then
1.83      apb       443:                                do_pax=true
1.94      apb       444:                                # do not add this to $opts; we will later
                    445:                                # add "-s" instead.
1.83      apb       446:                        else
                    447:                                warn "Ignored -p option:" \
                    448:                                        "${TOOL_PAX} is missing or broken"
1.94      apb       449:                                do_mknod=true
1.83      apb       450:                        fi
1.82      apb       451:                        ;;
                    452:                s)      do_specfile=true
                    453:                        opts="${opts} -s"
                    454:                        ;;
1.104     apb       455:                t)      TOOL_MTREE="${OPTARG}"
                    456:                        if check_mtree "${TOOL_MTREE}"; then
                    457:                                do_mtree=true
                    458:                                # do not add this to $opts; we will later
                    459:                                # add "-s" instead.
                    460:                        else
                    461:                                warn "Ignored -t option:" \
                    462:                                        "${TOOL_MTREE} is missing or broken"
                    463:                                do_mknod=true
                    464:                        fi
                    465:                        ;;
1.79      apb       466:                *)      usage ;;
                    467:                esac
                    468:        done
                    469:
                    470:        shift $((${OPTIND} - 1))
                    471:        [ $# -gt 0 ] || usage
                    472:
                    473:        u_root="%uid_root%"
                    474:        u_uucp="%uid_uucp%"
                    475:        g_kmem="%gid_kmem%"
                    476:        g_ntpd="%gid_ntpd%"
                    477:        g_operator="%gid_operator%"
                    478:        g_wheel="%gid_wheel%"
                    479:        dialin=0
                    480:        dialout=524288
                    481:        callunit=262144
                    482:
                    483:        # only allow read&write for owner by default
                    484:        umask 077
                    485:
1.119   ! apb       486:        # Set fdesc_mounted=true if the fdesc file system is mounted
        !           487:        # on the current directory (typically "/dev").
        !           488:        # Later, this will be used to suppress creation of device nodes
        !           489:        # that are supplied by the fdesc file system.
        !           490:        #
        !           491:        fdesc_mounted=false
1.79      apb       492:        if [ -d fd ]; then
1.119   ! apb       493:                # Parse the output from "mount -u -o nosuchoption .".
        !           494:                # We don't parse the output from df(1) because that's
        !           495:                # less likely to be available on install media.
        !           496:                #
        !           497:                # If the current directory is a mount point for the
        !           498:                # fdesc file system, then the expected output (whether
        !           499:                # or not the current user is root) is:
        !           500:                #       mount_fdesc: -o suchoption: option not supported.
        !           501:                #
        !           502:                # If the current directory is not a mount point, then
        !           503:                # the expected output is:
        !           504:                #       mount: .: unknown special file or file system.
        !           505:                #
        !           506:                # If we are not running on NetBSD, or mount(8) is not
        !           507:                # found, then we should get some other error message.
        !           508:                #
        !           509:                case "$({ LC_ALL=C mount -u -o nosuchoption . ; } 2>&1)" in
        !           510:                *mount_fdesc*)  fdesc_mounted=true ;;
1.79      apb       511:                esac
                    512:        fi
                    513:
1.94      apb       514:        # do_force requires mknod
                    515:        if $do_force; then
1.104     apb       516:                if $do_mtree || $do_pax || $do_specfile; then
                    517:                        die "-f option works only with mknod"
1.94      apb       518:                fi
                    519:                do_mknod=true
                    520:        fi
                    521:
1.104     apb       522:        # If no explicit method was specified on the command line or
                    523:        # forced above, then use one of mtree, pax, or mknod, in that
                    524:        # order of preference.
                    525:        #
                    526:        # mtree is preferred because it's fast and designed for the
                    527:        # purpose.  However, it's unlikely to be available early in the
                    528:        # boot sequence, when init(8) may invoke MAKEDEV(8).
                    529:        #
                    530:        # pax is usually acceptable, and it's likely to be available
                    531:        # early in the boot sequence.  However, it's much slower than mtree.
                    532:        #
                    533:        # mknod is just very slow, because the shell has to fork for
                    534:        # each device node.
                    535:        #
                    536:        if ! ( $do_mtree || $do_pax || $do_mknod || $do_specfile ); then
                    537:                if check_mtree "${TOOL_MTREE}"; then
                    538:                        do_mtree=true
                    539:                elif check_pax "${TOOL_PAX}"; then
1.94      apb       540:                        do_pax=true
                    541:                else
                    542:                        do_mknod=true
                    543:                fi
                    544:        fi
                    545:
1.104     apb       546:        # Now we need exactly one node-creation method.
                    547:        case $(( $($do_mtree && echo 1 || echo 0) + \
                    548:                $($do_pax && echo 1 || echo 0) + \
1.94      apb       549:                $($do_mknod && echo 1 || echo 0) + \
                    550:                $($do_specfile && echo 1 || echo 0) ))
                    551:        in
                    552:        1)      : OK ;;
1.104     apb       553:        *)      die "-m, -p, -s, and -t options are mutually exclusive" ;;
1.94      apb       554:        esac
                    555:
                    556:        # If we are using mknod, then decide what options to pass it.
                    557:        if $do_mknod; then
                    558:                MKNOD="${TOOL_MKNOD:-mknod} -F netbsd"
                    559:                if $do_force; then
                    560:                        MKNOD="${MKNOD} -R"
                    561:                else
                    562:                        MKNOD="${MKNOD} -r"
                    563:                fi
                    564:        fi
                    565:
1.104     apb       566:        # do_mtree or do_pax internally implies do_specfile.
                    567:        # This happens after checking for mutually-exclusive options.
                    568:        if ($do_mtree || $do_pax) && ! $do_specfile; then
1.82      apb       569:                do_specfile=true
                    570:                opts="${opts} -s"
1.79      apb       571:        fi
                    572: }
                    573:
1.97      apb       574: # wrap_makedev makedev_name ...
                    575: #      Invoke a makedev-like function, with additional processing
                    576: #      as appropriate for use from the outer level.
                    577: #
                    578: wrap_makedev()
                    579: {
                    580:        if $do_specfile; then
1.104     apb       581:                # "." must appear as the first line of the specfile.
                    582:                # "optional" means do not create the directory itself.
1.97      apb       583:                echo ". type=dir optional"
                    584:        fi
                    585:        "$@"
                    586: }
                    587:
                    588: # makedev_main makedev_name args...
1.104     apb       589: #      Perform most of the work of the main program.  makedev_name
                    590: #      is typically "makedev", but may be the name of some other
                    591: #      makedev-like function (if we are invoked from MAKEDEV.local or
                    592: #      some other script).  The other args to this function are the
1.97      apb       593: #      command line args with which the MAKEDEV (or MAKEDEV.local)
                    594: #      script was invoked.
                    595: #
                    596: makedev_main()
                    597: {
                    598:        local makedev="$1" ; shift
                    599:
                    600:        # Parse command line args
                    601:        setup ${1+"$@"}
                    602:        shift $((${OPTIND}-1))
                    603:
                    604:        if $do_create_mfs; then
                    605:                # Count inodes and create mfs file system.
                    606:                # The makedev call merely updates $count_nodes.
                    607:                count_nodes=0
                    608:                $makedev ${1+"$@"}
                    609:                create_mfs_dev $count_nodes
                    610:                unset count_nodes
                    611:        fi
                    612:
1.104     apb       613:        # If using mtree or pax, then wrap_makedev should print an mtree
                    614:        # specification, which we postprocess to create the device nodes.
                    615:        # Otherwise, wrap_makedev should do all the work itself.
                    616:        if $do_mtree ; then
                    617:                wrap_makedev $makedev ${1+"$@"} \
                    618:                | nooutput -1 "${TOOL_MTREE}" -e -U
                    619:        elif $do_pax ; then
                    620:                wrap_makedev $makedev ${1+"$@"} \
                    621:                | (
                    622:                    # Run pax in an empty directory, so it pays
                    623:                    # attention only to the specfile, without being
                    624:                    # confused by the existing contents of the target
                    625:                    # directory.  Without this, pax would complain "file
                    626:                    # would overwrite itself" for already-existing
                    627:                    # device nodes.
                    628:                    tmpdir=./tmp.$$
                    629:                    mkdir "${tmpdir}" || die "can't create temporary directory"
                    630:                    cd "${tmpdir}" || die "can't cd to temporary directory"
                    631:                    "${TOOL_PAX}" -r -w -M -pe ..
                    632:                    status=$?
                    633:                    cd .. # back to where we started
                    634:                    rmdir "${tmpdir}"
                    635:                    exit $status
                    636:                )
1.97      apb       637:        else
                    638:                wrap_makedev $makedev ${1+"$@"}
                    639:        fi
                    640: }
                    641:
1.79      apb       642: #
                    643: # functions available to create nodes:
                    644: #
                    645: # mkdev name [b|c] major minor [mode{=600} [gid{=0} [uid{=0}]]]
                    646: #      create device node `name' with the appropriate permissions
                    647: #
                    648: # lndev src target
                    649: #      create a symlink from src to target
                    650: #
                    651: # makedir dir mode
                    652: #      create directory with appropriate mode
                    653: #
                    654:
                    655: mkdev()
                    656: {
                    657:        if [ -n "$count_nodes" ]; then
                    658:                count_nodes=$((count_nodes + 1))
                    659:                return
                    660:        fi
                    661:        if $do_specfile; then
                    662:                case $2 in
                    663:                b)      type=block ;;
                    664:                c)      type=char ;;
                    665:                esac
                    666:                echo "./$1 type=${type} device=netbsd,$3,$4 mode=${5:-600} gid=${6:-$g_wheel} uid=${7:-$u_root}"
                    667:        else
                    668:                ${MKNOD} -m ${5:-600} -g \#${6:-$g_wheel} -u \#${7:-$u_root} $1 $2 $3 $4
                    669:        fi
                    670: }
                    671:
                    672: lndev()
                    673: {
                    674:        if [ -n "$count_nodes" ]; then
                    675:                count_nodes=$((count_nodes + 1))
                    676:                return
                    677:        fi
                    678:        if $do_specfile; then
                    679:                echo "./$2 type=link link=$1 mode=0700 gid=$g_wheel uid=$u_root"
                    680:        else
                    681:                ln -f -s $1 $2
                    682:        fi
                    683: }
                    684:
                    685: makedir()
                    686: {
                    687:        if [ -n "$count_nodes" ]; then
                    688:                count_nodes=$((count_nodes + 1))
                    689:                return
                    690:        fi
                    691:        if $do_specfile; then
1.104     apb       692:                echo "./$1 type=dir mode=$2 gid=$g_wheel uid=$u_root"
1.79      apb       693:        else
1.97      apb       694:                nooutput -2 mkdir $1
1.79      apb       695:                chmod $2 $1
                    696:        fi
                    697: }
                    698:
                    699: warn()
                    700: {
                    701:        echo 1>&2 "$0: $*"
                    702: }
1.16      lukem     703:
1.104     apb       704: die()
                    705: {
                    706:        echo 1>&2 "$0: $*"
                    707:        exit 1
                    708: }
                    709:
1.15      lukem     710: # makedev special [...]
                    711: #      the main loop
                    712: #
1.1       jdolecek  713: makedev()
                    714: {
                    715:
                    716: for i
                    717: do
                    718:
                    719: case $i in
                    720:
                    721: %MD_DEVICES%
1.2       jdolecek  722:
                    723: all)
                    724:        makedev all_md
1.26      christos  725:        makedev std fd ptm pty0 pty1 pty2 pty3
1.2       jdolecek  726:        makedev ccd0 ccd1 ccd2 ccd3
                    727:        makedev cgd0 cgd1 cgd2 cgd3
1.11      hannken   728:        makedev fss0 fss1 fss2 fss3
1.2       jdolecek  729:        makedev md0 md1
                    730:        makedev raid0 raid1 raid2 raid3 raid4 raid5 raid6 raid7
                    731:        makedev vnd0 vnd1 vnd2 vnd3
1.32      christos  732:        makedev bpf
1.2       jdolecek  733:        makedev tun0 tun1 tun2 tun3
1.101     ad        734:        makedev ipl pf crypto random
1.114     ad        735:        makedev lockstat clockctl cpuctl
1.28      bouyer    736:        makedev atabus0 atabus1 atabus2 atabus3
1.38      cube      737:        makedev tap tap0 tap1 tap2 tap3
1.49      hamajima  738:        makedev gpio gpio0 gpio1 gpio2 gpio3 gpio4 gpio5 gpio6 gpio7
1.89      jmcneill  739:        makedev pad pad0 pad1 pad2 pad3
1.62      plunky    740:        makedev bthub
1.90      pooka     741:        makedev putter
1.100     riz       742:        makedev drvctl
1.115     jmcneill  743:        makedev video
1.74      apb       744:        makedev local # do this last
1.2       jdolecek  745:        ;;
                    746:
                    747: init)
                    748:        # unless overridden by MD entry, this is equal to 'all'
                    749:        makedev all
                    750:        ;;
1.1       jdolecek  751:
                    752: %MI_DEVICES_BEGIN%
                    753: audio)
                    754:        makedev audio0 audio1 audio2 audio3
1.15      lukem     755:        lndev sound0 sound
                    756:        lndev audio0 audio
                    757:        lndev mixer0 mixer
                    758:        lndev audioctl0 audioctl
1.1       jdolecek  759:        ;;
                    760:
1.48      jmcneill  761: gpio)
1.49      hamajima  762:        makedev gpio0 gpio1 gpio2 gpio3 gpio4 gpio5 gpio6 gpio7
1.48      jmcneill  763:        lndev gpio0 gpio
                    764:        ;;
                    765:
1.89      jmcneill  766: pad)
                    767:        makedev pad0 pad1 pad2 pad3
                    768:        lndev pad0 pad
                    769:        ;;
                    770:
1.1       jdolecek  771: radio)
                    772:        makedev radio0 radio1
1.15      lukem     773:        lndev radio0 radio
1.1       jdolecek  774:        ;;
                    775:
1.110     jmcneill  776: video)
                    777:        makedev video0 video1 video2 video3
                    778:        ;;
                    779:
1.1       jdolecek  780: ramdisk)
                    781:        makedev floppy md0
                    782:        ;;
                    783:
                    784: usbs)
                    785:        makedev usb usb0 usb1 usb2 usb3 usb4 usb5 usb6 usb7
                    786:        makedev uhid0 uhid1 uhid2 uhid3
                    787:        makedev ulpt0 ulpt1
                    788:        makedev ttyU0 ttyU1
1.47      skrll     789:        makedev ttyY0 ttyY1
1.1       jdolecek  790:        makedev urio0
                    791:        makedev uscanner0 uscanner1
1.52      scw       792:        makedev utoppy0 utoppy1
1.1       jdolecek  793:        makedev ugen0
                    794:        ;;
                    795:
                    796: isdns)
                    797:        makedev isdn isdnctl isdnbchan0 isdnbchan1 isdntel0 isdntel1 isdnteld0 isdnteld1 isdntrc0 isdntrc1
                    798:        ;;
                    799:
                    800: std)
1.104     apb       801:        mkdev           console c %cons_chr% 0  600
                    802:        mkdev           constty c %cons_chr% 1  600
1.15      lukem     803:        mkdev           drum    c %swap_chr% 0  640 $g_kmem
                    804:        mkdev           kmem    c %mem_chr% 1   640 $g_kmem
                    805:        mkdev           mem     c %mem_chr% 0   640 $g_kmem
                    806:        mkdev           null    c %mem_chr% 2   666
                    807:        mkdev           zero    c %mem_chr% 12  666
                    808:        mkdev           klog    c %log_chr% 0   600
1.104     apb       809:        mkdev           ksyms   c %ksyms_chr% 0 444
1.119   ! apb       810:        if ! $fdesc_mounted; then
1.15      lukem     811:                mkdev   tty     c %ctty_chr% 0          666
                    812:                mkdev   stdin   c %filedesc_chr% 0      666
                    813:                mkdev   stdout  c %filedesc_chr% 1      666
                    814:                mkdev   stderr  c %filedesc_chr% 2      666
1.1       jdolecek  815:        fi
                    816:        ;;
                    817:
1.42      augustss  818: usb)
                    819:        mkdev usb c %usb_chr% 255 444
                    820:        ;;
                    821:
1.1       jdolecek  822: usb*)
                    823:        unit=${i#usb}
1.42      augustss  824:        usb=usb$unit
                    825:        mkdev usb$unit c %usb_chr% $unit
1.1       jdolecek  826:        ;;
                    827:
                    828: uhid*)
                    829:        unit=${i#uhid}
1.15      lukem     830:        mkdev uhid$unit c %uhid_chr% $unit 666
1.1       jdolecek  831:        ;;
                    832:
                    833: ulpt*)
                    834:        unit=${i#ulpt}
1.15      lukem     835:        mkdev ulpt$unit c %ulpt_chr% $unit
                    836:        mkdev ulpn$unit c %ulpt_chr% $(($unit + 64))
1.1       jdolecek  837:        ;;
                    838:
                    839: urio*)
                    840:        unit=${i#urio}
1.15      lukem     841:        mkdev urio$unit c %urio_chr% $unit 666
1.1       jdolecek  842:        ;;
                    843:
                    844: uscanner*)
                    845:        unit=${i#uscanner}
1.15      lukem     846:        mkdev uscanner$unit c %uscanner_chr% $unit
1.1       jdolecek  847:        ;;
                    848:
1.52      scw       849: utoppy*)
                    850:        unit=${i#utoppy}
                    851:        mkdev utoppy$unit c %utoppy_chr% $unit
                    852:        ;;
                    853:
1.47      skrll     854: ttyY*)
                    855:        unit=${i#ttyY}
                    856:        mkdev ttyY$unit c %ucycom_chr% $(($unit + $dialin  )) "" "" $u_uucp
                    857:        mkdev dtyY$unit c %ucycom_chr% $(($unit + $dialout )) "" "" $u_uucp
                    858:        mkdev ctyY$unit c %ucycom_chr% $(($unit + $callunit)) "" "" $u_uucp
                    859:        ;;
                    860:
1.1       jdolecek  861: ttyU*)
                    862:        unit=${i#ttyU}
1.104     apb       863:        mkdev ttyU$unit c %ucom_chr% $(($unit + $dialin  )) "" "" $u_uucp
1.15      lukem     864:        mkdev dtyU$unit c %ucom_chr% $(($unit + $dialout )) "" "" $u_uucp
                    865:        mkdev ctyU$unit c %ucom_chr% $(($unit + $callunit)) "" "" $u_uucp
1.1       jdolecek  866:        ;;
                    867:
                    868: ugen*)
                    869:        unit=${i#ugen}
                    870:        for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
                    871:        do
1.15      lukem     872:                mkdev ugen$unit.$j c %ugen_chr% $(($unit * 16 + ${j#0}))
1.1       jdolecek  873:        done
                    874:        ;;
                    875:
                    876: wscons)
                    877:        makedev ttyE0 ttyE1 ttyE2 ttyE3 ttyE4 ttyE5 ttyE6 ttyE7
                    878:        makedev wsmouse0 wsmouse1 wsmouse2 wsmouse3
                    879:        makedev wskbd0 wskbd1 wskbd2 wskbd3
                    880:        makedev wsmux0 wsmux1 wsmux2 wsmux3
                    881:        makedev wsmouse wskbd
                    882:        makedev ttyEcfg ttyEstat
                    883:        makedev wsfont
                    884:        ;;
                    885:
                    886: wsmouse)
1.15      lukem     887:        mkdev wsmouse c %wsmux_chr% 0
1.1       jdolecek  888:        ;;
                    889:
                    890: wskbd)
1.15      lukem     891:        mkdev wskbd c %wsmux_chr% 1
1.1       jdolecek  892:        ;;
                    893:
                    894: wsmux*)
                    895:        unit=${i#wsmux}
1.15      lukem     896:        mkdev wsmux$unit    c %wsmux_chr% $unit
                    897:        mkdev wsmuxctl$unit c %wsmux_chr% $(($unit + 128)) 200
1.1       jdolecek  898:        ;;
                    899:
1.39      bouyer    900: xenevt)
                    901:        mkdev xenevt c %xenevt_chr% 0
                    902:        ;;
                    903:
1.54      bouyer    904: xsd_kva)
1.55      yamt      905:        mkdev xsd_kva c %xenevt_chr% 1
1.54      bouyer    906:        ;;
                    907:
1.39      bouyer    908: xencons)
                    909:        mkdev xencons c %xencons_chr% 0
                    910:        ;;
                    911:
1.1       jdolecek  912: ttyEstat)
1.15      lukem     913:        mkdev ttyEstat c %wsdisplay_chr% 254
1.1       jdolecek  914:        ;;
                    915:
                    916: ttyEcfg)
1.15      lukem     917:        mkdev ttyEcfg c %wsdisplay_chr% 255
1.1       jdolecek  918:        ;;
                    919:
                    920: ttyE*)
1.15      lukem     921:        unit=${i#ttyE}
                    922:        mkdev ttyE$unit c %wsdisplay_chr% $unit
1.1       jdolecek  923:        ;;
                    924:
                    925: wsmouse*)
                    926:        unit=${i#wsmouse}
1.15      lukem     927:        mkdev wsmouse$unit c %wsmouse_chr% $unit
1.1       jdolecek  928:        ;;
                    929:
                    930: wskbd*)
                    931:        unit=${i#wskbd}
1.15      lukem     932:        mkdev wskbd$unit c %wskbd_chr% $unit
1.1       jdolecek  933:        ;;
                    934:
                    935: fd)
1.119   ! apb       936:        if ! $fdesc_mounted; then
1.15      lukem     937:                makedir fd 755
1.1       jdolecek  938:                n=0
1.15      lukem     939:                while [ $n -lt 64 ]
                    940:                do
                    941:                        mkdev fd/$n c %filedesc_chr% $n 666
1.1       jdolecek  942:                        n=$(($n + 1))
                    943:                done
                    944:        fi
                    945:        ;;
                    946:
                    947: wt*)
                    948:        case $i in
                    949:        wt*) name=wt;  unit=${i#wt};    chr=%wt_chr%;   blk=%wt_blk%;;
                    950:        esac
                    951:        for sub in $unit $(($unit+8)) $(($unit+16))
                    952:        do
1.15      lukem     953:                mkdev $name$sub         b $blk $(($sub + 0)) 660 $g_operator
                    954:                mkdev n$name$sub        b $blk $(($sub + 4)) 660 $g_operator
                    955:                mkdev r$name$sub        c $chr $(($sub + 0)) 660 $g_operator
                    956:                mkdev nr$name$sub       c $chr $(($sub + 4)) 660 $g_operator
1.1       jdolecek  957:        done
                    958:        ;;
                    959:
                    960: md*)
1.4       jdolecek  961:        makedisk_minimal md ${i#md} %md_blk% %md_chr%
1.11      hannken   962:        ;;
                    963:
                    964: fss*)
1.15      lukem     965:        case $i in
                    966:        fss*) name=fss; unit=${i#fss};  blk=%fss_blk%;  chr=%fss_chr%
                    967:        esac
                    968:        mkdev $name$unit        b $blk $unit 660 $g_operator
                    969:        mkdev r$name$unit       c $chr $unit 660 $g_operator
1.1       jdolecek  970:        ;;
                    971:
                    972: ss*)
                    973:        case $i in
                    974:        ss*) name=ss;   unit=${i#ss};   chr=%ss_chr%;;
                    975:        esac
1.15      lukem     976:        mkdev $name$unit        c $chr $(($unit * 16 + 0)) 640 $g_operator
                    977:        mkdev n$name$unit       c $chr $(($unit * 16 + 1)) 640 $g_operator
                    978:        mkdev en$name$unit      c $chr $(($unit * 16 + 3)) 640 $g_operator
1.1       jdolecek  979:        ;;
                    980:
1.5       jdolecek  981: ccd*|cgd*|raid*|vnd*)
1.1       jdolecek  982:        case $i in
1.15      lukem     983:        ccd*)   name=ccd;       unit=${i#ccd};  blk=%ccd_blk%;  chr=%ccd_chr%;;
                    984:        cgd*)   name=cgd;       unit=${i#cgd};  blk=%cgd_blk%;  chr=%cgd_chr%;;
                    985:        raid*)  name=raid;      unit=${i#raid}; blk=%raid_blk%; chr=%raid_chr%;;
                    986:        vnd*)   name=vnd;       unit=${i#vnd};  blk=%vnd_blk%;  chr=%vnd_chr%;;
1.1       jdolecek  987:        esac
1.5       jdolecek  988:        %MKDISK% $name $unit $blk $chr
                    989:        ;;
                    990:
                    991: sd*)
                    992:        name=sd; unit=${i#sd};  blk=%sd_blk%;   chr=%sd_chr%
1.1       jdolecek  993:        %MKDISK% $name $unit $blk $chr
                    994:        ;;
                    995:
                    996: wd*)
                    997:        name=wd; unit=${i#wd}; blk=%wd_blk%; chr=%wd_chr%
                    998:        %MKDISK% $name $unit $blk $chr
                    999:        ;;
                   1000:
                   1001: fd*)
                   1002:        name=fd; unit=${i#fd}; blk=%fd_blk%; chr=%fd_chr%
                   1003:        %MKDISK% $name $unit $blk $chr
                   1004:        ;;
                   1005:
                   1006: ld*)
                   1007:        name=ld; unit=${i#ld}; blk=%ld_blk%; chr=%ld_chr%
                   1008:        %MKDISK% $name $unit $blk $chr
                   1009:        ;;
                   1010:
1.86      martti   1011: bio)
                   1012:        mkdev bio c %bio_chr% 0
                   1013:        ;;
                   1014:
1.1       jdolecek 1015: ed*)
                   1016:        name=ed; unit=${i#ed}; blk=%ed_blk%; chr=%ed_chr%
                   1017:        %MKDISK% $name $unit $blk $chr
                   1018:        ;;
                   1019:
                   1020: ofdisk*)
                   1021:        name=ofdisk; unit=${i#ofdisk}; blk=%ofdisk_blk%; chr=%ofdisk_chr%
                   1022:        %MKDISK% $name $unit $blk $chr
                   1023:        ;;
                   1024:
1.39      bouyer   1025: xbd*)
                   1026:        name=xbd; unit=${i#xbd}; blk=%xbd_blk%; chr=%xbd_chr%
                   1027:        %MKDISK% $name $unit $blk $chr
                   1028:        ;;
                   1029:
1.59      christos 1030: dk*)
1.60      martin   1031:        name=dk; unit=${i#dk}; blk=%dk_blk%; chr=%dk_chr%
1.84      dyoung   1032:        minor=0
1.73      riz      1033:        while [ $minor -le ${i#dk} ]
1.59      christos 1034:        do
                   1035:                mkdev r$name$minor c $chr $minor 0640 $g_operator
                   1036:                mkdev $name$minor b $blk  $minor 0640 $g_operator
                   1037:                minor=$(($minor + 1))
                   1038:        done
                   1039:        ;;
1.84      dyoung   1040:
1.15      lukem    1041: ttyCY*)
1.25      christos 1042:        name=tyCY; chr=%cy_chr%; off=32
1.15      lukem    1043:        unit=${i#t${name}}
                   1044:        minor=$(($unit * $off))
                   1045:        eminor=$(($minor + $off))
                   1046:        while [ $minor -lt $eminor ]
                   1047:        do
1.50      dsl      1048:                nminor=000$minor
                   1049:                nminor=${nminor#${nminor%???}}
1.15      lukem    1050:                mkdev t$name$nminor c $chr $(($minor + $dialin )) "" "" $u_uucp
                   1051:                mkdev d$name$nminor c $chr $(($minor + $dialout)) "" "" $u_uucp
1.1       jdolecek 1052:                minor=$(($minor + 1))
                   1053:        done
                   1054:        ;;
                   1055:
1.15      lukem    1056: ttyCZ*)
1.25      christos 1057:        name=tyCZ; chr=%cz_chr%; off=64
1.15      lukem    1058:        unit=${i#t${name}}
                   1059:        minor=$(($unit * $off))
                   1060:        eminor=$(($minor + $off))
                   1061:        while [ $minor -lt $eminor ]
                   1062:        do
1.50      dsl      1063:                nminor=0000$minor
                   1064:                nminor=${nminor#${nminor%????}}
1.15      lukem    1065:                mkdev t$name$nminor c $chr $(($minor + $dialin )) "" "" $u_uucp
                   1066:                mkdev d$name$nminor c $chr $(($minor + $dialout)) "" "" $u_uucp
1.1       jdolecek 1067:                minor=$(($minor + 1))
                   1068:        done
                   1069:        ;;
                   1070:
1.15      lukem    1071:
1.4       jdolecek 1072: tty[0-9]|tty0[0-9])
                   1073:        # some archs have built-in zstty (major %zstty_chr%) instead
                   1074:        # of NS16550; create ttyZ* and hardlink as [dt]ty0*; this
                   1075:        # needs to be before com entry, for archs which have both
                   1076:        unit=${i#tty}
                   1077:        unit=$(($unit + 0))
                   1078:        makedev ttyZ${unit}
1.15      lukem    1079:        lndev ttyZ$unit tty0${unit}
                   1080:        lndev dtyZ$unit dty0${unit}
1.4       jdolecek 1081:        ;;
                   1082:
1.3       jdolecek 1083: tty0*|tty1*|tty[0-9])
1.15      lukem    1084:        unit=${i#tty}
1.50      dsl      1085:        ounit=00$unit
                   1086:        ounit=${ounit#${ounit%??}}
1.15      lukem    1087:        mkdev tty$ounit c %com_chr% $(($unit + $dialin )) "" "" $u_uucp
                   1088:        mkdev dty$ounit c %com_chr% $(($unit + $dialout)) "" "" $u_uucp
1.1       jdolecek 1089:        ;;
                   1090:
                   1091: ttyC*)
1.15      lukem    1092:                # some archs call com_chr ttyC traditionally
                   1093:        unit=${i#ttyC}; name=ttyC; dname=dtyC; chr=%com_chr%
                   1094:        mkdev  $name$unit c $chr $(($unit + $dialin )) "" "" $u_uucp
                   1095:        mkdev $dname$unit c $chr $(($unit + $dialout)) "" "" $u_uucp
1.1       jdolecek 1096:        ;;
                   1097:
                   1098: ttyh*)
1.15      lukem    1099:        unit=${i#ttyh}; name=ttyh; dname=dtyh; chr=%sabtty_chr%
                   1100:        mkdev  $name$unit c $chr $(($unit + $dialin )) "" "" $u_uucp
                   1101:        mkdev $dname$unit c $chr $(($unit + $dialout)) "" "" $u_uucp
                   1102:        ;;
                   1103:
                   1104: ttyTX*)
                   1105:        unit=${i#ttyTX}; name=ttyTX0; dname=dtyTX0; chr=%txcom_chr%
                   1106:        mkdev  $name$unit c $chr $(($unit + $dialin )) "" "" $u_uucp
                   1107:        mkdev $dname$unit c $chr $(($unit + $dialout)) "" "" $u_uucp
1.1       jdolecek 1108:        ;;
                   1109:
                   1110: ttyZ*)
1.15      lukem    1111:        unit=${i#ttyZ}; name=ttyZ; dname=dtyZ; chr=%zstty_chr%
                   1112:        mkdev  $name$unit c $chr $(($unit + $dialin )) "" "" $u_uucp
                   1113:        mkdev $dname$unit c $chr $(($unit + $dialout)) "" "" $u_uucp
1.1       jdolecek 1114:        ;;
                   1115:
                   1116: opty)
                   1117:        for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f
                   1118:        do
                   1119:                case $j in
                   1120:                [0-9])  jn=$j ;;
                   1121:                a)      jn=10 ;;
                   1122:                b)      jn=11 ;;
                   1123:                c)      jn=12 ;;
                   1124:                d)      jn=13 ;;
                   1125:                e)      jn=14 ;;
                   1126:                f)      jn=15 ;;
                   1127:                esac
1.15      lukem    1128:                mkdev ttyp$j c %pts_chr% $jn 666
                   1129:                mkdev ptyp$j c %ptc_chr% $jn 666
1.1       jdolecek 1130:        done
                   1131:        ;;
                   1132:
                   1133: pty*)
                   1134:        class=${i#pty}
1.26      christos 1135:        d1="p q r s t u v w x y z P Q R S T"
                   1136:        if [ "$class" -ge 64 ]
                   1137:        then
                   1138:                warn "$i: pty unit must be between 0 and 63"
1.1       jdolecek 1139:                continue
1.26      christos 1140:        elif [ "$class" -lt 16 ]
                   1141:        then
                   1142:                offset=0
                   1143:                mult=0
                   1144:                d2="0 1 2 3 4 5 6 7 8 9 a b c d e f"
                   1145:        else
                   1146:                class=$(($class - 16))
                   1147:                offset=256
                   1148:                mult=2
                   1149:                d2="g h i j k l m n o p q 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 Y Z"
1.1       jdolecek 1150:        fi
1.26      christos 1151:        start=$(($class * 16))
                   1152:        set -- $d2
                   1153:        nt=$#
                   1154:        s1=$(($start / $nt))
                   1155:        set -- $d1
                   1156:        shift $s1
                   1157:        t1=$1
                   1158:        if [ "$t1" = v ]; then
1.16      lukem    1159:                warn "$i: pty unit conflicts with console ttyv0 device"
1.1       jdolecek 1160:                continue
                   1161:        fi
1.51      christos 1162:        s2=$(($start % ($nt - $s1 * $mult)))
1.26      christos 1163:        set -- $d2
                   1164:        shift $s2
                   1165:        t2=$1
                   1166:        unit=$(($start + $offset - $s1 * $mult))
                   1167:        end=$(($unit + 16))
                   1168:        while [ "$unit" -lt "$end" ]
                   1169:        do
                   1170:                mkdev tty$t1$t2 c %pts_chr% $unit 666
                   1171:                mkdev pty$t1$t2 c %ptc_chr% $unit 666
1.1       jdolecek 1172:                shift
1.26      christos 1173:                t2=$1
                   1174:                if [ -z "$t2" ]
                   1175:                then
                   1176:                        break
1.1       jdolecek 1177:                fi
                   1178:                unit=$(($unit + 1))
                   1179:        done
                   1180:        ;;
                   1181:
1.4       jdolecek 1182: stic*)
                   1183:        unit=${i#stic}
1.15      lukem    1184:        mkdev stic$unit c %stic_chr% $unit
1.4       jdolecek 1185:        ;;
                   1186:
1.1       jdolecek 1187: st*)
                   1188:        case $i in
                   1189:        st*) name=st;   unit=${i#st};   chr=%st_chr%;   blk=%st_blk%;;
                   1190:        esac
1.15      lukem    1191:        mkdev $name$unit        b $blk $(($unit * 16 + 0)) 660 $g_operator
                   1192:        mkdev n$name$unit       b $blk $(($unit * 16 + 1)) 660 $g_operator
                   1193:        mkdev e$name$unit       b $blk $(($unit * 16 + 2)) 660 $g_operator
                   1194:        mkdev en$name$unit      b $blk $(($unit * 16 + 3)) 660 $g_operator
                   1195:        mkdev r$name$unit       c $chr $(($unit * 16 + 0)) 660 $g_operator
                   1196:        mkdev nr$name$unit      c $chr $(($unit * 16 + 1)) 660 $g_operator
                   1197:        mkdev er$name$unit      c $chr $(($unit * 16 + 2)) 660 $g_operator
                   1198:        mkdev enr$name$unit     c $chr $(($unit * 16 + 3)) 660 $g_operator
1.1       jdolecek 1199:        ;;
                   1200:
                   1201: ses*|ch*|uk*)
                   1202:        case $i in
1.15      lukem    1203:        ch*)    name=ch;        unit=${i#ch};   chr=%ch_chr%;;
                   1204:        uk*)    name=uk;        unit=${i#uk};   chr=%uk_chr%;;
                   1205:        ses*)   name=ses;       unit=${i#ses};  chr=%ses_chr%;;
1.1       jdolecek 1206:        esac
1.15      lukem    1207:        mkdev $name$unit c $chr $unit 640 $g_operator
1.1       jdolecek 1208:        ;;
                   1209:
1.4       jdolecek 1210: cd*)
1.106     apb      1211:        makedisk_minimal cd ${i#cd} %cd_blk% %cd_chr%
1.4       jdolecek 1212:        ;;
                   1213:
                   1214: mcd*)
                   1215:        makedisk_minimal mcd ${i#mcd} %mcd_blk% %mcd_chr%
1.1       jdolecek 1216:        ;;
                   1217:
                   1218: gdrom*)
1.4       jdolecek 1219:        makedisk_minimal gdrom ${i#gdrom} %gdrom_blk% %gdrom_chr%
1.1       jdolecek 1220:        ;;
                   1221:
                   1222: lpt*|lpa*)
                   1223:        case $i in
1.104     apb      1224:        lpt*) name=lpt; unit=${i#lpt};  chr=%lpt_chr%;  flags=0;;
                   1225:        lpa*) name=lpa; unit=${i#lpa};  chr=%lpt_chr%;  flags=128;;
1.1       jdolecek 1226:        esac
1.15      lukem    1227:        mkdev $name$unit c $chr $(($unit + $flags))
1.21      jdolecek 1228:        mkdev lpt${unit}ctl c $chr $(($unit + 256))
1.1       jdolecek 1229:        ;;
                   1230:
1.32      christos 1231: bpf)
                   1232:        mkdev bpf       c %bpf_chr% 0
1.36      manu     1233:        lndev bpf bpf0
1.32      christos 1234:        ;;
                   1235:
1.62      plunky   1236: bthub)
                   1237:        mkdev bthub c %bthub_chr% 0
1.53      gdamore  1238:        ;;
                   1239:
1.40      jdolecek 1240: tun*)
                   1241:        unit=${i#tun}
                   1242:        mkdev tun$unit c %tun_chr% $unit
                   1243:        ;;
                   1244:
                   1245: joy*)
                   1246:        unit=${i#joy}
                   1247:        mkdev joy$unit c %joy_chr% $unit
1.1       jdolecek 1248:        ;;
                   1249:
                   1250: ipl)
1.15      lukem    1251:        mkdev ipl       c %ipl_chr% 0
                   1252:        mkdev ipnat     c %ipl_chr% 1
                   1253:        mkdev ipstate   c %ipl_chr% 2
                   1254:        mkdev ipauth    c %ipl_chr% 3
1.58      martti   1255:        mkdev ipsync    c %ipl_chr% 4
                   1256:        mkdev ipscan    c %ipl_chr% 5
                   1257:        mkdev iplookup  c %ipl_chr% 6
1.1       jdolecek 1258:        ;;
                   1259:
                   1260: pf)
1.15      lukem    1261:        mkdev pf c %pf_chr% 0
1.1       jdolecek 1262:        ;;
                   1263:
                   1264: crypto)
1.15      lukem    1265:        mkdev crypto c %crypto_chr% 0 666
1.1       jdolecek 1266:        ;;
                   1267:
1.72      dyoung   1268: cmos)
                   1269:        mkdev cmos c %cmos_chr% 0 644
                   1270:        ;;
                   1271:
1.1       jdolecek 1272: speaker)
1.15      lukem    1273:        mkdev speaker c %spkr_chr% 0
1.1       jdolecek 1274:        ;;
                   1275:
1.61      ad       1276: lockstat)
                   1277:        mkdev lockstat c %lockstat_chr% 0
                   1278:        ;;
                   1279:
1.87      ad       1280: cpuctl)
                   1281:        mkdev cpuctl c %cpuctl_chr% 0 666
                   1282:        ;;
                   1283:
1.1       jdolecek 1284: audio*)
                   1285:        unit=${i#audio}
                   1286:        audio=audio$unit
                   1287:        sound=sound$unit
                   1288:        mixer=mixer$unit
                   1289:        audioctl=audioctl$unit
1.15      lukem    1290:        : ${unit:-0}
1.104     apb      1291:        mkdev $sound    c %audio_chr% $(($unit + 0))    666
                   1292:        mkdev $audio    c %audio_chr% $(($unit + 128))  666
                   1293:        mkdev $mixer    c %audio_chr% $(($unit + 16))   666
1.15      lukem    1294:        mkdev $audioctl c %audio_chr% $(($unit + 192))  666
1.1       jdolecek 1295:        ;;
                   1296:
1.48      jmcneill 1297: gpio*)
                   1298:        unit=${i#gpio}
                   1299:        mkdev gpio$unit c %gpio_chr% $unit 644
                   1300:        ;;
                   1301:
1.1       jdolecek 1302: rmidi*)
                   1303:        unit=${i#rmidi}
1.15      lukem    1304:        mkdev rmidi$unit c %midi_chr% $unit 666
1.1       jdolecek 1305:        ;;
                   1306:
                   1307: music*)
                   1308:        unit=${i#music}
1.15      lukem    1309:        : ${unit:-0}
                   1310:        mkdev music$unit     c %sequencer_chr% $(($unit + 0))   666
1.104     apb      1311:        mkdev sequencer$unit c %sequencer_chr% $(($unit + 128)) 666
1.1       jdolecek 1312:        ;;
                   1313:
                   1314: radio*)
                   1315:        unit=${i#radio}
1.15      lukem    1316:        : ${unit:-0}
                   1317:        mkdev radio$unit c %radio_chr% $unit 666
                   1318:        ;;
                   1319:
1.110     jmcneill 1320: video*)
                   1321:        unit=${i#video}
                   1322:        : ${unit:-0}
                   1323:        mkdev video$unit c %video_chr% $unit 666
                   1324:        ;;
                   1325:
1.56      bouyer   1326: amr*)
                   1327:        unit=${i#amr}
                   1328:        mkdev amr$unit c %amr_chr% $unit
                   1329:        ;;
                   1330:
1.15      lukem    1331: apm)
                   1332:        mkdev apm       c %apm_chr% 0 644
                   1333:        mkdev apmctl    c %apm_chr% 8 644
                   1334:        ;;
                   1335:
                   1336: apm)
                   1337:                # hpcmips uses `apmdev_chr' instead of `apm_chr'
                   1338:        mkdev apm       c %apmdev_chr% 0 644
                   1339:        mkdev apmctl    c %apmdev_chr% 8 644
1.4       jdolecek 1340:        ;;
                   1341:
1.1       jdolecek 1342: satlink*)
                   1343:        unit=${i#satlink}
1.15      lukem    1344:        mkdev satlink$unit c %satlink_chr% $unit 444
1.1       jdolecek 1345:        ;;
                   1346:
                   1347: random)
1.15      lukem    1348:        mkdev random    c %rnd_chr% 0 444
                   1349:        mkdev urandom   c %rnd_chr% 1 644
1.1       jdolecek 1350:        ;;
                   1351:
1.88      gdt      1352: cfs)
                   1353:        makedev cfs0
                   1354:        ;;
                   1355:
1.1       jdolecek 1356: cfs*)
                   1357:        unit=${i#cfs}
1.15      lukem    1358:        mkdev cfs$unit c %vcoda_chr% $unit
1.1       jdolecek 1359:        ;;
                   1360:
                   1361: sysmon)
1.15      lukem    1362:        mkdev sysmon    c %sysmon_chr% 0 644
                   1363:        mkdev watchdog  c %sysmon_chr% 1 644
                   1364:        mkdev power     c %sysmon_chr% 2 640
1.1       jdolecek 1365:        ;;
                   1366:
                   1367: scsibus*)
                   1368:        unit=${i#scsibus}
1.15      lukem    1369:        mkdev scsibus$unit c %scsibus_chr% $unit 644
1.1       jdolecek 1370:        ;;
                   1371:
                   1372: bktr)
                   1373:        makedev bktr0 bktr1
1.15      lukem    1374:        lndev   bktr0   bktr
                   1375:        lndev   tuner0  tuner
                   1376:        lndev   vbi0    vbi
1.1       jdolecek 1377:        ;;
                   1378:
                   1379: bktr*)
                   1380:        unit=${i#bktr}
1.15      lukem    1381:        mkdev bktr$unit         c %bktr_chr% $(($unit + 0))     444
                   1382:        mkdev tuner$unit        c %bktr_chr% $(($unit + 16))    444
                   1383:        mkdev vbi$unit          c %bktr_chr% $(($unit + 32))    444
1.1       jdolecek 1384:        ;;
                   1385:
1.69      ad       1386: io)
                   1387:        mkdev           io      c %mem_chr% 14  600
                   1388:        ;;
                   1389:
1.1       jdolecek 1390: iop*)
                   1391:        unit=${i#iop}
1.15      lukem    1392:        mkdev iop$unit c %iop_chr% $unit
1.1       jdolecek 1393:        ;;
                   1394:
                   1395: mlx*)
                   1396:        unit=${i#mlx}
1.15      lukem    1397:        mkdev mlx$unit c %mlx_chr% $unit
1.1       jdolecek 1398:        ;;
                   1399:
                   1400: mly*)
                   1401:        unit=${i#mly}
1.15      lukem    1402:        mkdev mly$unit c %mly_chr% $unit
1.1       jdolecek 1403:        ;;
                   1404:
1.66      manu     1405: twa*)
                   1406:        unit=${i#twa}
                   1407:        mkdev twa$unit c %twa_chr% $unit
                   1408:        ;;
                   1409:
1.1       jdolecek 1410: twe*)
                   1411:        unit=${i#twe}
1.15      lukem    1412:        mkdev twe$unit c %twe_chr% $unit
1.1       jdolecek 1413:        ;;
                   1414:
                   1415: icp*)
                   1416:        unit=${i#icp}
1.15      lukem    1417:        mkdev icp$unit c %icp_chr% $unit
1.1       jdolecek 1418:        ;;
                   1419:
                   1420: agp*)
                   1421:        unit=${i#agp}
1.15      lukem    1422:        mkdev agp$unit c %agp_chr% $unit 644
                   1423:        if [ "$unit" = "0" ]; then
                   1424:                lndev agp$unit agpgart
                   1425:        fi
1.1       jdolecek 1426:        ;;
                   1427:
                   1428: pci*)
                   1429:        unit=${i#pci}
1.15      lukem    1430:        mkdev pci$unit c %pci_chr% $unit 644
1.1       jdolecek 1431:        ;;
                   1432:
                   1433: dpti*)
                   1434:        unit=${i#dpti}
1.15      lukem    1435:        mkdev dpti$unit c %dpti_chr% $unit
1.1       jdolecek 1436:        ;;
                   1437:
                   1438: dpt*)
                   1439:        unit=${i#dpt}
1.15      lukem    1440:        mkdev dpt$unit c %dpt_chr% $unit
1.1       jdolecek 1441:        ;;
                   1442:
                   1443: altq)
1.15      lukem    1444:        makedir altq 755
1.1       jdolecek 1445:        unit=0
1.15      lukem    1446:        for dev in altq cbq wfq afm fifoq red rio localq hfsc cdnr blue priq
                   1447:        do
                   1448:                mkdev altq/$dev c %altq_chr% $unit 644
1.1       jdolecek 1449:                unit=$(($unit + 1))
                   1450:        done
                   1451:        ;;
                   1452:
                   1453: isdn)
1.15      lukem    1454:        mkdev isdn c %isdn_chr% 0
1.1       jdolecek 1455:        ;;
                   1456:
                   1457: isdnctl)
1.15      lukem    1458:        mkdev isdnctl c %isdnctl_chr% 0
1.1       jdolecek 1459:        ;;
                   1460:
                   1461: isdnbchan*)
                   1462:        unit=${i#isdnbchan}
1.15      lukem    1463:        mkdev isdnbchan$unit c %isdnbchan_chr% $unit
1.1       jdolecek 1464:        ;;
                   1465:
                   1466: isdnteld*)
                   1467:        unit=${i#isdnteld}
1.15      lukem    1468:        mkdev isdnteld$unit c %isdntel_chr% $(($unit + 64))
1.1       jdolecek 1469:        ;;
                   1470:
                   1471: isdntel*)
                   1472:        unit=${i#isdntel}
1.15      lukem    1473:        mkdev isdntel$unit c %isdntel_chr% $unit
1.1       jdolecek 1474:        ;;
                   1475:
                   1476: isdntrc*)
                   1477:        unit=${i#isdntrc}
1.15      lukem    1478:        mkdev isdntrc$unit c %isdntrc_chr% $unit
1.1       jdolecek 1479:        ;;
                   1480:
                   1481: vmegen)
                   1482:        makedev vmegen0 vmegen1 vmegen2 vmegen3
                   1483:        ;;
                   1484:
                   1485: vmegen*)
                   1486:        unit=${i#vmegen}
1.15      lukem    1487:        mkdev vmegen$unit c %vmegeneric_chr% $(($unit * 16 + 0))
1.1       jdolecek 1488:        ;;
                   1489:
                   1490: wsfont)
1.15      lukem    1491:        mkdev wsfont c %wsfont_chr% 0
1.1       jdolecek 1492:        ;;
                   1493:
                   1494: cir*)
                   1495:        unit=${i#cir}
1.15      lukem    1496:        mkdev cir$unit c %cir_chr% $unit 666
1.1       jdolecek 1497:        ;;
                   1498:
                   1499: irframe*)
                   1500:        unit=${i#irframe}
1.15      lukem    1501:        mkdev irframe$unit c %irframe_chr% $unit
1.1       jdolecek 1502:        ;;
                   1503:
                   1504: fcom*)
                   1505:        unit=${i#fcom}
1.15      lukem    1506:        mkdev fcom$unit c %fcom_chr% $unit "" "" $u_uucp
1.1       jdolecek 1507:        ;;
                   1508:
                   1509: openfirm)
1.15      lukem    1510:        mkdev openfirm c %openfirm_chr% 0 444
1.1       jdolecek 1511:        ;;
                   1512:
1.89      jmcneill 1513: pad*)
                   1514:        unit=${i#pad}
                   1515:        mkdev pad$unit c %pad_chr% $unit 444
                   1516:        ;;
                   1517:
1.1       jdolecek 1518: nvram)
1.15      lukem    1519:        mkdev nvram c %nvram_chr% 0 644
1.1       jdolecek 1520:        ;;
                   1521:
                   1522: rtc)
1.15      lukem    1523:        mkdev rtc c %rtc_chr% 0 644
1.1       jdolecek 1524:        ;;
                   1525:
                   1526: clockctl)
1.15      lukem    1527:        mkdev clockctl c %clockctl_chr% 0 660 $g_ntpd
1.1       jdolecek 1528:        ;;
                   1529:
                   1530: nsmb)
                   1531:        makedev nsmb0 nsmb1 nsmb2 nsmb3
                   1532:        ;;
                   1533:
                   1534: nsmb*)
                   1535:        unit=${i#nsmb}
1.15      lukem    1536:        mkdev nsmb$unit c %nsmb_chr% $unit 644
1.1       jdolecek 1537:        ;;
                   1538:
                   1539: kttcp)
1.15      lukem    1540:        mkdev kttcp c %kttcp_chr% 0
1.1       jdolecek 1541:        ;;
                   1542:
                   1543: dmoverio)
1.15      lukem    1544:        mkdev dmoverio c %dmoverio_chr% 0 644
1.1       jdolecek 1545:        ;;
                   1546:
                   1547: veriexec)
1.45      elad     1548:        mkdev veriexec c %veriexec_chr% 0 600
1.1       jdolecek 1549:        ;;
                   1550:
                   1551: ttyv*)
1.15      lukem    1552:        unit=${i#ttyv}
                   1553:        mkdev ttyv$unit c %pc_chr% $unit
1.1       jdolecek 1554:        ;;
                   1555:
1.15      lukem    1556: # arm, acorn32
1.4       jdolecek 1557: ttyv*)
1.15      lukem    1558:        unit=${i#ttyv}
                   1559:        mkdev ttyv$unit c %physcon_chr% $unit
1.4       jdolecek 1560:        ;;
                   1561:
1.1       jdolecek 1562: arcpp*)
1.15      lukem    1563:        unit=${i#arcpp}
                   1564:        mkdev arcpp$unit c %arcpp_chr% $unit
1.1       jdolecek 1565:        ;;
                   1566:
                   1567: par*)
1.15      lukem    1568:        unit=${i#par}
1.1       jdolecek 1569:        case $unit in
                   1570:        0)
1.15      lukem    1571:                mkdev par$unit c %par_chr% $unit
1.1       jdolecek 1572:                ;;
                   1573:        *)
1.16      lukem    1574:                warn "bad unit for par in: $i"
1.1       jdolecek 1575:                ;;
                   1576:        esac
                   1577:        ;;
                   1578:
1.108     hauke    1579: cpi*)
                   1580:        unit=${i#cpi}
                   1581:        mkdev cpi$unit c %cpi_chr% $unit
                   1582:        ;;
                   1583:
1.1       jdolecek 1584: ite*|ttye*)
1.4       jdolecek 1585:        case $i in
                   1586:        ite*)   unit=${i#ite};;
                   1587:        ttye*)  unit=${i#ttye};;
                   1588:        esac
1.104     apb      1589:        mkdev ttye$unit c %ite_chr% $unit
1.1       jdolecek 1590:        ;;
                   1591:
                   1592: pms*)
1.4       jdolecek 1593:        unit=${i#pms}
1.15      lukem    1594:        mkdev pms$unit c %opms_chr% $unit
1.1       jdolecek 1595:        ;;
                   1596:
                   1597: qms*)
                   1598:        unit=${i#qms}
1.15      lukem    1599:        mkdev qms$unit c %qms_chr% $unit
1.1       jdolecek 1600:        ;;
                   1601:
                   1602: lms*)
                   1603:        unit=${i#lms}
1.15      lukem    1604:        mkdev lms$unit c %lms_chr% $unit
1.1       jdolecek 1605:        ;;
                   1606:
                   1607: mms*)
                   1608:        unit=${i#mms}
1.15      lukem    1609:        mkdev mms$unit c %mms_chr% $unit
1.1       jdolecek 1610:        ;;
                   1611:
                   1612: mouse-*)
                   1613:        case $i in
1.15      lukem    1614:        mouse-pms*) name=pms ;;
                   1615:        mouse-qms*) name=qms ;;
1.1       jdolecek 1616:        esac
1.15      lukem    1617:        unit=${i#mouse-${name}}
                   1618:        lndev $name$unit mouse
1.1       jdolecek 1619:        ;;
                   1620:
                   1621: kbd)
1.15      lukem    1622:        mkdev kbd c %kbd_chr% 0
1.1       jdolecek 1623:        ;;
                   1624:
1.4       jdolecek 1625: kbdctl)
1.15      lukem    1626:        mkdev kbdctl c %kbd_chr% 1
1.4       jdolecek 1627:        ;;
                   1628:
                   1629: vidcconsole0)
1.15      lukem    1630:        mkdev vidcconsole0 c %vidcconsole_chr% 0 640
1.4       jdolecek 1631:        ;;
                   1632:
1.1       jdolecek 1633: view*)
1.15      lukem    1634:        unit=${i#view}
1.104     apb      1635:        mkdev view$unit c %view_chr% $unit 666
1.1       jdolecek 1636:        ;;
                   1637:
                   1638: mouse*)
1.15      lukem    1639:        unit=${i#mouse}
1.1       jdolecek 1640:        case $unit in
                   1641:        0|1)
1.15      lukem    1642:                mkdev mouse$unit c %ms_chr% $unit 666
                   1643:                if [ $unit = 0 ]; then
                   1644:                        lndev mouse$unit mouse
1.1       jdolecek 1645:                fi
                   1646:                ;;
                   1647:        *)
1.16      lukem    1648:                warn "bad unit for mouse in: $i"
1.1       jdolecek 1649:                ;;
                   1650:        esac
                   1651:        ;;
                   1652:
                   1653: panel)
1.15      lukem    1654:        mkdev panel0 c %panel_chr% 0 660
1.1       jdolecek 1655:        ;;
                   1656:
1.37      joff     1657: tslcd)
                   1658:        mkdev tslcd0 c %tslcd_chr% 0 660
                   1659:        ;;
                   1660:
1.1       jdolecek 1661: ipty)
1.15      lukem    1662:        mkdev ttyp0 c %pts_chr% 0 666
                   1663:        mkdev ttyp1 c %pts_chr% 1 666
                   1664:        mkdev ptyp0 c %ptc_chr% 0 666
                   1665:        mkdev ptyp1 c %ptc_chr% 1 666
1.1       jdolecek 1666:        ;;
                   1667:
1.24      christos 1668: ptm)
1.109     apb      1669:        makedir pts 755
1.24      christos 1670:        mkdev ptmx c %ptm_chr% 0 666
                   1671:        mkdev ptm c %ptm_chr% 1 666
                   1672:        ;;
                   1673:
1.1       jdolecek 1674: grf*)
                   1675:        unit=${i#grf}
1.15      lukem    1676:        mkdev grf$unit c %grf_chr% $unit 666
1.1       jdolecek 1677:        ;;
                   1678:
                   1679: etvme)
1.15      lukem    1680:        mkdev etvme c %et_chr% 0
1.1       jdolecek 1681:        ;;
                   1682:
                   1683: leo*)
                   1684:        unit=${i#leo}
1.15      lukem    1685:        mkdev leo$unit c %leo_chr% $unit
1.1       jdolecek 1686:        ;;
                   1687:
                   1688: scif*)
1.15      lukem    1689:        unit=${i#scif}
1.116     uch      1690:        mkdev scif$unit c %scif_chr% $(($unit + $dialin )) "" "" $u_uucp
                   1691:        mkdev dscif$unit c %scif_chr% $(($unit + $dialout)) "" "" $u_uucp
1.1       jdolecek 1692:        ;;
                   1693:
                   1694: sci*)
1.15      lukem    1695:        unit=${i#sci}
1.116     uch      1696:        mkdev sci$unit c %sci_chr% $(($unit + $dialin )) "" "" $u_uucp
                   1697:        mkdev dsci$unit c %sci_chr% $(($unit + $dialout)) "" "" $u_uucp
1.1       jdolecek 1698:        ;;
                   1699:
                   1700: maple*)
                   1701:        case $i in
                   1702:        mapleA*) name="mapleA"; unit=0;;
                   1703:        mapleB*) name="mapleB"; unit=1;;
                   1704:        mapleC*) name="mapleC"; unit=2;;
                   1705:        mapleD*) name="mapleD"; unit=3;;
                   1706:        esac
                   1707:        subunit=${i#$name}
1.15      lukem    1708:        mkdev $name$subunit c %maple_chr% $(($unit * 8 + 0$subunit))
1.1       jdolecek 1709:        ;;
                   1710:
                   1711: mmem*)
1.15      lukem    1712:        unit=${i#mmem}
1.1       jdolecek 1713:        for pt in 0     # 1 2 3 4 ... 255
                   1714:        do
1.15      lukem    1715: #              mkdev mmem${unit}.${pt}a  b %mmem_blk% $(($unit * 4096 + $pt * 16 + 0)) 640 $g_operator
                   1716:                mkdev mmem${unit}.${pt}c  b %mmem_blk% $(($unit * 4096 + $pt * 16 + 2)) 640 $g_operator
                   1717: #              mkdev rmmem${unit}.${pt}a c %mmem_chr% $(($unit * 4096 + $pt * 16 + 0)) 640 $g_operator
                   1718:                mkdev rmmem${unit}.${pt}c c %mmem_chr% $(($unit * 4096 + $pt * 16 + 2)) 640 $g_operator
1.1       jdolecek 1719:        done
                   1720:        ;;
                   1721:
                   1722: mlcd*)
1.15      lukem    1723:        unit=${i#mlcd}
1.1       jdolecek 1724:        for pt in 0     # 1 2 3 4 ... 255
                   1725:        do
1.15      lukem    1726:                mkdev mlcd${unit}.${pt} c %mlcd_chr% $(($unit * 256 + $pt)) 640 $g_operator
1.1       jdolecek 1727:        done
                   1728:        ;;
                   1729:
                   1730: ixpcom*)
                   1731:        unit=${i#ixpcom}
1.15      lukem    1732:        mkdev ixpcom$unit c %ixpcom_chr% $unit "" "" $u_uucp
1.1       jdolecek 1733:        ;;
                   1734:
1.34      joff     1735: epcom*)
                   1736:        unit=${i#epcom}
                   1737:        mkdev epcom$unit c %epcom_chr% $unit "" "" $u_uucp
                   1738:        ;;
                   1739:
1.1       jdolecek 1740: ucbsnd)
1.15      lukem    1741:        mkdev ucbsnd c %ucbsnd_chr% 0 666
1.1       jdolecek 1742:        ;;
                   1743:
                   1744: adb)
1.15      lukem    1745:        mkdev adb c %aed_chr% 0 666
1.1       jdolecek 1746:        ;;
                   1747:
                   1748: asc*)
                   1749:        unit=${i#asc}
1.15      lukem    1750:        mkdev asc$unit c %asc_chr% $unit 666
1.1       jdolecek 1751:        ;;
                   1752:
                   1753: bwtwo*)
                   1754:        unit=${i#bwtwo}
1.15      lukem    1755:        mkdev bwtwo$unit c %bwtwo_chr% $unit 666
1.1       jdolecek 1756:        ;;
                   1757:
                   1758: cgtwo*)
                   1759:        unit=${i#cgtwo}
1.15      lukem    1760:        mkdev cgtwo$unit c %cgtwo_chr% $unit 666
1.1       jdolecek 1761:        ;;
                   1762:
                   1763: cgthree*)
                   1764:        unit=${i#cgthree}
1.15      lukem    1765:        mkdev cgthree$unit c %cgthree_chr% $unit 666
1.1       jdolecek 1766:        ;;
                   1767:
                   1768: cgfour*)
                   1769:        unit=${i#cgfour}
1.15      lukem    1770:        mkdev cgfour$unit c %cgfour_chr% $unit 666
1.1       jdolecek 1771:        ;;
                   1772:
                   1773: cgsix*)
                   1774:        unit=${i#cgsix}
1.15      lukem    1775:        mkdev cgsix$unit c %cgsix_chr% $unit 666
1.1       jdolecek 1776:        ;;
                   1777:
                   1778: cgeight*)
                   1779:        unit=${i#cgeight}
1.15      lukem    1780:        mkdev cgeight$unit c %cgeight_chr% $unit 666
1.1       jdolecek 1781:        ;;
                   1782:
                   1783: tcx*)
                   1784:        unit=${i#tcx}
1.15      lukem    1785:        mkdev tcx$unit c %tcx_chr% $unit 666
1.1       jdolecek 1786:        ;;
                   1787:
                   1788: xd*|xy*)
                   1789:        case $i in
                   1790:        xd*)    name=xd; unit=${i#xd}; blk=%xd_blk%;    chr=%xd_chr%;;
                   1791:        xy*)    name=xy; unit=${i#xy}; blk=%xy_blk%;    chr=%xy_chr%;;
                   1792:        esac
                   1793:        %MKDISK% $name $unit $blk $chr
                   1794:        ;;
                   1795:
                   1796: magma*)
                   1797:        unit=${i#magma}
1.15      lukem    1798:        if [ 0$unit -gt 3 ]; then
1.16      lukem    1799:                warn "bad unit for $i: $unit"
1.1       jdolecek 1800:                break
                   1801:        fi
                   1802:        for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f
                   1803:        do
                   1804:                case $j in
                   1805:                [0-9])  jn=$j ;;
                   1806:                a)      jn=10 ;;
                   1807:                b)      jn=11 ;;
                   1808:                c)      jn=12 ;;
                   1809:                d)      jn=13 ;;
                   1810:                e)      jn=14 ;;
                   1811:                f)      jn=15 ;;
                   1812:                esac
1.15      lukem    1813:                mkdev tty$unit$j c %mtty_chr% $(($unit * 64 + $jn))
1.1       jdolecek 1814:        done
1.15      lukem    1815:        mkdev bpp${unit}0 c %mbpp_chr% $(($unit * 64 + 0))
                   1816:        mkdev bpp${unit}1 c %mbpp_chr% $(($unit * 64 + 1))
1.1       jdolecek 1817:        ;;
                   1818:
                   1819: clcd*)
                   1820:        unit=${i#clcd}
1.15      lukem    1821:        if [ 0$unit -gt 7 ]; then
1.16      lukem    1822:                warn "bad unit for $i: $unit"
1.1       jdolecek 1823:                break
                   1824:        fi
                   1825:        for j in 0 1 2 3 4 5 6 7
                   1826:        do
1.15      lukem    1827:                mkdev ttyA$unit$j c %clcd_chr% $(($unit * 8 + $j + $dialin)) "" "" $u_uucp
                   1828:                mkdev dtyA$unit$j c %clcd_chr% $(($unit * 8 + $j + $dialout)) "" "" $u_uucp
1.1       jdolecek 1829:        done
                   1830:        ;;
                   1831:
1.27      mrg      1832: spif*)
                   1833:        unit=${i#spif}
                   1834:        if [ 0$unit -gt 3 ]; then
                   1835:                warn "bad unit for $i: $unit"
                   1836:                break
                   1837:        fi
                   1838:        for j in 0 1 2 3 4 5 6 7; do
                   1839:                mkdev ttyS$unit$j c 102 $(($unit * 64 + $j)) "" "" $u_uucp
                   1840:        done
                   1841:        mkdev bppS${unit}0 c 103 $(($unit * 64 + 0))
                   1842:        mkdev bppS${unit}1 c 103 $(($unit * 64 + 1))
                   1843:        ;;
                   1844:
1.1       jdolecek 1845: bpp*)
                   1846:        unit=${i#bpp}
1.15      lukem    1847:        mkdev bpp$unit c %bpp_chr% $(($unit + 0))
1.1       jdolecek 1848:        ;;
                   1849:
                   1850: tctrl*)
                   1851:        unit=${i#tctrl}
1.15      lukem    1852:        mkdev tctrl$unit c %tctrl_chr% $unit 666
1.1       jdolecek 1853:        ;;
                   1854:
                   1855: bmd*)
1.15      lukem    1856:        unit=${i#bmd}
                   1857:        mkdev bmd${unit}a  b %bmd_blk% $(($unit * 8 + 0)) 640 $g_operator
                   1858:        mkdev bmd${unit}c  b %bmd_blk% $(($unit * 8 + 2)) 640 $g_operator
                   1859:        mkdev rbmd${unit}a c %bmd_chr% $(($unit * 8 + 0)) 640 $g_operator
                   1860:        mkdev rbmd${unit}c c %bmd_chr% $(($unit * 8 + 2)) 640 $g_operator
1.1       jdolecek 1861:        ;;
                   1862:
                   1863: sram)
1.15      lukem    1864:        mkdev sram c %sram_chr% 0 644
1.1       jdolecek 1865:        ;;
                   1866:
                   1867: pow*)
                   1868:        unit=${i#pow}
                   1869:        case $unit in
                   1870:        0|1)
1.15      lukem    1871:                mkdev pow${unit} c %pow_chr% ${unit} 644
                   1872:                if [ $unit = 0 ]; then
                   1873:                        lndev pow${unit} pow
1.1       jdolecek 1874:                fi
                   1875:                ;;
                   1876:        *)
1.16      lukem    1877:                warn "bad unit for pow in: $i"
1.1       jdolecek 1878:                ;;
                   1879:        esac
                   1880:        ;;
                   1881:
                   1882: ttyS*)
                   1883:        unit=${i#ttyS}
1.15      lukem    1884:        mkdev ttyS$unit c %sacom_chr% $(($unit + $dialin )) "" "" $u_uucp
                   1885:        mkdev dtyS$unit c %sacom_chr% $(($unit + $dialout)) "" "" $u_uucp
1.1       jdolecek 1886:        ;;
                   1887:
1.28      bouyer   1888: atabus*)
                   1889:        unit=${i#atabus}
                   1890:        mkdev atabus$unit c %atabus_chr% $unit 644
                   1891:        ;;
                   1892:
1.29      drochner 1893: drvctl)
                   1894:        mkdev drvctl c %drvctl_chr% 0 644
                   1895:        ;;
1.28      bouyer   1896:
1.103     dyoung   1897: isv)
                   1898:        mkdev isv c %isv_chr% 0 644
                   1899:        ;;
                   1900:
1.38      cube     1901: tap*)
                   1902:        unit=${i#tap}
                   1903:        case "$unit" in
                   1904:        [0-9]*)
                   1905:                mkdev tap${unit} c %tap_chr% ${unit} 600
                   1906:                ;;
                   1907:        *)
                   1908:                mkdev tap c %tap_chr% 0xfffff 600
                   1909:                ;;
                   1910:        esac
                   1911:        ;;
                   1912:
1.46      kiyohara 1913: fw*)
                   1914:        unit=${i#fw}
                   1915:        for j in 0 1 2 3
                   1916:        do
                   1917:                mkdev fw${unit}.${j} c %fw_chr% $((${unit} * 256 + ${j})) 660 ${g_operator}
                   1918:                mkdev fwmem${unit}.${j} c %fw_chr% $((65536 + ${unit} * 256 + ${j})) 660 ${g_operator}
                   1919:        done
                   1920:        ;;
                   1921:
1.90      pooka    1922: # create putter device and symlinks for all subsystems using it
                   1923: putter)
                   1924:        mkdev putter c %putter_chr% 0 600
1.91      pooka    1925:        mkdev pud c %putter_chr% 1 600
1.104     apb      1926:        lndev putter puffs
1.67      pooka    1927:        ;;
                   1928:
1.1       jdolecek 1929: midevend)
                   1930: %MI_DEVICES_END%
                   1931: local)
                   1932:        if [ -f "$0.local" ]; then
                   1933:                umask 0
1.85      dyoung   1934:                if [ -n "$count_nodes" ]; then
1.92      apb      1935:                        count_nodes=$((count_nodes + \
                   1936:                            $(linecount "$(sh "$0.local" $opts -s all)") ))
1.85      dyoung   1937:                else
                   1938:                        sh "$0.local" $opts all
                   1939:                fi
1.1       jdolecek 1940:                umask 077
                   1941:        fi
                   1942:        ;;
                   1943:
                   1944: *)
1.16      lukem    1945:        warn "$i: unknown device"
1.1       jdolecek 1946:        ;;
                   1947:
                   1948: esac
                   1949: done
                   1950:
                   1951: }
                   1952:
1.15      lukem    1953:
1.1       jdolecek 1954: # three variants of disk partitions - max 8, max 16, max 16 with highpartoffset
1.3       jdolecek 1955: # hack; only the one used by port is retained in final MAKEDEV script
1.1       jdolecek 1956: # routine is called as:
                   1957: # makedisk name unit blk chr
1.15      lukem    1958: makedisk_p8()
                   1959: {
1.1       jdolecek 1960:        name="$1"; unit="$2"; blk="$3"; chr="$4"
                   1961:
1.15      lukem    1962:        mkdev ${name}${unit}a   b $blk $(($unit * 8 + 0))       640 $g_operator
                   1963:        mkdev ${name}${unit}b   b $blk $(($unit * 8 + 1))       640 $g_operator
                   1964:        mkdev ${name}${unit}c   b $blk $(($unit * 8 + 2))       640 $g_operator
                   1965:        mkdev ${name}${unit}d   b $blk $(($unit * 8 + 3))       640 $g_operator
                   1966:        mkdev ${name}${unit}e   b $blk $(($unit * 8 + 4))       640 $g_operator
                   1967:        mkdev ${name}${unit}f   b $blk $(($unit * 8 + 5))       640 $g_operator
                   1968:        mkdev ${name}${unit}g   b $blk $(($unit * 8 + 6))       640 $g_operator
                   1969:        mkdev ${name}${unit}h   b $blk $(($unit * 8 + 7))       640 $g_operator
                   1970:        mkdev r${name}${unit}a  c $chr $(($unit * 8 + 0))       640 $g_operator
                   1971:        mkdev r${name}${unit}b  c $chr $(($unit * 8 + 1))       640 $g_operator
                   1972:        mkdev r${name}${unit}c  c $chr $(($unit * 8 + 2))       640 $g_operator
                   1973:        mkdev r${name}${unit}d  c $chr $(($unit * 8 + 3))       640 $g_operator
                   1974:        mkdev r${name}${unit}e  c $chr $(($unit * 8 + 4))       640 $g_operator
                   1975:        mkdev r${name}${unit}f  c $chr $(($unit * 8 + 5))       640 $g_operator
                   1976:        mkdev r${name}${unit}g  c $chr $(($unit * 8 + 6))       640 $g_operator
                   1977:        mkdev r${name}${unit}h  c $chr $(($unit * 8 + 7))       640 $g_operator
1.1       jdolecek 1978: }
1.15      lukem    1979:
                   1980: makedisk_p16()
                   1981: {
1.1       jdolecek 1982:        name="$1"; unit="$2"; blk="$3"; chr="$4"
                   1983:
1.15      lukem    1984:        mkdev ${name}${unit}a   b $blk $(($unit * 16 + 0))      640 $g_operator
                   1985:        mkdev ${name}${unit}b   b $blk $(($unit * 16 + 1))      640 $g_operator
                   1986:        mkdev ${name}${unit}c   b $blk $(($unit * 16 + 2))      640 $g_operator
                   1987:        mkdev ${name}${unit}d   b $blk $(($unit * 16 + 3))      640 $g_operator
                   1988:        mkdev ${name}${unit}e   b $blk $(($unit * 16 + 4))      640 $g_operator
                   1989:        mkdev ${name}${unit}f   b $blk $(($unit * 16 + 5))      640 $g_operator
                   1990:        mkdev ${name}${unit}g   b $blk $(($unit * 16 + 6))      640 $g_operator
                   1991:        mkdev ${name}${unit}h   b $blk $(($unit * 16 + 7))      640 $g_operator
                   1992:        mkdev ${name}${unit}i   b $blk $(($unit * 16 + 8))      640 $g_operator
                   1993:        mkdev ${name}${unit}j   b $blk $(($unit * 16 + 9))      640 $g_operator
                   1994:        mkdev ${name}${unit}k   b $blk $(($unit * 16 + 10))     640 $g_operator
                   1995:        mkdev ${name}${unit}l   b $blk $(($unit * 16 + 11))     640 $g_operator
                   1996:        mkdev ${name}${unit}m   b $blk $(($unit * 16 + 12))     640 $g_operator
                   1997:        mkdev ${name}${unit}n   b $blk $(($unit * 16 + 13))     640 $g_operator
                   1998:        mkdev ${name}${unit}o   b $blk $(($unit * 16 + 14))     640 $g_operator
                   1999:        mkdev ${name}${unit}p   b $blk $(($unit * 16 + 15))     640 $g_operator
                   2000:        mkdev r${name}${unit}a  c $chr $(($unit * 16 + 0))      640 $g_operator
                   2001:        mkdev r${name}${unit}b  c $chr $(($unit * 16 + 1))      640 $g_operator
                   2002:        mkdev r${name}${unit}c  c $chr $(($unit * 16 + 2))      640 $g_operator
                   2003:        mkdev r${name}${unit}d  c $chr $(($unit * 16 + 3))      640 $g_operator
                   2004:        mkdev r${name}${unit}e  c $chr $(($unit * 16 + 4))      640 $g_operator
                   2005:        mkdev r${name}${unit}f  c $chr $(($unit * 16 + 5))      640 $g_operator
                   2006:        mkdev r${name}${unit}g  c $chr $(($unit * 16 + 6))      640 $g_operator
                   2007:        mkdev r${name}${unit}h  c $chr $(($unit * 16 + 7))      640 $g_operator
                   2008:        mkdev r${name}${unit}i  c $chr $(($unit * 16 + 8))      640 $g_operator
                   2009:        mkdev r${name}${unit}j  c $chr $(($unit * 16 + 9))      640 $g_operator
                   2010:        mkdev r${name}${unit}k  c $chr $(($unit * 16 + 10))     640 $g_operator
                   2011:        mkdev r${name}${unit}l  c $chr $(($unit * 16 + 11))     640 $g_operator
                   2012:        mkdev r${name}${unit}m  c $chr $(($unit * 16 + 12))     640 $g_operator
                   2013:        mkdev r${name}${unit}n  c $chr $(($unit * 16 + 13))     640 $g_operator
                   2014:        mkdev r${name}${unit}o  c $chr $(($unit * 16 + 14))     640 $g_operator
                   2015:        mkdev r${name}${unit}p  c $chr $(($unit * 16 + 15))     640 $g_operator
1.1       jdolecek 2016: }
1.15      lukem    2017:
                   2018: makedisk_p16high()
                   2019: {
                   2020:        ho=524280       # offset for partition 9 to 16
1.1       jdolecek 2021:        name="$1"; unit="$2"; blk="$3"; chr="$4"
                   2022:
1.15      lukem    2023:        mkdev ${name}${unit}a   b $blk $(($unit * 8 + 0))       640 $g_operator
                   2024:        mkdev ${name}${unit}b   b $blk $(($unit * 8 + 1))       640 $g_operator
                   2025:        mkdev ${name}${unit}c   b $blk $(($unit * 8 + 2))       640 $g_operator
                   2026:        mkdev ${name}${unit}d   b $blk $(($unit * 8 + 3))       640 $g_operator
                   2027:        mkdev ${name}${unit}e   b $blk $(($unit * 8 + 4))       640 $g_operator
                   2028:        mkdev ${name}${unit}f   b $blk $(($unit * 8 + 5))       640 $g_operator
                   2029:        mkdev ${name}${unit}g   b $blk $(($unit * 8 + 6))       640 $g_operator
                   2030:        mkdev ${name}${unit}h   b $blk $(($unit * 8 + 7))       640 $g_operator
1.104     apb      2031:        mkdev ${name}${unit}i   b $blk $(($unit * 8 + $ho + 8)) 640 $g_operator
                   2032:        mkdev ${name}${unit}j   b $blk $(($unit * 8 + $ho + 9)) 640 $g_operator
1.15      lukem    2033:        mkdev ${name}${unit}k   b $blk $(($unit * 8 + $ho + 10)) 640 $g_operator
                   2034:        mkdev ${name}${unit}l   b $blk $(($unit * 8 + $ho + 11)) 640 $g_operator
                   2035:        mkdev ${name}${unit}m   b $blk $(($unit * 8 + $ho + 12)) 640 $g_operator
                   2036:        mkdev ${name}${unit}n   b $blk $(($unit * 8 + $ho + 13)) 640 $g_operator
                   2037:        mkdev ${name}${unit}o   b $blk $(($unit * 8 + $ho + 14)) 640 $g_operator
                   2038:        mkdev ${name}${unit}p   b $blk $(($unit * 8 + $ho + 15)) 640 $g_operator
                   2039:        mkdev r${name}${unit}a  c $chr $(($unit * 8 + 0))       640 $g_operator
                   2040:        mkdev r${name}${unit}b  c $chr $(($unit * 8 + 1))       640 $g_operator
                   2041:        mkdev r${name}${unit}c  c $chr $(($unit * 8 + 2))       640 $g_operator
                   2042:        mkdev r${name}${unit}d  c $chr $(($unit * 8 + 3))       640 $g_operator
                   2043:        mkdev r${name}${unit}e  c $chr $(($unit * 8 + 4))       640 $g_operator
                   2044:        mkdev r${name}${unit}f  c $chr $(($unit * 8 + 5))       640 $g_operator
                   2045:        mkdev r${name}${unit}g  c $chr $(($unit * 8 + 6))       640 $g_operator
                   2046:        mkdev r${name}${unit}h  c $chr $(($unit * 8 + 7))       640 $g_operator
1.104     apb      2047:        mkdev r${name}${unit}i  c $chr $(($unit * 8 + $ho + 8)) 640 $g_operator
                   2048:        mkdev r${name}${unit}j  c $chr $(($unit * 8 + $ho + 9)) 640 $g_operator
1.15      lukem    2049:        mkdev r${name}${unit}k  c $chr $(($unit * 8 + $ho + 10)) 640 $g_operator
                   2050:        mkdev r${name}${unit}l  c $chr $(($unit * 8 + $ho + 11)) 640 $g_operator
                   2051:        mkdev r${name}${unit}m  c $chr $(($unit * 8 + $ho + 12)) 640 $g_operator
                   2052:        mkdev r${name}${unit}n  c $chr $(($unit * 8 + $ho + 13)) 640 $g_operator
                   2053:        mkdev r${name}${unit}o  c $chr $(($unit * 8 + $ho + 14)) 640 $g_operator
                   2054:        mkdev r${name}${unit}p  c $chr $(($unit * 8 + $ho + 15)) 640 $g_operator
1.4       jdolecek 2055: }
                   2056:
                   2057: # make only the very few basic disk device nodes - 'a' partition
                   2058: # and raw partition
1.15      lukem    2059: makedisk_minimal()
                   2060: {
1.4       jdolecek 2061:        name=$1; unit=$2; blk=$3; chr=$4
                   2062:        doff=%DISKMINOROFFSET%
1.15      lukem    2063:        ro=%RAWDISK_OFF%
                   2064:        rn=%RAWDISK_NAME%
1.4       jdolecek 2065:
1.15      lukem    2066:        mkdev ${name}${unit}a   b $blk $(($unit * $doff + 0))   640 $g_operator
1.104     apb      2067:        mkdev ${name}${unit}$rn b $blk $(($unit * $doff + $ro)) 640 $g_operator
1.15      lukem    2068:        mkdev r${name}${unit}a  c $chr $(($unit * $doff + 0))   640 $g_operator
                   2069:        mkdev r${name}${unit}$rn c $chr $(($unit * $doff + $ro)) 640 $g_operator
1.1       jdolecek 2070: }
                   2071:
1.98      apb      2072: # create_mfs_dev nodes
1.104     apb      2073: #      Create a memory file system for a given number of device nodes,
                   2074: #      and mount it.  Attempts to use mount_tmpfs, or falls back to
                   2075: #      mount_mfs.
1.98      apb      2076: #
1.104     apb      2077: #      If do_redirect, then also redirect output to the console.
1.98      apb      2078: #
1.77      dsl      2079: create_mfs_dev()
                   2080: {
1.98      apb      2081:        ndevnodes=${1-1200}
                   2082:        dev_mountpoint=${PWD:-/dev}
                   2083:
                   2084:        # Number of inodes is the specified number of device nodes, plus
                   2085:        # a margin to allow for extra device nodes created later.
                   2086:        ninode=$((ndevnodes * 11 / 10))
                   2087:        # Add 2 reserved inodes (needed for both mfs and tmpfs), and round
                   2088:        # up to a multiple of 32 (needed for mfs, not needed for tmpfs).
                   2089:        ninode=$(( (ninode + 2 + 31) / 32 * 32 ))
                   2090:        # Try tmpfs; if that fails try mfs.
1.118     joerg    2091:        #
                   2092:        # For tmpfs, allocate 16KB and 512 byte per node.
                   2093:        # Actual requirements are much lower, but the size limit
                   2094:        # is only intended to avoid accidental writing to /dev.
                   2095:        fs_bytes=$((16384 + ninode * 512))
1.99      apb      2096:        if mount_tmpfs -s $fs_bytes -n $ninode -m 0755 \
1.98      apb      2097:                -o union tmpfs "$dev_mountpoint"
                   2098:        then
1.118     joerg    2099:                fstype=tmpfs
1.98      apb      2100:        else
1.118     joerg    2101:                # This file system size calculation is exact for mount_mfs(8)
                   2102:                # with 512-byte sectors.  40960 bytes (80 blocks) is the
                   2103:                # minimum size allowed by mount_mfs.
                   2104:                fs_bytes=$((8192 + 2 * 8192 + 4096 + ninode*512 + 8192))
                   2105:                [ "$fs_bytes" -lt 40960 ] && fs_bytes=40960
                   2106:                fs_blocks=$((fs_bytes/512))
                   2107:                if mount_mfs -b 4096 -f 512 -s $fs_blocks -n $ninode -p 0755 \
                   2108:                    -o union swap "$dev_mountpoint"
                   2109:                then
                   2110:                        fstype=mfs
                   2111:                else
                   2112:                        die "Failed to create memory file system"
                   2113:                fi
1.98      apb      2114:        fi
1.84      dyoung   2115:
1.98      apb      2116:        # Our current directory was in the lower file system; change it to
                   2117:        # the newly mounted upper file system.
                   2118:        cd "$dev_mountpoint"
1.84      dyoung   2119:
1.82      apb      2120:        if $do_redirect; then
                   2121:                # Redirect stdout and stderr to console
                   2122:                mknod -m 600 -g 0 -u 0 temp_console c 0 0
                   2123:                exec >temp_console 2>&1
                   2124:                rm temp_console
                   2125:        fi
1.98      apb      2126:
                   2127:        echo "Created $fstype $dev_mountpoint" \
1.118     joerg    2128:                "($fs_bytes byte, $ninode inodes)"
1.84      dyoung   2129: }
1.77      dsl      2130:
1.74      apb      2131: #
1.79      apb      2132: # MAIN: If MAKEDEV_AS_LIBRARY is set, then we are being used as a
1.93      apb      2133: # function library, so just return.  Otherwise, do all the real work.
1.74      apb      2134: #
1.79      apb      2135: [ -n "${MAKEDEV_AS_LIBRARY}" ] && return
1.97      apb      2136: makedev_main makedev ${1+"$@"}

CVSweb <webmaster@jp.NetBSD.org>