]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/MAKEDEV
This is the Linux generic soundcard driver, version 1.0c. Supports
[FreeBSD/FreeBSD.git] / etc / MAKEDEV
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:
25 #       all     makes all known devices, standard number of units (or close)
26 #       std     standard devices
27 #       local   configuration specific devices
28 #
29 # Tapes:
30 #       wt*     QIC-interfaced (e.g. not SCSI) 3M cartridge tape
31 #       st*     "NEW type scsi tapes" (old driver uses the
32 #               block devices of the disks to get access)
33 #
34 # Disks:
35 #       wd*     "winchester" disk drives (ST506,IDE,ESDI,RLL,...)
36 #       fd*     "floppy" disk drives (3 1/2", 5 1/4")
37 #       sd*     "scsi disks"
38 #       cd*     "cdrom disks"
39 #
40 # Console ports:
41 #       pc*     devices for stock pccons
42 #       vty*    virtual console devices for syscons/pcvt/codrv
43
44 # Pointing devices:
45 #       mse*    Logitech and ATI Inport bus mouse
46 #       psm*    PS/2 mouse
47 #
48 # Terminal ports:
49 #       com*    standard PC COM ports (really makes tty* entries for com)
50 #       sio*    fast interrupt PC COM ports (really makes tty* entries for sio)
51 #       tty*    alias for sio ports, this is what the system really wants
52 #
53 # Pseudo terminals:
54 #       pty*    set of 16 master and slave pseudo terminals
55 #       vty*    virtual terminals using syscons/pcvt/codrv console
56 #
57 # Printers:
58 #       lpt*    stock lp
59 #       lpa*    interruptless lp
60 #
61 # Call units:
62 #
63 # Special purpose devices:
64 #       bpf*    packet filter
65 #       dcf*    dcf clock
66 #       speaker pc speaker
67 #       tw*     xten power controller
68 #
69 #       $Id: MAKEDEV,v 1.10 1993/10/06 03:35:03 rgrimes Exp $
70 #
71
72 PATH=/sbin:/bin/:/usr/bin:/usr/sbin:
73 umask 77
74 for i
75 do
76 case $i in
77
78 all)
79         sh MAKEDEV std                                          # standard
80         sh MAKEDEV wd0 wd1 fd0 fd1 wt0 sd0 sd1 st0 cd0          # bdev
81         sh MAKEDEV pty0 tty0 tty1 tty2 tty3 pc0 lpt0 lpt1 lpt2  # cdev
82         sh MAKEDEV ch0 tw0 bpf0 dcf0 lpa0 lpa1 lpa2             # cdev
83         sh MAKEDEV speaker mse0 sio0 sio1 sio2 sio3             # cdev
84         # NOTE: co0 and vty04 are not done by a "sh MAKEDEV all"
85         # these are for codrv and interfere with other devices! - rgrimes
86         ;;
87 std)
88         rm -f console drum mem kmem null tty klog stdin stdout stderr
89         mknod console   c 0 0;  chmod 600 console;      chown root.wheel console
90         mknod drum      c 4 0;  chmod 640 drum;         chown root.kmem drum
91         mknod kmem      c 2 1;  chmod 640 kmem;         chown root.kmem kmem
92         mknod mem       c 2 0;  chmod 640 mem;          chown root.kmem mem
93         mknod null      c 2 2;  chmod 666 null;         chown root.wheel null
94         mknod zero      c 2 12; chmod 666 zero;         chown root.wheel zero
95         mknod io        c 2 14; chmod 640 io;           chown root.kmem io
96         mknod tty       c 1 0;  chmod 666 tty;          chown root.wheel tty
97         mknod klog      c 7 0;  chmod 600 klog;         chown root.wheel klog
98         mknod stdin     c 22 0; chmod 666 stdin;        chown root.wheel stdin
99         mknod stdout    c 22 1; chmod 666 stdout;       chown root.wheel stdout
100         mknod stderr    c 22 2; chmod 666 stderr;       chown root.wheel stderr
101         rm -f fd/*
102         mkdir fd > /dev/null 2>&1
103         (cd fd && eval `echo "" | awk ' BEGIN { \
104                 for (i = 0; i < 64; i++) \
105                         printf("mknod %d c 22 %d;", i, i)}'`)
106         chown -R bin.bin fd
107         chmod 555 fd
108         chmod 666 fd/*
109         ;;
110
111
112 # Create device files for new Archive/Wangtek QIC-02 tape driver (vak)
113 wt*)
114         umask 2 ; u=`expr $i : '..\(.*\)'`
115         if [ x$u = x ]; then u=0; fi
116         rm -f rwt$u nrwt$u rwt${u}a nrwt${u}a rwt${u}b nrwt${u}b
117         mknod rwt${u}   c 10 `expr  0 + $u`     # 150 megabytes
118         mknod nrwt${u}  c 10 `expr  4 + $u`
119         mknod rwt${u}a  c 10 `expr  8 + $u`     # 120 megabytes
120         mknod nrwt${u}a c 10 `expr 12 + $u`
121         mknod rwt${u}b  c 10 `expr 16 + $u`     # 60 megabytes
122         mknod nrwt${u}b c 10 `expr 20 + $u`
123         chown root.operator rwt$u nrwt$u rwt${u}a nrwt${u}a rwt${u}b nrwt${u}b
124         umask 77;
125         ;;
126
127 fd*|sd*|wd*)
128         umask 2 ; unit=`expr $i : '..\(.*\)'`
129         case $i in
130         fd*) name=fd; blk=2; chr=9;;
131         sd*) name=sd; blk=4; chr=13;;
132         wd*) name=wd; blk=0; chr=3;;
133         esac
134         rm -f $name$unit? r$name$unit?
135         case $unit in
136         0|1|2|3|4|5|6)
137                 mknod ${name}${unit}a   b $blk `expr $unit '*' 8 + 0`
138                 mknod ${name}${unit}b   b $blk `expr $unit '*' 8 + 1`
139                 mknod ${name}${unit}c   b $blk `expr $unit '*' 8 + 2`
140                 mknod ${name}${unit}d   b $blk `expr $unit '*' 8 + 3`
141                 mknod ${name}${unit}e   b $blk `expr $unit '*' 8 + 4`
142                 mknod ${name}${unit}f   b $blk `expr $unit '*' 8 + 5`
143                 mknod ${name}${unit}g   b $blk `expr $unit '*' 8 + 6`
144                 mknod ${name}${unit}h   b $blk `expr $unit '*' 8 + 7`
145                 mknod r${name}${unit}a  c $chr `expr $unit '*' 8 + 0`
146                 mknod r${name}${unit}b  c $chr `expr $unit '*' 8 + 1`
147                 mknod r${name}${unit}c  c $chr `expr $unit '*' 8 + 2`
148                 mknod r${name}${unit}d  c $chr `expr $unit '*' 8 + 3`
149                 mknod r${name}${unit}e  c $chr `expr $unit '*' 8 + 4`
150                 mknod r${name}${unit}f  c $chr `expr $unit '*' 8 + 5`
151                 mknod r${name}${unit}g  c $chr `expr $unit '*' 8 + 6`
152                 mknod r${name}${unit}h  c $chr `expr $unit '*' 8 + 7`
153                 chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
154                 chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
155                 ;;
156         *)
157                 echo bad unit for disk in: $i
158                 ;;
159         esac
160         umask 77
161         ;;
162
163 com*)
164         unit=`expr $i : '...\(.*\)'`
165         rm -f tty0$unit
166         mknod tty0$unit c 8 $unit
167         chown uucp.wheel tty0$unit
168         ;;
169
170 pty*)
171         class=`expr $i : 'pty\(.*\)'`
172         case $class in
173         0) offset=0 name=p;;
174         1) offset=16 name=q;;
175         2) offset=32 name=r;;
176         3) offset=48 name=s;;
177 # Note that telnetd, rlogind, and xterm (at least) only look at p-s.
178         4) offset=64 name=t;;
179         *) echo bad unit for pty in: $i;;
180         esac
181         case $class in
182         0|1|2|3|4)
183                 umask 0
184                 eval `echo $offset $name | awk ' { b=$1; n=$2 } END {
185                         for (i = 0; i < 16; i++)
186                                 printf("rm -f tty%s%x; mknod tty%s%x c 5 %d; \
187                                         rm -f pty%s%x; mknod pty%s%x c 6 %d; ", \
188                                         n, i, n, i, b+i, n, i, n, i, b+i); }'`
189                 umask 77
190                 if [ $class = 1 ]; then
191                         mv ttyqf ttyv0; mv ptyqf ptyv0
192                 fi
193                 ;;
194         esac
195         ;;
196
197 st*)
198         umask 2 ; unit=`expr $i : '..\(.*\)'`
199         case $i in
200         st*) name=st;  chr=14;;
201         esac
202         rm -f r$name$unit nr$name$unit er$name$unit enr$name$unit 
203         rm -f hr$name$unit hnr$name$unit her$name$unit henr$name$unit 
204         rm -f mr$name$unit mnr$name$unit mer$name$unit menr$name$unit 
205         rm -f lr$name$unit lnr$name$unit ler$name$unit lenr$name$unit 
206         case $unit in
207         0|1|2|3|4|5|6)
208                 mknod r${name}${unit}   c $chr `expr $unit '*' 16 + 0`
209                 mknod nr${name}${unit}  c $chr `expr $unit '*' 16 + 1`
210                 mknod er${name}${unit}  c $chr `expr $unit '*' 16 + 2`
211                 mknod hr${name}${unit}  c $chr `expr $unit '*' 16 + 4`
212                 mknod hnr${name}${unit} c $chr `expr $unit '*' 16 + 5`
213                 mknod her${name}${unit} c $chr `expr $unit '*' 16 + 6`
214                 mknod mr${name}${unit}  c $chr `expr $unit '*' 16 + 8`
215                 mknod mnr${name}${unit} c $chr `expr $unit '*' 16 + 9`
216                 mknod mer${name}${unit} c $chr `expr $unit '*' 16 + 10`
217                 mknod lr${name}${unit}  c $chr `expr $unit '*' 16 + 12`
218                 mknod lnr${name}${unit} c $chr `expr $unit '*' 16 + 13`
219                 mknod ler${name}${unit} c $chr `expr $unit '*' 16 + 14`
220                 chgrp operator r${name}${unit} nr${name}${unit} \
221                         er${name}${unit}  
222                 chgrp operator hr${name}${unit} hnr${name}${unit} \
223                         her${name}${unit}  
224                 chgrp operator mr${name}${unit} mnr${name}${unit} \
225                         mer${name}${unit}  
226                 chgrp operator lr${name}${unit} lnr${name}${unit} \
227                         ler${name}${unit}  
228                 chmod 640 r${name}${unit} nr${name}${unit} \
229                         er${name}${unit} 
230                 chmod 640 hr${name}${unit} hnr${name}${unit} \
231                         her${name}${unit} 
232                 chmod 640 mr${name}${unit} mnr${name}${unit} \
233                         mer${name}${unit} 
234                 chmod 640 lr${name}${unit} lnr${name}${unit} \
235                         ler${name}${unit} 
236                 ;;
237         *)
238                 echo bad unit for tape in: $i
239                 ;;
240         esac
241         umask 77
242         ;;
243
244 ch*)
245         umask 2 ; unit=`expr $i : '..\(.*\)'`
246         case $i in
247         ch*) name=ch;  chr=17;;
248         esac
249         rm -f $name$unit
250         case $unit in
251         0|1|2|3|4|5|6)
252                 mknod ${name}${unit}    c $chr `expr $unit '*' 16 + 0`
253                 chgrp operator ${name}${unit}
254                 chmod 640 ${name}${unit}
255                 ;;
256         *)
257                 echo bad unit for media changer in: $i
258                 ;;
259         esac
260         umask 77
261         ;;
262
263 cd*)
264         umask 2 ; unit=`expr $i : '..\(.*\)'`
265         case $i in
266         cd*) name=cd; blk=6; chr=15;;
267         esac
268         rm -f $name$unit? r$name$unit?
269         case $unit in
270         0|1|2|3|4|5|6)
271                 mknod ${name}${unit}a   b $blk `expr $unit '*' 8 + 0`
272                 mknod ${name}${unit}d   b $blk `expr $unit '*' 8 + 3`
273                 mknod r${name}${unit}a  c $chr `expr $unit '*' 8 + 0`
274                 mknod r${name}${unit}d  c $chr `expr $unit '*' 8 + 3`
275                 chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
276                 chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
277                 ;;
278         *)
279                 echo bad unit for disk in: $i
280                 ;;
281         esac
282         umask 77
283         ;;
284
285 lpt*)
286         unit=`expr $i : 'lpt\(.*\)'`
287         rm -f lpt$unit
288         mknod lpt$unit c 16 $unit
289         chown root.wheel lpt$unit
290         ;;
291
292 tw*)
293         unit=`expr $i : 'tw\(.*\)'`
294         rm -f tw$unit
295         mknod tw$unit c 19 $unit
296         chown root.wheel tw$unit
297         ;;
298
299 # hv 22-apr-93 use this to create the necessary video device for
300 # pccons driver
301 pc*)
302         chr=12
303         minor=0
304         name=vga
305         rm -f ${name} kbd kbdco vgaco ttyv[0-9][0-9]
306         mknod ${name} c ${chr} ${minor}
307         chown root.wheel $name
308         ;;
309
310 # Use this to create virtual consoles for syscons, pcvt or codrv
311 # /dev/ttyv0-b
312 # use as MAKEDEV vtyNN to create NN entries
313 vty*)
314         chr=12
315         units=`expr $i : 'vty\(.*\)'`
316         umask 0
317         eval `echo ${chr} ${units} | awk ' { c=$1; n=$2 } END {
318                 for (i = 0; i < n; i++)
319                         printf("rm -f ttyv%01x; mknod ttyv%01x c %d %d;", \
320                                 i, i, c, i); }'`
321         umask 77
322         ;;
323
324 bpf*)
325         unit=`expr $i : 'bpf\(.*\)'`
326         rm -f bpf$unit
327         mknod bpf$unit c 23 $unit
328         chown root.wheel bpf$unit
329         ;;
330
331 dcf*)
332         unit=`expr $i : 'dcf\(.*\)'`
333         rm -f dcf$unit
334         mknod dcf$unit c 24 $unit
335         chown root.wheel dcf$unit
336         ;;
337
338 lpa*)
339         unit=`expr $i : 'lpa\(.*\)'`
340         chr=25
341         rm -f lpa$unit lpa${unit}p
342         mknod lpa${unit}        c $chr `expr $unit + 0`
343         mknod lpa${unit}p       c $chr `expr $unit + 32`
344         chown root.wheel lpa${unit} lpa${unit}p
345         ;;
346
347 speaker)
348         rm -f speaker
349         mknod speaker c 26 0
350         chown root.wheel speaker
351         ;;
352
353 sio*|tty*)
354         unit=`expr $i : '...\(.*\)'`
355         rm -f tty0$unit
356         mknod tty0$unit c 28 $unit
357         chown uucp.wheel tty0$unit
358         ;;
359
360 mse*)
361         unit=`expr $i : 'mse\(.*\)'`
362         chr=27
363         rm -f mse$unit
364         mknod mse$unit c $chr `expr $unit '*' 2 + 1`    # non-blocking for X11
365         chown root.wheel mse$unit
366         ;;
367
368 psm*)
369         unit=`expr $i : 'psm\(.*\)'`
370         chr=21
371         rm -f psm$unit
372         mknod psm$unit c $chr `expr $unit '*' 2 + 1`    # non-blocking for X11
373         chown root.wheel psm$unit
374         ;;
375
376 mouse*)
377         name=`expr $i : 'mouse-\(.*\)'`
378         if [ ! -c $name ]; then
379                 $0 $name                        # make the appropriate device
380         fi
381         rm -f mouse
382         ln -s $name mouse
383         ;;
384
385 local)
386         umask 0
387         sh MAKEDEV.local
388         ;;
389
390 esac
391 done