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