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

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

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

CVSweb <webmaster@jp.NetBSD.org>