Fix address wrapping bug in munmap and smmap.
[unix-history] / etc / etc.i386 / MAKEDEV
CommitLineData
25767e9e
RG
1#!/bin/sh -
2#
3# Copyright (c) 1990 The Regents of the University of California.
4# All rights reserved.
5#
6# Written and contributed by W. Jolitz 12/90
7#
8# Redistribution and use in source and binary forms are permitted provided
9# that: (1) source distributions retain this entire copyright notice and
10# comment, and (2) distributions including binaries display the following
11# acknowledgement: ``This product includes software developed by the
12# University of California, Berkeley and its contributors'' in the
13# documentation or other materials provided with the distribution and in
14# all advertising materials mentioning features or use of this software.
15# Neither the name of the University nor the names of its contributors may
16# be used to endorse or promote products derived from this software without
17# specific prior written permission.
18# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21#
22# @(#)MAKEDEV 5.2 (Berkeley) 6/22/90
23#
24# Device "make" file. Valid arguments:
b51cbe37 25# all makes all known devices, standard number of units (or close)
25767e9e
RG
26# std standard devices
27# local configuration specific devices
28#
29# Tapes:
30# wt* QIC-interfaced (e.g. not SCSI) 3M cartridge tape
b51cbe37
RG
31# st* "NEW type scsi tapes" (old driver uses the
32# block devices of the disks to get access)
25767e9e
RG
33#
34# Disks:
35# wd* "winchester" disk drives (ST506,IDE,ESDI,RLL,...)
36# fd* "floppy" disk drives (3 1/2", 5 1/4")
19ab8f72
RG
37# sd* "scsi disks"
38# cd* "cdrom disks"
25767e9e 39#
b51cbe37 40# Console ports:
475c422d
JH
41# pc* devices for stock pccons
42# vty* virtual console devices for syscons/pcvt/codrv
b51cbe37 43#
e336f8ba
NW
44# Pointing devices:
45# mse* Logitech and ATI Inport bus mouse
46# psm* PS/2 mouse
47#
25767e9e 48# Terminal ports:
61a5db5a
RG
49# sio* fast interrupt PC COM ports (really makes tty* entries for sio)
50# tty* alias for sio ports, this is what the system really wants
ad288a16
GW
51# com* standard PC COM ports (really makes tty* entries for com)
52# Note that the `com' driver is not configured in the
53# supplied kernels and is usually not what you want. In
54# a future release it may be completely desupported. Fair
55# warning.
25767e9e
RG
56#
57# Pseudo terminals:
58# pty* set of 16 master and slave pseudo terminals
475c422d 59# vty* virtual terminals using syscons/pcvt/codrv console
25767e9e
RG
60#
61# Printers:
b51cbe37
RG
62# lpt* stock lp
63# lpa* interruptless lp
25767e9e
RG
64#
65# Call units:
66#
67# Special purpose devices:
b51cbe37
RG
68# bpf* packet filter
69# dcf* dcf clock
70# speaker pc speaker
71# tw* xten power controller
82571c5f 72# snd* various sound cards
b51cbe37 73#
ad288a16 74# $Id: MAKEDEV,v 1.14 1993/10/28 09:59:27 rgrimes Exp $
25767e9e
RG
75#
76
b51cbe37 77PATH=/sbin:/bin/:/usr/bin:/usr/sbin:
25767e9e
RG
78umask 77
79for i
80do
81case $i in
82
b51cbe37
RG
83all)
84 sh MAKEDEV std # standard
bb174bd7 85 sh MAKEDEV wd0 wd1 fd0 fd1 wt0 sd0 sd1 st0 cd0 # bdev
b51cbe37 86 sh MAKEDEV pty0 tty0 tty1 tty2 tty3 pc0 lpt0 lpt1 lpt2 # cdev
bb174bd7 87 sh MAKEDEV ch0 tw0 bpf0 dcf0 lpa0 lpa1 lpa2 # cdev
b51cbe37 88 sh MAKEDEV speaker mse0 sio0 sio1 sio2 sio3 # cdev
e336f8ba
NW
89 # NOTE: co0 and vty04 are not done by a "sh MAKEDEV all"
90 # these are for codrv and interfere with other devices! - rgrimes
b51cbe37 91 ;;
25767e9e 92std)
f2b1fb8b 93 rm -f console drum mem kmem null zero io tty klog stdin stdout stderr
b51cbe37
RG
94 mknod console c 0 0; chmod 600 console; chown root.wheel console
95 mknod drum c 4 0; chmod 640 drum; chown root.kmem drum
96 mknod kmem c 2 1; chmod 640 kmem; chown root.kmem kmem
97 mknod mem c 2 0; chmod 640 mem; chown root.kmem mem
98 mknod null c 2 2; chmod 666 null; chown root.wheel null
26f98db6
RG
99 mknod zero c 2 12; chmod 666 zero; chown root.wheel zero
100 mknod io c 2 14; chmod 640 io; chown root.kmem io
b51cbe37
RG
101 mknod tty c 1 0; chmod 666 tty; chown root.wheel tty
102 mknod klog c 7 0; chmod 600 klog; chown root.wheel klog
103 mknod stdin c 22 0; chmod 666 stdin; chown root.wheel stdin
104 mknod stdout c 22 1; chmod 666 stdout; chown root.wheel stdout
105 mknod stderr c 22 2; chmod 666 stderr; chown root.wheel stderr
25767e9e
RG
106 rm -f fd/*
107 mkdir fd > /dev/null 2>&1
108 (cd fd && eval `echo "" | awk ' BEGIN { \
109 for (i = 0; i < 64; i++) \
b51cbe37 110 printf("mknod %d c 22 %d;", i, i)}'`)
25767e9e
RG
111 chown -R bin.bin fd
112 chmod 555 fd
113 chmod 666 fd/*
114 ;;
115
19ab8f72
RG
116
117# Create device files for new Archive/Wangtek QIC-02 tape driver (vak)
25767e9e 118wt*)
19ab8f72
RG
119 umask 2 ; u=`expr $i : '..\(.*\)'`
120 if [ x$u = x ]; then u=0; fi
121 rm -f rwt$u nrwt$u rwt${u}a nrwt${u}a rwt${u}b nrwt${u}b
122 mknod rwt${u} c 10 `expr 0 + $u` # 150 megabytes
123 mknod nrwt${u} c 10 `expr 4 + $u`
124 mknod rwt${u}a c 10 `expr 8 + $u` # 120 megabytes
125 mknod nrwt${u}a c 10 `expr 12 + $u`
126 mknod rwt${u}b c 10 `expr 16 + $u` # 60 megabytes
127 mknod nrwt${u}b c 10 `expr 20 + $u`
128 chown root.operator rwt$u nrwt$u rwt${u}a nrwt${u}a rwt${u}b nrwt${u}b
b51cbe37 129 umask 77;
25767e9e
RG
130 ;;
131
19ab8f72 132fd*|sd*|wd*)
25767e9e
RG
133 umask 2 ; unit=`expr $i : '..\(.*\)'`
134 case $i in
135 fd*) name=fd; blk=2; chr=9;;
b51cbe37 136 sd*) name=sd; blk=4; chr=13;;
25767e9e 137 wd*) name=wd; blk=0; chr=3;;
25767e9e
RG
138 esac
139 rm -f $name$unit? r$name$unit?
140 case $unit in
b51cbe37 141 0|1|2|3|4|5|6)
25767e9e
RG
142 mknod ${name}${unit}a b $blk `expr $unit '*' 8 + 0`
143 mknod ${name}${unit}b b $blk `expr $unit '*' 8 + 1`
144 mknod ${name}${unit}c b $blk `expr $unit '*' 8 + 2`
145 mknod ${name}${unit}d b $blk `expr $unit '*' 8 + 3`
146 mknod ${name}${unit}e b $blk `expr $unit '*' 8 + 4`
147 mknod ${name}${unit}f b $blk `expr $unit '*' 8 + 5`
148 mknod ${name}${unit}g b $blk `expr $unit '*' 8 + 6`
149 mknod ${name}${unit}h b $blk `expr $unit '*' 8 + 7`
150 mknod r${name}${unit}a c $chr `expr $unit '*' 8 + 0`
151 mknod r${name}${unit}b c $chr `expr $unit '*' 8 + 1`
152 mknod r${name}${unit}c c $chr `expr $unit '*' 8 + 2`
153 mknod r${name}${unit}d c $chr `expr $unit '*' 8 + 3`
154 mknod r${name}${unit}e c $chr `expr $unit '*' 8 + 4`
155 mknod r${name}${unit}f c $chr `expr $unit '*' 8 + 5`
156 mknod r${name}${unit}g c $chr `expr $unit '*' 8 + 6`
157 mknod r${name}${unit}h c $chr `expr $unit '*' 8 + 7`
158 chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
159 chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
160 ;;
161 *)
162 echo bad unit for disk in: $i
163 ;;
164 esac
165 umask 77
166 ;;
167
61a5db5a 168com*)
b51cbe37 169 unit=`expr $i : '...\(.*\)'`
61a5db5a 170 rm -f tty0$unit
b51cbe37 171 mknod tty0$unit c 8 $unit
61a5db5a 172 chown uucp.wheel tty0$unit
25767e9e
RG
173 ;;
174
175pty*)
176 class=`expr $i : 'pty\(.*\)'`
177 case $class in
178 0) offset=0 name=p;;
179 1) offset=16 name=q;;
180 2) offset=32 name=r;;
181 3) offset=48 name=s;;
182# Note that telnetd, rlogind, and xterm (at least) only look at p-s.
183 4) offset=64 name=t;;
184 *) echo bad unit for pty in: $i;;
185 esac
186 case $class in
187 0|1|2|3|4)
188 umask 0
189 eval `echo $offset $name | awk ' { b=$1; n=$2 } END {
190 for (i = 0; i < 16; i++)
b51cbe37
RG
191 printf("rm -f tty%s%x; mknod tty%s%x c 5 %d; \
192 rm -f pty%s%x; mknod pty%s%x c 6 %d; ", \
193 n, i, n, i, b+i, n, i, n, i, b+i); }'`
25767e9e
RG
194 umask 77
195 if [ $class = 1 ]; then
196 mv ttyqf ttyv0; mv ptyqf ptyv0
197 fi
198 ;;
199 esac
200 ;;
201
b51cbe37
RG
202st*)
203 umask 2 ; unit=`expr $i : '..\(.*\)'`
204 case $i in
6ca44b4c 205 st*) name=st; chr=14;;
b51cbe37 206 esac
6ca44b4c
RG
207 rm -f r$name$unit nr$name$unit er$name$unit enr$name$unit
208 rm -f hr$name$unit hnr$name$unit her$name$unit henr$name$unit
209 rm -f mr$name$unit mnr$name$unit mer$name$unit menr$name$unit
210 rm -f lr$name$unit lnr$name$unit ler$name$unit lenr$name$unit
b51cbe37
RG
211 case $unit in
212 0|1|2|3|4|5|6)
b51cbe37
RG
213 mknod r${name}${unit} c $chr `expr $unit '*' 16 + 0`
214 mknod nr${name}${unit} c $chr `expr $unit '*' 16 + 1`
215 mknod er${name}${unit} c $chr `expr $unit '*' 16 + 2`
6ca44b4c
RG
216 mknod hr${name}${unit} c $chr `expr $unit '*' 16 + 4`
217 mknod hnr${name}${unit} c $chr `expr $unit '*' 16 + 5`
218 mknod her${name}${unit} c $chr `expr $unit '*' 16 + 6`
219 mknod mr${name}${unit} c $chr `expr $unit '*' 16 + 8`
220 mknod mnr${name}${unit} c $chr `expr $unit '*' 16 + 9`
221 mknod mer${name}${unit} c $chr `expr $unit '*' 16 + 10`
222 mknod lr${name}${unit} c $chr `expr $unit '*' 16 + 12`
223 mknod lnr${name}${unit} c $chr `expr $unit '*' 16 + 13`
224 mknod ler${name}${unit} c $chr `expr $unit '*' 16 + 14`
225 chgrp operator r${name}${unit} nr${name}${unit} \
226 er${name}${unit}
227 chgrp operator hr${name}${unit} hnr${name}${unit} \
228 her${name}${unit}
229 chgrp operator mr${name}${unit} mnr${name}${unit} \
230 mer${name}${unit}
231 chgrp operator lr${name}${unit} lnr${name}${unit} \
232 ler${name}${unit}
233 chmod 640 r${name}${unit} nr${name}${unit} \
234 er${name}${unit}
235 chmod 640 hr${name}${unit} hnr${name}${unit} \
236 her${name}${unit}
237 chmod 640 mr${name}${unit} mnr${name}${unit} \
238 mer${name}${unit}
239 chmod 640 lr${name}${unit} lnr${name}${unit} \
240 ler${name}${unit}
b51cbe37
RG
241 ;;
242 *)
243 echo bad unit for tape in: $i
244 ;;
245 esac
246 umask 77
247 ;;
248
249ch*)
250 umask 2 ; unit=`expr $i : '..\(.*\)'`
251 case $i in
252 ch*) name=ch; chr=17;;
253 esac
254 rm -f $name$unit
255 case $unit in
256 0|1|2|3|4|5|6)
257 mknod ${name}${unit} c $chr `expr $unit '*' 16 + 0`
258 chgrp operator ${name}${unit}
259 chmod 640 ${name}${unit}
260 ;;
261 *)
262 echo bad unit for media changer in: $i
263 ;;
264 esac
265 umask 77
266 ;;
267
268cd*)
269 umask 2 ; unit=`expr $i : '..\(.*\)'`
270 case $i in
271 cd*) name=cd; blk=6; chr=15;;
272 esac
273 rm -f $name$unit? r$name$unit?
274 case $unit in
275 0|1|2|3|4|5|6)
276 mknod ${name}${unit}a b $blk `expr $unit '*' 8 + 0`
277 mknod ${name}${unit}d b $blk `expr $unit '*' 8 + 3`
278 mknod r${name}${unit}a c $chr `expr $unit '*' 8 + 0`
279 mknod r${name}${unit}d c $chr `expr $unit '*' 8 + 3`
280 chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
281 chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
282 ;;
283 *)
284 echo bad unit for disk in: $i
285 ;;
286 esac
287 umask 77
288 ;;
289
290lpt*)
291 unit=`expr $i : 'lpt\(.*\)'`
292 rm -f lpt$unit
293 mknod lpt$unit c 16 $unit
294 chown root.wheel lpt$unit
295 ;;
296
297tw*)
298 unit=`expr $i : 'tw\(.*\)'`
299 rm -f tw$unit
300 mknod tw$unit c 19 $unit
301 chown root.wheel tw$unit
302 ;;
303
b51cbe37
RG
304# hv 22-apr-93 use this to create the necessary video device for
305# pccons driver
306pc*)
307 chr=12
308 minor=0
309 name=vga
310 rm -f ${name} kbd kbdco vgaco ttyv[0-9][0-9]
311 mknod ${name} c ${chr} ${minor}
312 chown root.wheel $name
313 ;;
314
475c422d 315# Use this to create virtual consoles for syscons, pcvt or codrv
150fc6d7 316# /dev/ttyv0-b
b51cbe37
RG
317# use as MAKEDEV vtyNN to create NN entries
318vty*)
319 chr=12
320 units=`expr $i : 'vty\(.*\)'`
321 umask 0
322 eval `echo ${chr} ${units} | awk ' { c=$1; n=$2 } END {
323 for (i = 0; i < n; i++)
324 printf("rm -f ttyv%01x; mknod ttyv%01x c %d %d;", \
325 i, i, c, i); }'`
326 umask 77
327 ;;
328
329bpf*)
330 unit=`expr $i : 'bpf\(.*\)'`
331 rm -f bpf$unit
332 mknod bpf$unit c 23 $unit
333 chown root.wheel bpf$unit
334 ;;
335
336dcf*)
337 unit=`expr $i : 'dcf\(.*\)'`
338 rm -f dcf$unit
339 mknod dcf$unit c 24 $unit
340 chown root.wheel dcf$unit
341 ;;
342
343lpa*)
344 unit=`expr $i : 'lpa\(.*\)'`
345 chr=25
346 rm -f lpa$unit lpa${unit}p
347 mknod lpa${unit} c $chr `expr $unit + 0`
348 mknod lpa${unit}p c $chr `expr $unit + 32`
349 chown root.wheel lpa${unit} lpa${unit}p
350 ;;
351
352speaker)
353 rm -f speaker
354 mknod speaker c 26 0
355 chown root.wheel speaker
356 ;;
357
61a5db5a 358sio*|tty*)
b51cbe37 359 unit=`expr $i : '...\(.*\)'`
61a5db5a
RG
360 rm -f tty0$unit
361 mknod tty0$unit c 28 $unit
362 chown uucp.wheel tty0$unit
b51cbe37
RG
363 ;;
364
e336f8ba
NW
365mse*)
366 unit=`expr $i : 'mse\(.*\)'`
367 chr=27
368 rm -f mse$unit
369 mknod mse$unit c $chr `expr $unit '*' 2 + 1` # non-blocking for X11
370 chown root.wheel mse$unit
371 ;;
372
373psm*)
374 unit=`expr $i : 'psm\(.*\)'`
375 chr=21
376 rm -f psm$unit
377 mknod psm$unit c $chr `expr $unit '*' 2 + 1` # non-blocking for X11
378 chown root.wheel psm$unit
379 ;;
380
381mouse*)
382 name=`expr $i : 'mouse-\(.*\)'`
383 if [ ! -c $name ]; then
384 $0 $name # make the appropriate device
385 fi
386 rm -f mouse
387 ln -s $name mouse
388 ;;
389
82571c5f
JH
390
391snd*)
94eab694 392 chr=30
82571c5f 393 rm -f /dev/mixer # Mixer [ Control ]
94eab694 394 mknod /dev/mixer c $chr 0
82571c5f
JH
395 chmod 666 /dev/mixer
396
397 rm -f /dev/sequencer # Sequencer [ FM Synth and MIDI output ]
94eab694 398 mknod /dev/sequencer c $chr 1
82571c5f
JH
399 chmod 666 /dev/sequencer
400
401 rm -f /dev/midi # Midi input [ Not implemented ]
94eab694 402 mknod /dev/midi c $chr 2
82571c5f
JH
403
404 rm -f /dev/dsp # DSP [ Digitized voice ]
94eab694 405 mknod /dev/dsp c $chr 3
82571c5f
JH
406 chmod 666 /dev/dsp
407
408 rm -f /dev/audio # SPARC audio [ Not fully implemented ]
94eab694 409 mknod /dev/audio c $chr 4
82571c5f
JH
410 chmod 666 /dev/audio
411
412 rm -f /dev/dsp16 # DSP16 [ Same as /dev/dsp, except 16 bits ]
94eab694 413 mknod /dev/dsp16 c $chr 5
82571c5f
JH
414 chmod 666 /dev/dsp16
415
416 rm -f /dev/sndstat # Status Device [ Debugging interface ]
94eab694 417 mknod /dev/sndstat c $chr 6
82571c5f
JH
418 chmod 666 /dev/sndstat
419
420 rm -f /dev/pro_midi # PRO_MIDI [PAS midi input and output]
94eab694 421 mknod /dev/pro_midi c $chr 15
82571c5f
JH
422 chmod 666 /dev/pro_midi
423
424 rm -f /dev/dsp1 # DSP 1 [ SB emulation of PAS16 or 2nd audio ]
94eab694 425 mknod /dev/dsp1 c $chr 19
82571c5f
JH
426 chmod 666 /dev/dsp1
427
428 rm -f /dev/audio1 # Sparc Audio 1 [ SB emulation of PAS16 or 2nd audio ]
94eab694 429 mknod /dev/audio1 c $chr 20
82571c5f
JH
430 chmod 666 /dev/audio1
431 ;;
432
25767e9e
RG
433local)
434 umask 0
435 sh MAKEDEV.local
436 ;;
437
438esac
439done