1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
|
#! /bin/sh -
# $Id: MAKEDEV 1421 2005-08-23 23:56:23Z vapier $
#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
# Customisation:
# The devices fall into various classes. This section contains the mapping
# from a class name into a group name and permission.
# You will almost certainly need to edit the group name to match your
# system, and you may change the permissions to suit your preference. These
# lines _must_ be of the format "user group perm".
public=" root root 0666"
private=" root root 0600"
system=" root root 0660"
kmem=" root kmem 0640"
tty=" root tty 0666"
cons=" root tty 0600"
dialout=" root dialout 0660"
dip=" root dip 0660"
mouse=" root root 0660"
printer=" root lp 0660"
floppy=" root floppy 0660"
disk=" root disk 0660"
scsi=" root root 0600"
cdrom=" root cdrom 0660"
tape=" root tape 0660"
audio=" root audio 0660"
video=" root video 0660"
ibcs2=" root root 0666"
scanner=" root root 0666"
coda=" root root 0600"
ipsec=" root root 0200"
readable=" root root 0444"
MAXVT=63
# defaults for $major_*
major_ide0=3
major_ide1=22
major_sd=8
major_lp=6
# Remark: OSS/Linux becomes major_OSSLinux
#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
# try to do the right things if udev is running
if [ "$WRITE_ON_UDEV" ]; then
:
elif [ -d /dev/.static/dev/ ] && [ "`pwd`" = /dev ] && [ -e /proc/mounts ] \
&& grep -qE '^[^ ]+ /dev/\.static/dev' /proc/mounts; then
cd /dev/.static/dev/
elif [ -d /.dev/ ] && [ "`pwd`" = /dev ] && [ -e /proc/mounts ] \
&& grep -qE '^[^ ]+ /\.dev' /proc/mounts; then
cd /.dev/
elif [ -d .udevdb/ ] && [ "`pwd`" = /dev ]; then
echo ".udevdb presence implies active udev. Aborting MAKEDEV invocation."
# use exit 0, not 1, so postinst scripts don't fail on this
exit 0
fi
#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
# don't stomp on devfs users
if [ -c .devfsd ]
then
echo ".devfsd presence implies active DevFS. Aborting MAKEDEV invocation."
# use exit 0, not 1, so postinst scripts don't fail on this
exit 0
fi
#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
# don't stomp on non-Linux users
if [ "$(uname -s)" != "Linux" ]
then
echo "Results undefined on non-Linux systems, aborting MAKEDEV invocation."
# use exit 0, not 1, so postinst scripts don't fail on this
exit 0
fi
#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
procfs=/proc
opt_v=
opt_d=
opt_n=
while [ $# -ge 1 ]
do
case $1 in
--) shift; break ;;
-v) shift; opt_v=1 ;;
-d) shift; opt_d=1 ;;
-n) shift; opt_n=1; opt_v=1 ;;
-V) shift; opt_V=1 ;;
-*) echo "$0: unknown flag \"$1\"" >&2; exit 1 ;;
*) break ;;
esac
done
if [ "$opt_V" ]
then
echo "This is MAKEDEV based on Debian's makedev_2.3.1-78."
echo "See the MAKEDEV(8) manpage for more information."
exit 0
fi
opts="${opt_n:+-n} ${opt_v:+-v} ${opt_d:+-d}"
#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
devicename () { # translate device names to something safe
echo "$*" | sed -e 's/[^A-Za-z0-9_]/_/g'
}
makedev () { # usage: makedev name [bcu] major minor owner group mode
if [ "$opt_v" ]
then if [ "$opt_d" ]
then echo "delete $1"
else echo "create $1 $2 $3 $4 $5:$6 $7"
fi
fi
# missing parameters are a bug - bail - should we do an exit 1 here?
case :$1:$2:$3:$4:$5:$6:$7: in
*::*) echo "Warning: MAKEDEV $@ is missing parameter(s)." >&2;;
esac
if [ ! "$opt_n" ]
then
if [ "$opt_d" ]
then
rm -f $1
else
rm -f $1-
if mknod $1- $2 $3 $4 &&
chown $5:$6 $1- &&
chmod $7 $1- &&
mv $1- $1
then
: # it worked
else
# Didn't work, clean up any mess...
echo "makedev $@: failed"
rm -f $1-
fi
fi
fi
}
symlink () { # usage: symlink name target
if [ "$opt_v" ]
then if [ "$opt_d" ]
then echo "delete $1"
else echo "create $1 -> $2"
fi
fi
[ ! "$opt_n" ] && rm -f $1 &&
[ ! "$opt_d" ] && ln -s $2 $1
}
#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
# Debian allows us to assume /bin/sh is a POSIX compliant shell, so go for it!
math () {
eval echo "\$(($*))"
}
index () { # index string c
eval "I=\${1%$2*}"
eval echo "\${#I}"
}
suffix () {
eval echo "\${1#$2}"
}
strip () {
eval echo "\${1% $2 *} \${1#* $2 }"
}
first () {
echo "${1%%?}"
}
second () {
echo "${1##?}"
}
substr () {
echo $1 | dd bs=1 count=1 skip=$(( $2 - 1 )) 2> /dev/null
}
#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
devices=
if [ ! -f $procfs/devices ]
then
echo "$0: warning: can't read $procfs/devices" >&2
else
exec 3<$procfs/devices
while read major device extra <&3
do
device=`echo $device | sed 's#/.*##'`
case "$major" in
Character|Block|'')
;;
*)
safedevname=`devicename $device`
eval "major_$safedevname=$major"
devices="$devices $device"
;;
esac
done
exec 3<&-
fi
Major () {
device=$2
devname=`devicename $1`
if [ "$opt_d" ]
then
echo -1 # don't care
else
eval echo \${major_$devname:-\${device:?\"unknown major number for $1\"}}
fi
}
cvt () {
while [ $# -ne 0 ]
do
case "$1" in
mem|tty|ttyp|cua|cub|cui) ;;
hd) (for d in a b c d e f g h ; do
echo -n hd$d " "
done) ; echo
;;
ide0) echo hda hdb ;;
ide1) echo hdc hdd ;;
ide2) echo hde hdf ;;
ide3) echo hdg hdh ;;
ide4) echo hdi hdj ;;
ide5) echo hdk hdl ;;
ide6) echo hdm hdn ;;
ide7) echo hdo hdp ;;
ide8) echo hdq hdr ;;
ide9) echo hds hdt ;;
sd) echo sda sdb sdc sdd ;;
dasd) (for d in 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 ; do
echo -n dasd$d " "
done) ; echo
;;
raw) echo raw ;;
sg) echo sg ;;
sr) echo scd ;;
st) echo st0 ;;
xd) echo xda xdb ;;
ad) echo ada adb ;;
fd) echo fd0 fd1 ;;
lp) echo lp ;;
mt) echo ftape ;;
qft) echo ftape ;;
loop) echo loop ;;
md) echo md ;;
ibcs2) echo ibcs2 ;;
tpqic02) echo qic ;;
sound) echo audio ;;
logiscan) echo logiscan ;;
ac4096) echo ac4096 ;;
hw) echo helloworld ;;
sbpcd | sbpcd[123]) echo $1 ;;
joystick) echo js ;;
input) echo input ;;
apm_bios) echo apm ;;
dcf) echo dcf ;;
aztcd) echo aztcd ;;
cm206cd) echo cm206cd ;;
gscd) echo gscd ;;
pcmcia) ;; # taken care of by its own driver
ttyC) echo cyclades ;;
isdn) echo isdnmodem isdnbri dcbri ;;
vcs) ;;
pty) echo pty ;;
misc) echo misc ;;
3dfx) echo 3dfx ;;
agpgart) echo agpgart ;;
microcode) echo microcode ;;
ipmi|ipmikcs) echo ipmi ;;
fb) echo fb ;;
nb|drbd) echo nb0 nb1 nb2 nb3 nb4 nb5 nb6 nb7;;
netlink) echo netlink ;;
tap) echo netlink ;;
hamradio) echo hamradio ;;
snd) ;;
ptm) ;;
pts) ;;
ttyB) (for l in 0 1 2 3 4 5 6 7 ; do
echo -n ttyB$l " "
done) ; echo
;;
ttyS) echo ttyS0 ttyS1 ttyS2 ttyS3 ttyS4 ;;
ttyI) echo ttyI0 ttyI1 ttyI2 ttyI3 ;;
ircomm|irlpt) irda ;;
ppp) echo ppp ;;
usb) echo usb ;;
dpt_i2o) echo dpti ;;
bluetooth) echo bluetooth ;;
lvm) ;; # taken care of by LVM userspace tools
ramdisk) echo ram ;;
*) echo "$0: don't know what \"$1\" is" >&2 ;;
esac
shift
done
}
get_arch() {
case `uname -m` in
arm*) echo arm;;
i?86) echo i386;;
ppc*) echo powerpc;;
s390*) echo s390;;
sh*) echo sh;;
x86_64) echo i386;;
# alpha|hppa|ia64|m68k|mips|sparc
*) echo $a;;
esac
}
for arg in $*
do
# case `cvt $arg` in
case $arg in
generic)
$0 $opts generic-`get_arch`
;;
generic-alpha)
$0 $opts std
$0 $opts fd
$0 $opts fd0 fd1
$0 $opts hda hdb hdc hdd
$0 $opts xda xdb
$0 $opts sda sdb sdc sdd
$0 $opts scd0 scd1
$0 $opts st0 st1
$0 $opts sg
$0 $opts pty
$0 $opts console
$0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS4
$0 $opts busmice
$0 $opts lp
$0 $opts par
$0 $opts audio
$0 $opts fb
$0 $opts dac960
;;
generic-arm)
$0 $opts std
$0 $opts fd
$0 $opts fd0 fd1
$0 $opts hda hdb hdc hdd
$0 $opts xda xdb
$0 $opts sda sdb sdc sdd
$0 $opts scd0 scd1
$0 $opts st0 st1
$0 $opts sg
$0 $opts pty
$0 $opts console
$0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS4
$0 $opts busmice
makedev sunmouse c 10 6 $mouse
$0 $opts lp
$0 $opts par
$0 $opts audio
$0 $opts fb
;;
generic-hppa)
$0 $opts std
$0 $opts fd
$0 $opts fd0 fd1
$0 $opts hda hdb hdc hdd
$0 $opts sda sdb sdc sdd
$0 $opts scd0 scd1
$0 $opts st0 st1
$0 $opts sg
$0 $opts pty
$0 $opts console
$0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS4
$0 $opts ttyB0 ttyB1 ttyB2 ttyB3 ttyB4 ttyB5 ttyB6 ttyB7
$0 $opts busmice
$0 $opts lp
$0 $opts par
$0 $opts audio
$0 $opts fb
$0 $opts rtc
;;
generic-i386)
$0 $opts std
$0 $opts fd
$0 $opts fd0 fd1
$0 $opts hda hdb hdc hdd
$0 $opts xda xdb
$0 $opts sda sdb sdc sdd
$0 $opts scd0 scd1
$0 $opts st0 st1
$0 $opts sg
$0 $opts pty
$0 $opts console
$0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS4
$0 $opts busmice
$0 $opts input
$0 $opts lp
$0 $opts par
$0 $opts audio
$0 $opts fb
$0 $opts isdn-io eda edb sonycd mcd mcdx cdu535
$0 $opts optcd sjcd cm206cd gscd
$0 $opts lmscd sbpcd aztcd bpcd dac960 dpti ida ataraid cciss
$0 $opts i2o.hda i2o.hdb i2o.hdc i2o.hdd
;;
generic-ia64)
$0 $opts std
$0 $opts fd
$0 $opts fd0 fd1
$0 $opts hda hdb hdc hdd
$0 $opts sda sdb sdc sdd
$0 $opts scd0 scd1
$0 $opts st0 st1
$0 $opts sg
$0 $opts pty
$0 $opts console
$0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS4 ttyS5
$0 $opts busmice
$0 $opts input
$0 $opts lp
$0 $opts par
$0 $opts audio
$0 $opts fb
$0 $opts efirtc
;;
generic-m68k)
$0 $opts std
$0 $opts fd
$0 $opts fd0 fd1
$0 $opts hda hdb hdc hdd
$0 $opts sda sdb sdc sdd
$0 $opts scd0 scd1
$0 $opts sg
$0 $opts ada adb adc add ade adf
$0 $opts pty
$0 $opts console
$0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS4 ttyS5
$0 $opts m68k-mice
$0 $opts lp
$0 $opts par
$0 $opts nvram
$0 $opts audio
$0 $opts fb
;;
generic-mips)
$0 $opts std
$0 $opts fd
$0 $opts fd0 fd1
$0 $opts hda hdb
$0 $opts sda sdb sdc sdd
$0 $opts scd0 scd1
$0 $opts st0 st1
$0 $opts sg
$0 $opts pty
$0 $opts console
$0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS4
$0 $opts lp
$0 $opts par
$0 $opts audio
$0 $opts fb
$0 $opts busmice
;;
generic-mipsel)
$0 $opts std
$0 $opts fd
$0 $opts fd0 fd1
$0 $opts hda hdb
$0 $opts sda sdb sdc sdd
$0 $opts scd0 scd1
$0 $opts st0 st1
$0 $opts sg
$0 $opts pty
$0 $opts console
$0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS4
$0 $opts lp
$0 $opts par
$0 $opts audio
$0 $opts fb
$0 $opts rtc
;;
generic-powerpc)
$0 $opts std
$0 $opts fd
$0 $opts fd0 fd1
$0 $opts hda hdb hdc hdd
$0 $opts sda sdb sdc sdd
$0 $opts scd0 scd1
$0 $opts st0 st1
$0 $opts sg
$0 $opts pty
$0 $opts console
$0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS4
$0 $opts busmice
$0 $opts m68k-mice
$0 $opts input
$0 $opts lp
$0 $opts par
$0 $opts nvram
$0 $opts audio
$0 $opts adb
$0 $opts fb
$0 $opts rtc
$0 $opts isdn-io
;;
generic-s390)
$0 $opts std
$0 $opts fd
$0 $opts dasda dasdb dasdc dasdd dasde dasdf dasdg dasdh \
dasdi dasdj dasdk dasdl dasdm dasdn dasdo dasdp \
dasdq dasdr dasds dasdt dasdu dasdv dasdw dasdx \
dasdy dasdz
$0 $opts pty
$0 $opts consoleonly
$0 $opts rtc
;;
generic-sh)
$0 $opts std
$0 $opts fd
$0 $opts fd0 fd1
$0 $opts hda hdb
$0 $opts sda sdb sdc sdd
$0 $opts scd0 scd1
$0 $opts st0 st1
$0 $opts sg
$0 $opts pty
$0 $opts console
$0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS4
$0 $opts ttySC0 ttySC1 ttySC2 ttySC3
$0 $opts lp
$0 $opts par
$0 $opts audio
$0 $opts fb
$0 $opts rtc
;;
generic-sparc)
$0 $opts std
$0 $opts fd
$0 $opts fd0 fd1
$0 $opts hda hdb hdc hdd
$0 $opts sda sdb sdc sdd
$0 $opts scd0 scd1
$0 $opts st0 st1
$0 $opts sg
$0 $opts pty
$0 $opts console
$0 $opts ttyS0 ttyS1 ttyS2 ttyS3 ttyS4
$0 $opts busmice
$0 $opts fb
$0 $opts rtc
makedev kbd c 11 0 $cons
makedev sunmouse c 10 6 $mouse
symlink mouse sunmouse
makedev openprom c 10 139 root root 0664
;;
generic-vserver)
makedev null c 1 3 $public
makedev zero c 1 5 $public
makedev full c 1 7 $public
makedev random c 1 8 $public
makedev urandom c 1 9 $readable
makedev tty c 5 0 $tty
# generate only a few ptys
for i in `seq 0 5`; do
makedev ptyp$i c 2 $i $tty
makedev ttyp$i c 3 $i $tty
done
$0 $opts fd
$0 $opts ptmx
;;
generic-*)
echo "$0: no support for generic on this arch" >&2
exit 1
;;
local)
$0.local $opts
;;
std)
makedev mem c 1 1 $kmem
makedev kmem c 1 2 $kmem
makedev null c 1 3 $public
makedev port c 1 4 $kmem
makedev zero c 1 5 $public
symlink core $procfs/kcore
makedev full c 1 7 $public
makedev random c 1 8 $public
makedev urandom c 1 9 $readable
makedev tty c 5 0 $tty
$0 $opts ram
$0 $opts loop
;;
hamradio)
$0 $opts scc
$0 $opts bc
;;
scc)
for unit in 0 1 2 3 4 5 6 7
do
makedev scc$unit c 34 $unit $system
done
;;
bc)
for unit in 0 1 2 3
do
makedev bc$unit c 51 $unit $system
done
;;
random)
makedev random c 1 8 $public
;;
urandom)
makedev urandom c 1 9 $readable
;;
ram)
for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do
makedev ram$i b 1 $i $disk
done
symlink ram ram1
;;
ram[0-9]|ram1[0-6])
unit=`suffix $arg ram`
makedev ram$unit b 1 $unit $disk
;;
initrd)
makedev initrd b 1 250 $disk
;;
raw)
makedev rawctl c 162 0 $disk
mkdir -p raw
for i in 1 2 3 4 5 6 7 8; do
makedev raw/raw$i c 162 $i $disk
done
;;
consoleonly)
makedev tty0 c 4 0 $cons
# new kernels need a device, old ones a symlink... sigh
kern_rev1=`uname -r | sed -e 's@^\([^.]*\)\..*@\1@'`
kern_rev2=`uname -r | sed -e 's@^[^.]*\.\([^.]*\)\..*@\1@'`
if [ $kern_rev1 -gt 2 ]
then
makedev console c 5 1 $cons
else
if [ $kern_rev1 -eq 2 ] && [ $kern_rev2 -ge 1 ]
then
makedev console c 5 1 $cons
else
symlink console tty0
fi
fi
;;
console)
$0 $opts consoleonly
major=`Major vcs 7` # not fatal
[ "$major" ] && makedev vcs0 c $major 0 $cons
symlink vcs vcs0
[ "$major" ] && makedev vcsa0 c $major 128 $cons
symlink vcsa vcsa0
# individual vts
line=1
while [ $line -le $MAXVT ] && [ $line -le 63 ]
do
makedev tty$line c 4 $line $cons
[ "$major" ] && makedev vcs$line c $major $line $cons
[ "$major" ] && makedev vcsa$line c $major `math $line + 128` $cons
line=`math $line + 1`
done
;;
adb)
case `get_arch` in
powerpc)
# ADB bus devices (char)
makedev adb c 56 0 $mouse
makedev adbmouse c 10 10 $mouse
;;
m68k)
# ACSI disk 2, whole device (block)
makedev adb b 28 16 $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
minor=$(( 16 + $part ))
makedev adb$part b 28 $minor $disk
done
;;
*)
echo "no support for adb on this arch" >&2
exit 1
;;
esac
;;
raw1394)
makedev raw1394 c 171 0 $disk
;;
video1394)
rm -f video1394
mkdir -p video1394
for i in `seq 0 15`
do
makedev video1394/$i c 171 `math 16 + $i` $video
done
;;
nvram)
makedev nvram c 10 144 $mouse
;;
tty[1-9]|tty[1-5][0-9]|tty[6][0-3])
line=`suffix $arg tty`
makedev tty$line c 4 $line $cons
;;
ttyS[0-9]|ttyS[1-5][0-9]|ttyS[6][0-3])
line=`suffix $arg ttyS`
minor=`math 64 + $line`
makedev ttyS$line c 4 $minor $dialout
;;
ttySC[0-3])
line=`suffix $arg ttySC`
minor=`math 8 + $line`
makedev ttySC$line c 204 $minor $dialout
;;
ttyB[0-7])
minor=`suffix $arg ttyB`
makedev ttyB$minor c 11 $minor $dialout
;;
pty[a-ep-z])
bank=`suffix $arg pty`
base=`index pqrstuvwxyzabcde $bank`
base=`math $base \* 16`
for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f
do
j=`index 0123456789abcdef $i`
makedev pty$bank$i c 2 `math $base + $j` $tty
makedev tty$bank$i c 3 `math $base + $j` $tty
done
;;
pty)
ptysufs=""
for i in p q r s t u v w x y z a b c d e
do
ptysufs="$ptysufs pty$i"
done
$0 $opts $ptysufs ptmx
;;
ptmx)
# master pty multiplexer for 2.1 kernels
makedev ptmx c 5 2 $tty
;;
cyclades|ttyC)
major1=`Major ttyC 19` || continue
#major2=`Major cub 20` || continue
for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 \
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
do
makedev ttyC$i c $major1 $i $dialout
#makedev cub$i c $major2 $i $dialout
done
;;
stallion|ttyE)
major1=`Major ttyE 24` || continue
#major2=`Major cue 25` || continue
majorc=28
minor=0
until [ $minor -gt 256 ]
do
makedev ttyE$minor c $major1 $minor $dialout
#makedev cue$minor c $major2 $minor $dialout
minor=`math $minor + 1`
done
for i in 0 1 2 3
do
makedev staliomem$i c $majorc $i $private
done
;;
chase|ttyH)
major1=`Major ttyH 17` || continue
#major2=`Major cuh 18` || continue
minor=0
until [ $minor -gt 16 ] # tell me if 16 is wrong
do
makedev ttyH$minor c $major1 $minor $dialout
#makedev cuh$minor c $major2 $minor $dialout
minor=`math $minor + 1`
done
;;
rocketport|ttyR)
major1=`Major ttyR 46` || continue
#major2=`Major cur 47` || continue
minor=0
until [ $minor -gt 64 ] # tell me if 64 is wrong
do
makedev ttyR$minor c $major1 $minor $dialout
#makedev cur$minor c $major2 $minor $dialout
minor=`math $minor + 1`
done
;;
ttyV)
major1=`Major ttyV 105` || continue
#major2=`Major cuv 106` || continue
minor=0
until [ $minor -gt 16 ] # tell me if 16 is wrong
do
makedev ttyV$minor c $major1 $minor $dialout
#makedev cuv$minor c $major2 $minor $dialout
minor=`math $minor + 1`
done
;;
digi|ttyD)
major1=`Major ttyD 22` || continue
#major2=`Major cud 23` || continue
minor=0
until [ $minor -gt 16 ] # tell me if 16 is wrong
do
makedev ttyD$minor c $major1 $minor $dialout
#makedev cud$minor c $major2 $minor $dialout
minor=`math $minor + 1`
done
;;
specialix|ttyX)
major1=`Major ttyX 32` || continue
#major2=`Major cux 33` || continue
minor=0
until [ $minor -gt 16 ] # tell me if 16 is wrong
do
makedev ttyX$minor c $major1 $minor $dialout
#makedev cux$minor c $major2 $minor $dialout
minor=`math $minor + 1`
done
;;
specialixIO8|ttyW)
major1=`Major ttyW 75` || continue
#major2=`Major cuw 76` || continue
minor=0
until [ $minor -gt 16 ] # tell me if 16 is wrong
do
makedev ttyW$minor c $major1 $minor $dialout
#makedev cuw$minor c $major2 $minor $dialout
minor=`math $minor + 1`
done
;;
PAM|ttyM)
major1=`Major ttyM 79` || continue
#major2=`Major cum 80` || continue
minor=0
until [ $minor -gt 16 ] # tell me if 16 is wrong
do
makedev ttyM$minor c $major1 $minor $dialout
#makedev cum$minor c $major2 $minor $dialout
minor=`math $minor + 1`
done
;;
riscom|ttyL)
major=`Major ttyL 48` || continue
minor=0
until [ $minor -gt 16 ] # tell me if 16 is wrong
do
makedev ttyL$minor c $major $minor $dialout
minor=`math $minor + 1`
done
;;
computone|ttyF)
major=`Major ttyF 71` || continue
#major2=`Major cuf 72` || continue
minor=0
until [ $minor -gt 255 ]
do
makedev ttyF$minor c $major $minor $dialout
#makedev cuf$minor c $major2 $minor $dialout
minor=`math $minor + 1`
done
major=73
for i in 0 4 8 12
do
makedev ip2ipl$i c $major $i $private
makedev ip2stat$i c $major `math $i + 1` $private
done
;;
ESP|ttyP)
major=`Major ttyP 57` || continue
#major2=`Major cup 58` || continue
minor=0
until [ $minor -gt 4 ] # tell me if 4 is wrong
do
makedev ttyP$minor c $major $minor $dialout
#makedev cup$minor c $major2 $minor $dialout
minor=`math $minor + 1`
done
;;
COMX|comx)
major=`Major comx 88` || continue
minor=0
until [ $minor -gt 4 ] # tell me if 4 is wrong
do
makedev comx$minor c $major $minor $private
minor=`math $minor + 1`
done
;;
isdnmodem|ttyI)
major1=`Major ttyI 43` || continue
#major2=`Major cui 44` || continue
minor=0
until [ $minor -gt 63 ]
do
makedev ttyI$minor c $major1 $minor $dialout
#makedev cui$minor c $major2 $minor $dialout
minor=`math $minor + 1`
done
;;
isdnbri)
major=45
minor=0
until [ $minor -gt 63 ]
do
makedev isdn$minor c $major $minor $dialout
makedev isdnctrl$minor c $major `math $minor + 64` $dialout
makedev ippp$minor c $major `math $minor + 128` $dialout
minor=`math $minor + 1`
done
makedev isdninfo c $major 255 $private
;;
dcbri)
major=52
for i in 0 1 2 3
do
makedev dcbri$i c $major $i $dialout
done
;;
capi)
major=68
makedev capi20 c $major 0 $dialout
for i in 0 1 2 3 4 5 6 7 8 9
do
makedev capi20.0$i c $major `math $i + 1` $dialout
done
for i in 10 11 12 13 14 15 16 17 18 19
do
makedev capi20.$i c $major `math $i + 1` $dialout
done
;;
ubd)
major=98
for devicenum in 0 1 2 3 4 5 6 7
do
device=ubd`substr abcdefgh $(($devicenum + 1))`
baseminor=`math $devicenum \* 16`
makedev $device b $major $baseminor $disk
for partition in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
minor=`math $baseminor + $partition`
makedev $device$partition b $major $minor $disk
done
done
;;
fb)
for i in 0 1 2 3 4 5 6 7
do
makedev fb$i c 29 $i $video
done
;;
fb[0-7])
dev=`suffix $arg fb`
makedev fb$dev c 29 $dev $video
;;
netlink|tap|tap[0-9]|tap1[0-5])
makedev route c 36 0 $coda
makedev skip c 36 1 $coda
makedev fwmonitor c 36 3 $coda
for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
makedev tap$i c 36 `math $i + 16` $coda
done
;;
tun)
mkdir -p net
makedev net/tun c 10 200 $system
;;
lp)
major=`Major lp 6` || continue
makedev ${arg}0 c $major 0 $printer
makedev ${arg}1 c $major 1 $printer
makedev ${arg}2 c $major 2 $printer
;;
par)
major=`Major lp 6` || continue
makedev ${arg}0 c $major 0 $printer
makedev ${arg}1 c $major 1 $printer
makedev ${arg}2 c $major 2 $printer
;;
parport)
major=`Major parport 99` || continue
makedev ${arg}0 c $major 0 $printer
makedev ${arg}1 c $major 1 $printer
makedev ${arg}2 c $major 2 $printer
;;
slm)
major=`Major slm 28` || continue
for i in 0 1 2 3
do
makedev slm c $major $i $printer
done
;;
input)
major=`Major pcsp 13` || continue
mkdir -p input
for i in 0 1 2 3
do
makedev input/js$i c $major $i $mouse
makedev input/mouse$i c $major `math $i + 32` $mouse
makedev input/event$i c $major `math $i + 64` $mouse
done
makedev input/mice c $major 63 $mouse
;;
busmice)
major=`Major mouse 10` || continue
makedev logibm c $major 0 $mouse
makedev psaux c $major 1 $mouse
makedev inportbm c $major 2 $mouse
makedev atibm c $major 3 $mouse
makedev jbm c $major 4 $mouse
;;
m68k-mice)
major=`Major mouse 10` || continue
makedev amigamouse c $major 4 $mouse
makedev atarimouse c $major 5 $mouse
makedev amigamouse1 c $major 7 $mouse
makedev adbmouse c $major 10 $mouse
;;
3dfx)
major=`Major $arg 107` || continue
makedev $arg c $major 0 $video
;;
agpgart)
major=`Major $arg 10` || continue
makedev $arg c $major 175 $video
;;
hwrng)
major=`Major $arg 10` || continue
makedev $arg c $major 183 $private
;;
cpu|microcode)
mkdir -p cpu
makedev cpu/microcode c 10 184 $private
for i in 0 1 2 3
do
mkdir -p cpu/$i
makedev cpu/$i/msr c 202 $i $private
makedev cpu/$i/cpuid c 203 $i $private
done
;;
ipmi|ipmikcs)
major=`Major ipmikcs 10` || continue
makedev ipmikcs c $major 173 $private
;;
irda)
for i in 0 1
do
makedev ircomm$i c 161 $i $dialout
makedev irlpt$i c 161 `math $i + 16` $printer
done
;;
irnet)
makedev irnet c 10 187 $system
;;
misc)
major=`Major mouse 10` || continue
makedev logibm c $major 0 $mouse
makedev psaux c $major 1 $mouse
makedev inportbm c $major 2 $mouse
makedev atibm c $major 3 $mouse
makedev jbm c $major 4 $mouse
makedev amigamouse c $major 4 $mouse
makedev atarimouse c $major 5 $mouse
makedev sunmouse c $major 6 $mouse
makedev amigamouse1 c $major 7 $mouse
makedev smouse c $major 8 $mouse
makedev pc110pad c $major 9 $mouse
makedev adbmouse c $major 10 $mouse
makedev beep c $major 128 $mouse
makedev modreq c $major 129 $mouse
makedev watchdog c $major 130 $mouse
makedev temperature c $major 131 $mouse
makedev hwtrap c $major 132 $mouse
makedev exttrp c $major 133 $mouse
makedev apm_bios c $major 134 $mouse
makedev rtc c $major 135 $mouse
makedev openprom c $major 139 root root 0664
makedev relay8 c $major 140 $mouse
makedev relay16 c $major 141 $mouse
makedev msr c $major 142 $mouse
makedev pciconf c $major 143 $mouse
makedev nvram c $major 144 $mouse
makedev hfmodem c $major 145 $mouse
makedev led c $major 151 $mouse
makedev mergemem c $major 153 $mouse
makedev pmu c $major 154 $mouse
;;
pmu)
major=`Major mouse 10` || continue
makedev pmu c $major 154 $mouse
;;
thinkpad)
major=`Major mouse 10` || continue
mkdir -p thinkpad
makedev thinkpad/thinkpad c $major 170 $mouse
;;
rtc)
major=`Major mouse 10` || continue
makedev rtc c $major 135 $mouse
;;
efirtc)
major=`Major mouse 10` || continue
makedev efirtc c $major 136 $mouse
;;
mwave)
makedev mwave c 10 219 $mouse
;;
systrace)
makedev systrace c 10 226 $private
;;
uinput)
makedev input/uinput c 10 223 $mouse
;;
js)
major=`Major Joystick 13` || continue
for unit in 0 1 2 3
do
makedev js$unit c $major $unit $readable
makedev djs$unit c $major `math $unit + 128` $readable
done
;;
fd[0-7])
major=`Major fd 2` || continue
base=`suffix $arg fd`
if [ $base -ge 4 ]
then
base=`math $base + 124`
fi
makedev ${arg} b $major $base $floppy
makedev ${arg}d360 b $major `math $base + 4` $floppy
makedev ${arg}h1200 b $major `math $base + 8` $floppy
makedev ${arg}u360 b $major `math $base + 12` $floppy
makedev ${arg}u720 b $major `math $base + 16` $floppy
makedev ${arg}h360 b $major `math $base + 20` $floppy
makedev ${arg}h720 b $major `math $base + 24` $floppy
makedev ${arg}u1440 b $major `math $base + 28` $floppy
makedev ${arg}u2880 b $major `math $base + 32` $floppy
makedev ${arg}CompaQ b $major `math $base + 36` $floppy
makedev ${arg}h1440 b $major `math $base + 40` $floppy
makedev ${arg}u1680 b $major `math $base + 44` $floppy
makedev ${arg}h410 b $major `math $base + 48` $floppy
makedev ${arg}u820 b $major `math $base + 52` $floppy
makedev ${arg}h1476 b $major `math $base + 56` $floppy
makedev ${arg}u1722 b $major `math $base + 60` $floppy
makedev ${arg}h420 b $major `math $base + 64` $floppy
makedev ${arg}u830 b $major `math $base + 68` $floppy
makedev ${arg}h1494 b $major `math $base + 72` $floppy
makedev ${arg}u1743 b $major `math $base + 76` $floppy
makedev ${arg}h880 b $major `math $base + 80` $floppy
makedev ${arg}u1040 b $major `math $base + 84` $floppy
makedev ${arg}u1120 b $major `math $base + 88` $floppy
makedev ${arg}h1600 b $major `math $base + 92` $floppy
makedev ${arg}u1760 b $major `math $base + 96` $floppy
makedev ${arg}u1920 b $major `math $base + 100` $floppy
makedev ${arg}u3200 b $major `math $base + 104` $floppy
makedev ${arg}u3520 b $major `math $base + 108` $floppy
makedev ${arg}u3840 b $major `math $base + 112` $floppy
makedev ${arg}u1840 b $major `math $base + 116` $floppy
makedev ${arg}u800 b $major `math $base + 120` $floppy
makedev ${arg}u1600 b $major `math $base + 124` $floppy
;;
ed[a-b])
major=`Major ed 36` || continue
unit=`suffix $arg ed`
base=`index ab $unit`
base=`math $base \* 64`
makedev ed$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 # 9 10 11 12 13 14 15 16 17 18 19 20
do
makedev ed$unit$part b $major `math $base + $part` $disk
done
;;
hd[a-b])
major=`Major ide0` || major=`Major hd 3` || continue
unit=`suffix $arg hd`
base=`index ab $unit`
base=`math $base \* 64`
makedev hd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
makedev hd$unit$part b $major `math $base + $part` $disk
done
;;
hd[c-d])
major=`Major ide1 22` || continue
unit=`suffix $arg hd`
base=`index cd $unit`
base=`math $base \* 64`
makedev hd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
makedev hd$unit$part b $major $(( $base + $part )) $disk
done
;;
hd[e-f])
major=`Major ide2 33` || continue
unit=`suffix $arg hd`
base=`index ef $unit`
base=`math $base \* 64`
makedev hd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
makedev hd$unit$part b $major $(( $base + $part )) $disk
done
;;
hd[g-h])
major=`Major ide3 34` || continue
unit=`suffix $arg hd`
base=`index gh $unit`
base=`math $base \* 64`
makedev hd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
makedev hd$unit$part b $major $(( $base + $part )) $disk
done
;;
hd[i-j])
major=`Major ide4 56` || continue
unit=`suffix $arg hd`
base=`index ij $unit`
base=`math $base \* 64`
makedev hd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
makedev hd$unit$part b $major $(( $base + $part )) $disk
done
;;
hd[k-l])
major=`Major ide5 57` || continue
unit=`suffix $arg hd`
base=`index kl $unit`
base=`math $base \* 64`
makedev hd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
makedev hd$unit$part b $major $(( $base + $part )) $disk
done
;;
hd[m-n])
major=`Major ide6 88` || continue
unit=`suffix $arg hd`
base=`index mn $unit`
base=`math $base \* 64`
makedev hd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
makedev hd$unit$part b $major $(( $base + $part )) $disk
done
;;
hd[o-p])
major=`Major ide7 89` || continue
unit=`suffix $arg hd`
base=`index op $unit`
base=`math $base \* 64`
makedev hd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
makedev hd$unit$part b $major $(( $base + $part )) $disk
done
;;
hd[q-r])
major=`Major ide8 90` || continue
unit=`suffix $arg hd`
base=`index qr $unit`
base=`math $base \* 64`
makedev hd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
makedev hd$unit$part b $major $(( $base + $part )) $disk
done
;;
hd[s-t])
major=`Major ide9 91` || continue
unit=`suffix $arg hd`
base=`index st $unit`
base=`math $base \* 64`
makedev hd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
makedev hd$unit$part b $major $(( $base + $part )) $disk
done
;;
ub|uba)
major=180
makedev uba b $major 0 $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
makedev uba$part b $major $part $disk
done
;;
ht0)
major=`Major ht0 37` || continue
# Only one IDE tape drive is currently supported; ht0.
makedev ht0 c $major 0 $tape
makedev nht0 c $major 128 $tape
;;
pt)
major=`Major pt 96` || continue
for i in 0 1 2 3
do
makedev pt$i c $major $i $tape
makedev npt$i c $major `math $i + 128` $tape
done
;;
xd[a-d])
major=`Major xd 13` || continue
unit=`suffix $arg xd`
base=`index abcd $unit`
base=`math $base \* 64`
makedev xd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 # 9 10 11 12 13 14 15 16 17 18 19 20
do
makedev xd$unit$part b $major $(( $base + $part )) $disk
done
;;
sd[a-z])
major=`Major sd 8` || continue
unit=`suffix $arg sd`
base=`index abcdefghijklmnopqrstuvwxyz $unit`
base=$(( $base * 16 ))
if [ $base -lt 256 ]; then
major=8
else
major=65
base=$(( $base - 256 ))
fi
makedev sd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
minor=$(( $base + $part ))
makedev sd$unit$part b $major $minor $disk
done
;;
sd[a-d][a-z])
unit=`suffix $arg sd`
unitmaj=`first $unit`
unitmin=`second $unit`
basemaj=`index Xabcd $unitmaj`
basemin=`index abcdefghijklmnopqrstuvwxyz $unitmin`
basemaj=`math $basemaj \* 416`
basemin=`math $basemin \* 16`
base=`math $basemaj + $basemin`
basemaj=`math $base / 256`
base=`math $base % 256`
major=`math basemaj \+ 64`
if [ $major -gt 71 ]; then
echo "$0: don't know how to make device \"$arg\"" >&2
exit 0
fi
makedev sd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
minor=$(( $base + $part ))
makedev sd$unit$part b $major $minor $disk
done
;;
i2o.hd[a-z])
[ -d i2o ] || {
mkdir i2o
chown root:root i2o
chmod 755 i2o
[ -e i2o/ctl ] || makedev i2o/ctl c 10 166 $disk
}
unit=`suffix $arg i2o.hd`
base=`index abcdefghijklmnopqrstuvwxyz $unit`
base=$(( $base * 16 ))
if [ $base -lt 256 ]; then
major=80
else
major=81
base=$(( $base - 256 ))
fi
makedev i2o/hd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
minor=$(( $base + $part ))
makedev i2o/hd$unit$part b $major $minor $disk
done
;;
i2o.hd[a-d][a-z])
[ -d i2o ] || {
mkdir i2o
chown root:root i2o
chmod 755 i2o
[ -e i2o/ctl ] || makedev i2o/ctl c 10 166 $disk
}
unit=`suffix $arg i2o.hd`
unitmaj=`first $unit`
unitmin=`second $unit`
basemaj=`index Xabcd $unitmaj`
basemin=`index abcdefghijklmnopqrstuvwxyz $unitmin`
basemaj=`math $basemaj \* 416`
basemin=`math $basemin \* 16`
base=`math $basemaj + $basemin`
basemaj=`math $base / 256`
base=`math $base % 256`
major=`math basemaj \+ 80`
if [ $major -gt 87 ]; then
echo "$0: don't know how to make device \"$arg\"" >&2
exit 0
fi
makedev i2o/hd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
minor=$(( $base + $part ))
makedev i2o/hd$unit$part b $major $minor $disk
done
;;
dasd[a-z])
major=`Major dasd 94` || continue
unit=`suffix $arg dasd`
base=`index abcdefghijklmnopqrstuvwxyz $unit`
base=$(( $base * 4 ))
if [ $base -lt 256 ]; then
major=94
else
major=65
base=$(( $base - 256 ))
fi
makedev dasd$unit b $major $base $disk
for part in 1 2 3
do
minor=$(( $base + $part ))
makedev dasd$unit$part b $major $minor $disk
done
;;
ad[a-p])
major=`Major ad 28` || continue
unit=`suffix $arg ad`
base=`index abcdefghijklmnop $unit`
base=`math $base \* 16`
makedev ad$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
minor=$(( $base + $part ))
makedev ad$unit$part b $major $minor $disk
done
;;
dac960)
for ctr in 0 1 2 3 4 5 6 7
do
$0 $opts dac960.$ctr
done
makedev dac960_gam c 10 252 $disk
;;
dac960.[0-7])
[ -d rd ] || {
mkdir rd
chown root:root rd
chmod 755 rd
}
unit=`suffix $arg dac960.`
major=`math 48 + $unit`
minor=0
for ld in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
do
makedev rd/c${unit}d${ld} b $major $minor $disk
minor=`math $minor + 1`
for part in 1 2 3 4 5 6 7
do
makedev rd/c${unit}d${ld}p$part b $major $minor $disk
minor=`math $minor + 1`
done
done
;;
dpti)
major=151
for ld in 1 2 3 4 5 6 7
do
minor=`math $ld -1`
makedev dpti${ld} c $major $minor $disk
done
;;
ataraid)
for ctr in 0 1 2 # 3 4 5 6 7
do
$0 $opts ataraid.$ctr
done
;;
ataraid.[0-7])
[ -d ataraid ] || {
mkdir ataraid
chown root:root ataraid
chmod 755 ataraid
}
unit=`suffix $arg ataraid.`
major=114
minor=`math $unit \* 16`
makedev ataraid/d${unit} b $major $minor $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
minor=`math $minor + 1`
makedev ataraid/d${unit}p$part b $major $minor $disk
done
;;
ida)
for ctr in 0 1 2 # 3 4 5 6 7
do
$0 $opts ida.$ctr
done
;;
ida.[0-7])
[ -d ida ] || {
mkdir ida
chown root:root ida
chmod 755 ida
}
unit=`suffix $arg ida.`
major=`math 72 + $unit`
minor=0
for ld in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
makedev ida/c${unit}d${ld} b $major $minor $disk
minor=`math $minor + 1`
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
makedev ida/c${unit}d${ld}p$part b $major $minor $disk
minor=`math $minor + 1`
done
done
;;
cciss)
for ctr in 0 1 2 # 3 4 5 6 7
do
$0 $opts cciss.$ctr
done
;;
cciss.[0-7])
[ -d cciss ] || {
mkdir cciss
chown root:root cciss
chmod 755 cciss
}
unit=`suffix $arg cciss.`
major=`math 104 + $unit`
minor=0
for ld in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
makedev cciss/c${unit}d${ld} b $major $minor $disk
minor=`math $minor + 1`
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
makedev cciss/c${unit}d${ld}p$part b $major $minor $disk
minor=`math $minor + 1`
done
done
;;
rom)
major=`Major rom 31`
for i in 0 1 2 3 4 5 6 7
do
makedev rom$i b $major $i $disk
makedev rrom$i b $major `math $i +8` $disk
makedev flash$i b $major `math $i +16` $disk
makedev rflash$i b $major `math $i +24` $disk
done
;;
nb[0-7])
major=`Major nbd 43` || continue
minor=`suffix $arg nb`
makedev nb$minor b $major $minor $disk
;;
loop)
for part in 0 1 2 3 4 5 6 7
do
makedev loop$part b 7 $part $disk
done
;;
loop[0-9]|loop[1-9][0-9]|loop1[0-9][0-9]|loop2[0-4][0-9]|loop25[0-5])
minor=`suffix $arg loop`
makedev loop$minor b 7 $minor $disk
;;
md)
major=`Major md 9` || continue
for part in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
makedev md$part b $major $part $disk
done
;;
st[0-7])
major=`Major st 9`
unit=`suffix $arg st`
makedev st${unit} c $major $unit $tape
makedev nst${unit} c $major `math 128 + $unit` $tape
makedev st${unit}l c $major `math 32 + $unit` $tape
makedev nst${unit}l c $major `math 160 + $unit` $tape
makedev st${unit}m c $major `math 64 + $unit` $tape
makedev nst${unit}m c $major `math 192 + $unit` $tape
makedev st${unit}a c $major `math 96 + $unit` $tape
makedev nst${unit}a c $major `math 224 + $unit` $tape
;;
qic)
major=`Major tpqic02 12`
makedev ntpqic11 c $major 2 $tape
makedev tpqic11 c $major 3 $tape
makedev ntpqic24 c $major 4 $tape
makedev tpqic24 c $major 5 $tape
makedev ntpqic120 c $major 6 $tape
makedev tpqic120 c $major 7 $tape
makedev ntpqic150 c $major 8 $tape
makedev tpqic150 c $major 9 $tape
makedev rmt8 c $major 6 $tape
makedev rmt16 c $major 8 $tape
makedev tape-d c $major 136 $tape
makedev tape-reset c $major 255 $tape
$0 $opts qft
;;
ftape)
major=`Major qft 27` || continue
for unit in 0 1 2 3
do
makedev qft$unit c $major $unit $tape
makedev nqft$unit c $major `math $unit + 4` $tape
makedev zqft$unit c $major `math $unit + 16` $tape
makedev nzqft$unit c $major `math $unit + 20` $tape
makedev rawqft$unit c $major `math $unit + 32` $tape
makedev nrawqft$unit c $major `math $unit + 36` $tape
done
symlink ftape qft0
symlink nftape nqft0
;;
sr|scd|scd-all)
major=`Major sr 11` || continue
for unit in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
do
makedev scd$unit b $major $unit $cdrom
symlink sr$unit scd$unit
done
;;
pktcdvd)
major=97
for unit in 0 1 2 3
do
makedev pktcdvd$unit b $major $unit $cdrom
done
;;
cfs0)
makedev cfs0 c 67 0 $coda
;;
scd[0-9]|scd[0-1][0-9])
major=`Major sr 11` || continue
unit=`suffix $arg scd`
makedev scd$unit b $major $unit $cdrom
symlink sr$unit scd$unit
;;
ttyI[0-9]|ttyI[1-5][0-9]|ttyI[6][0-3])
major=43
unit=`suffix $arg ttyI`
makedev ttyI$unit c $major $unit $dialout
;;
ppp)
major=108
makedev ppp c $major 0 $dip
;;
ippp[0-9]|ippp[1-5][0-9]|ippp[6][0-3])
major=45
unit=`suffix $arg ippp`
minor=`math $unit + 128`
makedev ippp$unit c $major $minor $dialout
;;
isdn[0-9]|isdn[1-5][0-9]|isdn[6][0-3])
major=45
unit=`suffix $arg isdn`
minor=`math $unit + 0`
makedev isdn$unit c $major $minor $dialout
;;
isdnctrl[0-9]|isdnctrl[1-5][0-9]|isdnctrl[6][0-3])
major=45
unit=`suffix $arg isdnctrl`
minor=`math $unit + 64`
makedev isdnctrl$unit c $major $minor $dialout
;;
isdninfo)
makedev isdninfo c 45 255 $private
;;
isdn-tty)
major=43
for unit in 0 1 2 3 4 5 6 7
do
makedev ttyI$unit c $major $unit $dialout
done
;;
isdn-ippp)
major=45
for unit in 0 1 2 3 4 5 6 7
do
makedev ippp$unit c $major `math $unit + 128` $dialout
done
;;
isdn-io)
for unit in 0 1 2 3 4 5 6 7
do
makedev isdn$unit c 45 $unit $dialout
makedev isdnctrl$unit c 45 `math $unit + 64` $dialout
makedev ippp$unit c 45 `math $unit + 128` $dialout
done
makedev isdninfo c 45 255 $dialout
;;
sonycd)
major=`Major sonycd 15` || continue
makedev $arg b $major 0 $cdrom
;;
mcd)
major=`Major mcd 23` || continue
makedev $arg b $major 0 $cdrom
;;
mcdx|mcdx[0-4])
major=`Major $arg 20` || continue
for unit in 0 1 2 3 4
do
makedev mcdx$unit b $major $unit $cdrom
done
test -r mcdx || symlink mcdx mcdx0
;;
cdu535)
makedev $arg b 24 0 $cdrom
;;
lmscd)
makedev $arg b 24 0 $cdrom
;;
sbpcd|sbpcd[123])
major=`Major $arg 25` || continue
base=`suffix ${arg}0 sbpcd`
for minor in 0 1 2 3
do
# XXX
unit=$(substr 0123456789abcdef $(( $base * 4 + $minor + 1 )) )
makedev sbpcd$unit b $major $minor $cdrom
done
[ $arg = sbpcd ] && symlink $arg ${arg}0
;;
aztcd)
major=`Major $arg 29` || continue
makedev ${arg}0 b $major 0 $cdrom
;;
cm206cd)
major=`Major $arg 30` || continue
makedev ${arg}0 b $major 0 $cdrom
;;
gscd)
major=`Major $arg 16` || continue
makedev ${arg}0 b $major 0 $cdrom
;;
pcd)
for unit in 0 1 2 3
do
makedev pcd$unit b 46 $unit $cdrom
done
;;
bpcd)
makedev $arg b 41 0 $cdrom
;;
optcd)
makedev $arg b 17 0 $cdrom
;;
sjcd)
makedev $arg b 18 0 $cdrom
;;
cfs|coda)
makedev cfs0 c 67 0 $private
;;
xfs|nnpfs|arla)
makedev xfs0 c 103 0 $private
makedev nnpfs0 c 103 0 $private
;;
logiscan)
major=`Major logiscan` || continue
makedev $arg c $major 0 $scanner
;;
toshiba)
major=`Major $arg 10` || continue
makedev $arg c $major 181 root root 0666
;;
m105scan)
major=`Major m105` || continue
makedev $arg c $major 0 $scanner
;;
ac4096)
major=`Major ac4096` || continue
makedev $arg c $major 0 $scanner
;;
audio)
major=`Major sound 14`
makedev mixer c $major 0 $audio
makedev mixer1 c $major 16 $audio
makedev mixer2 c $major 32 $audio
makedev mixer3 c $major 48 $audio
makedev sequencer c $major 1 $audio
makedev midi00 c $major 2 $audio
makedev midi01 c $major 18 $audio
makedev midi02 c $major 34 $audio
makedev midi03 c $major 50 $audio
makedev dsp c $major 3 $audio
makedev dsp1 c $major 19 $audio
makedev dsp2 c $major 35 $audio
makedev dsp3 c $major 51 $audio
makedev audio c $major 4 $audio
makedev audio1 c $major 20 $audio
makedev audio2 c $major 36 $audio
makedev audio3 c $major 52 $audio
makedev sndstat c $major 6 $audio
makedev audioctl c $major 7 $audio
major=31
makedev mpu401data c $major 0 $audio
makedev mpu401stat c $major 1 $audio
major=35
for i in 0 1 2 3
do
makedev midi$i c $major $i $audio
makedev rmidi$i c $major `math $i + 64` $audio
makedev smpte$i c $major `math $i + 128` $audio
done
;;
pcaudio)
major=`Major pcsp 13` || continue
makedev pcmixer c $major 0 $audio
makedev pcsp c $major 3 $audio
makedev pcaudio c $major 4 $audio
;;
video|video4linux|v4l|radio)
# video4linux api includes radio, teletext, etc.
major=`Major video 81` || continue
minor=0
until [ $minor -gt 63 ]
do
makedev video$minor c $major $minor $video
makedev radio$minor c $major `math $minor + 64` $video
minor=`math $minor + 1`
done
symlink radio radio0
minor=0
until [ $minor -gt 31 ]
do
makedev vtx$minor c $major `math $minor + 192` $video
makedev vbi$minor c $major `math $minor + 224` $video
minor=`math $minor + 1`
done
symlink video video0
symlink vbi vbi0
major=82
minor=0
until [ $minor -gt 1 ]
do
makedev winradio$minor c $major $minor $video
minor=`math $minor + 1`
done
major=83
makedev vtx c $major 0 $video
makedev vttuner c $major 16 $video
;;
i2c)
# making it possible to create an arbitrary number of i2c
# devices might be good, but 8 should suffice for now
major=`Major i2c 89` || continue
minor=0
until [ $minor -gt 7 ]
do
makedev i2c-$minor c $major $minor $private
minor=`math $minor + 1`
done
;;
tlk)
major=102
minor=0
until [ $minor -gt 3 ] # tell me if 3 is wrong...
do
makedev tlk$minor c $major $minor $video
minor=`math $minor + 1`
done
;;
srnd)
makedev srnd0 c 110 0 $video
makedev srnd1 c 110 1 $video
;;
fgrab)
makedev mmetfgrab c 40 0 $video
makedev wvisfgrab c 26 0 $video
for i in 0 1 # more?
do
makedev iscc$i c 93 $i $video
makedev isccctl$i c 93 `math $i + 128` $video
done
for i in 0 1 # more?
do
makedev dcxx$i c 94 $i $video
done
;;
sg|sg-all)
major=`Major sg 21`
for unit in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
do
makedev sg$unit c $major $unit $scsi
done
;;
pg)
major=`Major pg 97`
for unit in 0 1 2 3
do
makedev pg$unit c $major $unit $scsi
done
;;
fd)
# not really devices, we use the /proc filesystem
symlink fd $procfs/self/fd
symlink stdin fd/0
symlink stdout fd/1
symlink stderr fd/2
;;
ibcs2)
major=`Major ibcs2 30` || continue
makedev socksys c $major 0 $ibcs2
symlink nfsd socksys
makedev spx c $major 1 $ibcs2
symlink X0R null
;;
netlink)
major=36
makedev route c $major 0 $private
makedev skip c $major 1 $private
;;
enskip)
major=64
makedev enskip c $major 0 $private
;;
ipfilt*)
major=95
makedev ipl c $major 0 $private
makedev ipnat c $major 1 $private
makedev ipstate c $major 2 $private
makedev ipauth c $major 3 $private
;;
qng)
makedev qng c 77 0 $private
;;
apm)
major=`Major mouse 10` || continue
makedev apm_bios c $major 134 $mouse
;;
dcf)
major=`Major dcf` || continue
makedev $arg c $major 0 $system
;;
helloworld)
major=`Major hw` || continue
makedev helloworld c $major 0 $public
;;
ipsec)
# For the Free S/WAN (http://www.xs4all.nl/~freeswan/)
# implementation of IPSEC
makedev ipsec c 36 10 $ipsec
;;
comedi)
major=98
for minor in 0 1 2 3
do
makedev comedi$minor c $major $minor $public
done
;;
tilp)
for i in `seq 0 7`
do
makedev tipar$i c 115 $i $printer
makedev tiser$i c 115 `math 8 + $i` $dialout
done
for i in `seq 0 31`
do
makedev tiusb$i c 115 `math 16 + $i` $dialout
done
;;
dvb)
# check if kernel-version is >= 2.6.8, if yes, create dvb-devices with
# major-number 212, in the other case 250
kern_rev1=`uname -r | sed -e 's@^\([^.]*\)\..*@\1@'`
kern_rev2=`uname -r | sed -e 's@^[^.]*\.\([^.]*\)\..*@\1@'`
kern_rev3=`uname -r | sed -e 's@^[^.]*\.[^.]*\.\([^.][0-9]*\).*@\1@'`
dvb_major=250
if [ $kern_rev1 -gt 2 ] || ([ $kern_rev1 -eq 2 ] && [ $kern_rev2 -gt 6 ]) \
|| ([ $kern_rev1 -eq 2 ] && [ $kern_rev2 -eq 6 ] && [ $kern_rev3 -ge 8 ])
then
dvb_major=212
fi
mkdir -p dvb
for i in 0 1 2 3
do
mkdir -p dvb/adapter$i
makedev dvb/adapter$i/video0 c $dvb_major `math 64 \* $i + 0` $video
makedev dvb/adapter$i/audio0 c $dvb_major `math 64 \* $i + 1` $video
makedev dvb/adapter$i/frontend0 c $dvb_major `math 64 \* $i + 3` $video
makedev dvb/adapter$i/demux0 c $dvb_major `math 64 \* $i + 4` $video
makedev dvb/adapter$i/dvr0 c $dvb_major `math 64 \* $i + 5` $video
makedev dvb/adapter$i/ca0 c $dvb_major `math 64 \* $i + 6` $video
makedev dvb/adapter$i/net0 c $dvb_major `math 64 \* $i + 7` $video
makedev dvb/adapter$i/osd0 c $dvb_major `math 64 \* $i + 8` $video
done
;;
usb)
mkdir -p usb
major=180
for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
makedev usb/lp$i c $major $i $printer
makedev usb/mouse$i c $major `math $i + 16` $mouse
makedev usb/ez$i c $major `math $i + 32` $system
makedev usb/scanner$i c $major `math $i + 48` $scanner
makedev usb/hiddev$i c $major `math $i + 96` $system
makedev ttyACM$i c 166 $i $dialout
makedev ttyUSB$i c 188 $i $dialout
done
makedev usb/rio500 c $major 64 $audio
makedev usb/usblcd c $major 65 $audio
makedev usb/cpad0 c $major 66 $audio
;;
bluetooth)
major=216
for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 \
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
do
makedev rfcomm$i c $major $i $dialout
done
makedev vhci c 10 250 $dialout
for i in 0 1 2 3; do
makedev ttyUB$i c 216 $i $dialout
makedev ccub$i c 217 $i $dialout
done
;;
paride)
major=45
for unit in a b c d
do
base=`index abcd $unit`
base=`math $base \* 16`
makedev pd$unit b $major $base $disk
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
makedev pd$unit$part b $major $(( $base + $part )) $disk
done
done
for i in 0 1 2 3
do
makedev pcd$i b 46 $i $cdrom
makedev pf$i b 47 $i $floppy
done
;;
update)
devices=
if [ ! -f $procfs/devices ]
then
echo "$0: warning: can't read $procfs/devices" >&2
else
exec 3<$procfs/devices
while read major device extra <&3
do
device=`echo $device | sed 's#/.*##'`
case "$major" in
Character|Block|'')
;;
*)
eval "major_$device=$major"
devices="$devices $device"
;;
esac
done
exec 3<&-
fi
if [ ! "$devices" ]
then
echo "$0: don't appear to have any devices" >&2
continue
fi
if [ "$opt_d" ]
then
echo "$0: can't delete an update" >&2
continue
fi
create=
delete=
devs="$devices"
if [ -f DEVICES ]
then
exec 3<DEVICES
while read device major <&3
do
eval now=\$major_$device
if [ "$now" = "" ]
then
delete="$delete `cvt $device`"
continue
elif [ "$now" != $major ]
then
create="$create "`cvt $device`
fi
devs=`strip " $devs " $device`
done
exec 3<&-
fi
create="$create "`cvt $devs`
[ "$delete" != "" ] && $0 $opts -d $delete
[ "$create" != " " ] && $0 $opts $create
[ "$opt_n" ] && continue
for device in $devices
do
if [ "`cvt $device`" ]
then
eval echo $device \$major_$device
fi
done > DEVICES
;;
*)
echo "$0: don't know how to make device \"$arg\"" >&2
exit 1
;;
esac
done
exit 0
|