1#!/bin/sh - 2# 3# @(#)MAKEDEV 8.1 (Berkeley) 06/09/93 4# 5 6# Device "make" file. Valid arguments: 7# std standard devices 8# local configuration specific devices 9# Tapes: 10# ct* HP300 HP-IB cartridge tape 11# st* Exabyte tape 12# Disks: 13# cd* "concatenated" pseudo-disks 14# rd* HP300 HP-IB disks 15# sd* HP300 SCSI disks 16# vnd* "file" pseudo-disks 17# Terminal multiplexors: 18# dca* HP200/300 single port serial interface 19# dcm* HP200/300 4 port serial mux interface 20# Pseudo terminals: 21# pty* set of 16 master and slave pseudo terminals 22# Printers: 23# Call units: 24# Special purpose devices: 25# flog* kernel logging device 26# grf* raw interface to HP300 graphics devices 27# ite* terminal emulator interface to HP300 graphics devices 28# hil HP300 HIL input devices 29 30PATH=/sbin:/bin/:/usr/bin:/usr/sbin 31umask 77 32for i 33do 34case $i in 35 36std) 37 mknod console c 0 0 38 mknod drum c 3 0 ; chmod 640 drum ; chgrp kmem drum 39 mknod kmem c 2 1 ; chmod 640 kmem ; chgrp kmem kmem 40 mknod mem c 2 0 ; chmod 640 mem ; chgrp kmem mem 41 mknod null c 2 2 ; chmod 666 null 42 mknod zero c 2 12 ; chmod 666 zero 43 mknod tty c 1 0 ; chmod 666 tty 44 mknod klog c 6 0 ; chmod 600 klog 45 mknod stdin c 21 0 ; chmod 666 stdin 46 mknod stdout c 21 1 ; chmod 666 stdout 47 mknod stderr c 21 2 ; chmod 666 stderr 48 mkdir fd > /dev/null 2>&1 49 (cd fd && eval `echo "" | awk ' BEGIN { \ 50 for (i = 0; i < 64; i++) \ 51 printf("mknod %d c 21 %d;", i, i)}'`) 52 chown -R bin.bin fd 53 chmod 555 fd 54 chmod 666 fd/* 55 ;; 56 57ct*|st*) 58 umask 0 ; unit=`expr $i : '..\(.*\)'` 59 case $i in 60 ct*) name=ct; blk=0; chr=7;; 61 st*) name=st; blk=6; chr=20;; 62 esac 63 case $unit in 64 0|1|2|3|4|5|6|7) 65 four=`expr $unit + 4` ; eight=`expr $unit + 8` 66 twelve=`expr $unit + 12`; twenty=`expr $unit + 20` 67 # 68 # block devices don't work so don't make them 69 #mknod ${name}${unit} b $blk $unit 70 #mknod ${name}${four} b $blk $four 71 #mknod ${name}${eight} b $blk $eight 72 #mknod ${name}${twelve} b $blk $twelve 73 #mknod n${name}${unit} b $blk $four ;: sanity w/pdp11 v7 74 #mknod n${name}${eight} b $blk $twelve ;: ditto 75 # 76 mknod r${name}${unit} c $chr $unit 77 mknod r${name}${four} c $chr $four 78 mknod r${name}${eight} c $chr $eight 79 mknod r${name}${twelve} c $chr $twelve 80 ln r${name}${four} nr${name}${unit} ;: sanity w/pdp11 v7 81 ln r${name}${twelve} nr${name}${eight} ;: ditto 82 ;; 83 *) 84 echo bad unit for tape in: $1 85 ;; 86 esac 87 umask 77 88 ;; 89 90cd*|fd*|rd*|sd*) 91 umask 2 ; unit=`expr $i : '..\(.*\)'` 92 case $i in 93 rd*) name=rd; blk=2; chr=9;; 94 sd*) name=sd; blk=4; chr=8;; 95 cd*) name=cd; blk=5; chr=17;; 96 vnd*) name=vnd; blk=6; chr=19;; 97 esac 98 case $unit in 99 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|\ 100 17|18|19|20|21|22|23|24|25|26|27|28|29|30|31) 101 mknod ${name}${unit}c b $blk `expr $unit '*' 8 + 2` 102 mknod r${name}${unit}c c $chr `expr $unit '*' 8 + 2` 103 if [ $name != cd -a $name != vnd ] 104 then 105 mknod ${name}${unit}a b $blk `expr $unit '*' 8 + 0` 106 mknod ${name}${unit}b b $blk `expr $unit '*' 8 + 1` 107 mknod ${name}${unit}d b $blk `expr $unit '*' 8 + 3` 108 mknod ${name}${unit}e b $blk `expr $unit '*' 8 + 4` 109 mknod ${name}${unit}f b $blk `expr $unit '*' 8 + 5` 110 mknod ${name}${unit}g b $blk `expr $unit '*' 8 + 6` 111 mknod ${name}${unit}h b $blk `expr $unit '*' 8 + 7` 112 mknod r${name}${unit}a c $chr `expr $unit '*' 8 + 0` 113 mknod r${name}${unit}b c $chr `expr $unit '*' 8 + 1` 114 mknod r${name}${unit}d c $chr `expr $unit '*' 8 + 3` 115 mknod r${name}${unit}e c $chr `expr $unit '*' 8 + 4` 116 mknod r${name}${unit}f c $chr `expr $unit '*' 8 + 5` 117 mknod r${name}${unit}g c $chr `expr $unit '*' 8 + 6` 118 mknod r${name}${unit}h c $chr `expr $unit '*' 8 + 7` 119 fi 120 chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h] 121 chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h] 122 ;; 123 *) 124 echo bad unit for disk in: $i 125 ;; 126 esac 127 umask 77 128 ;; 129 130dca*) 131 unit=`expr $i : 'dca\(.*\)'` 132 case $unit in 133 0) 134 mknod tty0 c 12 0 135 ;; 136 *) 137 echo bad unit for dca in: $i 138 ;; 139 esac 140 ;; 141 142dcm*) 143 unit=`expr $i : 'dcm\(.*\)'` 144 case $unit in 145 0|1|2|3) 146 eval `echo $unit | awk ' { unit = $1; u = 4 * $1 } END { 147 for (i = 0; i < 4; i++) 148 printf("mknod tty0%x c 15 %d; ",u+i,u+i); }'` 149 ;; 150 *) 151 echo bad unit for dcm in: $i 152 ;; 153 esac 154 ;; 155 156ite*) 157 unit=`expr $i : 'ite\(.*\)'` 158 case $unit in 159 0|1|2|3) 160 mknod ttye${unit} c 13 ${unit} 161 ;; 162 *) 163 echo bad unit for ite in: $i 164 ;; 165 esac 166 ;; 167 168grf*) 169 unit=`expr $i : 'grf\(.*\)'` 170 case $unit in 171 0|1|2|3) 172 mknod grf${unit} c 10 ${unit}; chmod 666 grf${unit} 173 echo "grf${unit}: use MAKEDEV.hpux to make HP-UX names for device" 174 ;; 175 *) 176 echo bad unit for grf in: $i 177 ;; 178 esac 179 ;; 180 181hil) 182 for unit in 0 1 2 3 4 5 6 7 183 do 184 mknod hil${unit} c 14 ${unit} 185 if [ -f /usr/local/hilinfo ] 186 then 187 case `/usr/local/hilinfo -t hil${unit}` in 188 mouse) 189 if [ ! -f locator ] 190 then 191 ln hil${unit} locator 192 fi 193 ;; 194 keyboard) 195 if [ ! -f keyboard ] 196 then 197 ln hil${unit} keyboard 198 fi 199 ;; 200 *) 201 ;; 202 esac 203 fi 204 done 205 if [ ! -f /usr/local/hilinfo ] 206 then 207 ln hil1 keyboard 208 ln hil3 locator 209 fi 210 chmod 666 hil* 211 echo "hil: use MAKEDEV.hpux to make HP-UX names for devices" 212 ;; 213 214pty*) 215 class=`expr $i : 'pty\(.*\)'` 216 case $class in 217 0) offset=0 name=p;; 218 1) offset=16 name=q;; 219 2) offset=32 name=r;; 220 3) offset=48 name=s;; 221# Note that telnetd, rlogind, and xterm (at least) only look at p-s. 222 4) offset=64 name=t;; 223 *) echo bad unit for pty in: $i;; 224 esac 225 case $class in 226 0|1|2|3|4) 227 umask 0 228 eval `echo $offset $name | awk ' { b=$1; n=$2 } END { 229 for (i = 0; i < 16; i++) 230 printf("mknod tty%s%x c 4 %d; \ 231 mknod pty%s%x c 5 %d; ", \ 232 n, i, b+i, n, i, b+i); }'` 233 umask 77 234 if [ $class = 1 ]; then 235 mv ttyqf ttyv0; mv ptyqf ptyv0 236 fi 237 ;; 238 esac 239 ;; 240 241local) 242 umask 0 243 sh MAKEDEV.local 244 ;; 245*) 246 echo $i: unknown device 247 ;; 248esac 249done 250