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 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 99.2beta8 (1.46)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>42. The LINUX Kernel Source, Modules, and Hardware Support</TITLE>
<META NAME="description" CONTENT="42. The LINUX Kernel Source, Modules, and Hardware Support">
<META NAME="keywords" CONTENT="rute">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v99.2beta8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="rute.css">
<LINK REL="next" HREF="node46.html">
<LINK REL="previous" HREF="node44.html">
<LINK REL="up" HREF="rute.html">
<LINK REL="next" HREF="node46.html">
</HEAD>
<BODY BGCOLOR=#FFFFFF >
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
<TR><TD align=left bgcolor="#000000">
<FONT COLOR=white>
<A HREF="http://www.icon.co.za/~psheer/rute-purchase.html"><FONT COLOR=white>Purchase</FONT></A>
</FONT>
</TD><TD align=center bgcolor="#000000">
<FONT COLOR=white>
Copyright © 2002 Paul Sheer. <A HREF="copying.html"><FONT COLOR=white>Click here for copying permissions.</FONT></A>
</FONT>
</TD><TD align=right bgcolor="#000000">
<FONT COLOR=white>
<A HREF="http://www.icon.co.za/~psheer/rute-home.html"><FONT COLOR=white>Home</FONT></A>
</FONT>
</TD></TR>
<TR><TD colspan=2 align=left bgcolor="#ECEBF4">
<IMG SRC="va-btn-small-light-60.png">
</TD><TD align=right bgcolor="#ECEBF4">
<IMG SRC="sflogo2-steel-60.png">
</TD></TR>
</TABLE><BR>
<!--Navigation Panel-->
<A NAME="tex2html2824"
HREF="node46.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
<A NAME="tex2html2820"
HREF="rute.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
<A NAME="tex2html2814"
HREF="node44.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
<A NAME="tex2html2822"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html2825"
HREF="node46.html">43. The X Window</A>
<B> Up:</B> <A NAME="tex2html2821"
HREF="rute.html">rute</A>
<B> Previous:</B> <A NAME="tex2html2815"
HREF="node44.html">41. Point-to-Point Protocol </A>
  <B> <A NAME="tex2html2823"
HREF="node1.html">Contents</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
<UL>
<LI><A NAME="tex2html2826"
HREF="#SECTION004510000000000000000">42.1 Kernel Constitution</A>
<LI><A NAME="tex2html2827"
HREF="#SECTION004520000000000000000">42.2 Kernel Version Numbers</A>
<LI><A NAME="tex2html2828"
HREF="#SECTION004530000000000000000">42.3 Modules, <TT>
<FONT COLOR="#0000ff">insmod</FONT></TT> Command, and Siblings</A>
<LI><A NAME="tex2html2829"
HREF="#SECTION004540000000000000000">42.4 Interrupts, I/O Ports, and DMA Channels</A>
<LI><A NAME="tex2html2830"
HREF="#SECTION004550000000000000000">42.5 Module Options and Device Configuration</A>
<UL>
<LI><A NAME="tex2html2831"
HREF="#SECTION004551000000000000000">42.5.1 Five ways to pass options to a module</A>
<LI><A NAME="tex2html2832"
HREF="#SECTION004552000000000000000">42.5.2 Module documentation sources</A>
</UL>
<LI><A NAME="tex2html2833"
HREF="#SECTION004560000000000000000">42.6 Configuring Various Devices</A>
<UL>
<LI><A NAME="tex2html2834"
HREF="#SECTION004561000000000000000">42.6.1 Sound and <TT>
<FONT COLOR="#0000ff">pnpdump</FONT></TT></A>
<LI><A NAME="tex2html2835"
HREF="#SECTION004562000000000000000">42.6.2 Parallel port</A>
<LI><A NAME="tex2html2836"
HREF="#SECTION004563000000000000000">42.6.3 NIC -- Ethernet, PCI, and old ISA</A>
<LI><A NAME="tex2html2837"
HREF="#SECTION004564000000000000000">42.6.4 PCI vendor ID and device ID</A>
<LI><A NAME="tex2html2838"
HREF="#SECTION004565000000000000000">42.6.5 PCI and sound</A>
<LI><A NAME="tex2html2839"
HREF="#SECTION004566000000000000000">42.6.6 Commercial sound drivers</A>
<LI><A NAME="tex2html2840"
HREF="#SECTION004567000000000000000">42.6.7 The ALSA sound project</A>
<LI><A NAME="tex2html2841"
HREF="#SECTION004568000000000000000">42.6.8 Multiple Ethernet cards</A>
<LI><A NAME="tex2html2842"
HREF="#SECTION004569000000000000000">42.6.9 SCSI disks</A>
<LI><A NAME="tex2html2843"
HREF="#SECTION0045610000000000000000">42.6.10 SCSI termination and cooling</A>
<LI><A NAME="tex2html2844"
HREF="#SECTION0045611000000000000000">42.6.11 CD writers</A>
<LI><A NAME="tex2html2845"
HREF="#SECTION0045612000000000000000">42.6.12 Serial devices</A>
</UL>
<LI><A NAME="tex2html2846"
HREF="#SECTION004570000000000000000">42.7 Modem Cards</A>
<LI><A NAME="tex2html2847"
HREF="#SECTION004580000000000000000">42.8 More on <TT>
<FONT COLOR="#0000ff">LILO:</FONT></TT> Options</A>
<LI><A NAME="tex2html2848"
HREF="#SECTION004590000000000000000">42.9 Building the Kernel</A>
<UL>
<LI><A NAME="tex2html2849"
HREF="#SECTION004591000000000000000">42.9.1 Unpacking and patching</A>
<LI><A NAME="tex2html2850"
HREF="#SECTION004592000000000000000">42.9.2 Configuring</A>
</UL>
<LI><A NAME="tex2html2851"
HREF="#SECTION0045100000000000000000">42.10 Using Packaged Kernel Source</A>
<LI><A NAME="tex2html2852"
HREF="#SECTION0045110000000000000000">42.11 Building, Installing</A>
</UL>
<!--End of Table of Child-Links-->
<HR>
<H1><A NAME="SECTION004500000000000000000">
42. The L<SMALL>INUX</SMALL> Kernel Source, Modules, and Hardware Support</A>
</H1>
<P>
<A NAME="chap:kernelsource"></A><A NAME="chap:modules"></A>
<P>
This chapter explains how to configure, patch, and build
a kernel from source. The
configuration of device drivers and modules
is also discussed in detail.
<P>
<H1><A NAME="SECTION004510000000000000000">
42.1 Kernel Constitution</A>
</H1>
<P>
A kernel installation consists
of the kernel boot image, the kernel
modules, the
<TT>
<FONT COLOR="#0000ff">System.map</FONT></TT> file, the kernel headers (needed
only for development), and various support daemons (already
provided by your distribution). These constitute everything that is
called ``Linux'' under L<SMALL>INUX</SMALL>, and are built from about 50 megabytes
of <B>C</B> code of around 1.5 million lines.
<P>
<UL>
<LI>The L<SMALL>INUX</SMALL> kernel image is a 400 to 600-KB file that sits in
<TT>
<FONT COLOR="#0000ff">/boot/</FONT></TT> (see Chapter <A HREF="node34.html#chap:lilo">31</A>). If you look in this
directory, you might see several kernels. The choice of which to boot
is probably available to you at boot time, through <TT>
<FONT COLOR="#0000ff">lilo</FONT></TT>.
<P>
The kernel in <TT>
<FONT COLOR="#0000ff">/boot/</FONT></TT> is compressed. That is, it
is <TT>
<FONT COLOR="#0000ff">gzip</FONT></TT> compressed and is actually about twice the size
when unpacked into memory on boot.
<P>
</LI>
<LI>The kernel also has detached parts called <I>modules</I>.
These all sit in <TT>
<FONT COLOR="#0000ff">/lib/modules/<version>/</FONT></TT>.
They are categorized into the
subdirectories below this directory. In kernel <TT>
<FONT COLOR="#0000ff">2.2</FONT></TT> there were about 400,
modules totaling about 9 megabytes.
<P>
Modules are actually just shared object files, like the
<TT>
<FONT COLOR="#0000ff">.o</FONT></TT> files we created in Section <A HREF="node26.html#sec:sharedobj">23.1</A>. They
are not quite the same as Windows device
drivers, in that it is not generally
possibly to use a module on a kernel other than the one it was compiled
for--hence the name ``module'' is used instead of ``driver.'' Modules are
separated out of the kernel image purely to save RAM. Modules are
sometimes <I>compiled into</I> the kernel in the same way that our
<TT>
<FONT COLOR="#0000ff">test</FONT></TT> program was statically linked on page <A HREF="node25.html#page:staticlinking"><IMG ALIGN="BOTTOM" BORDER="1" ALT="[*]" SRC="crossref.png"></A>.
In this case, they would be absent from <TT>
<FONT COLOR="#0000ff">/lib/modules/<version>/</FONT></TT> and
should not really be called modules. In this chapter I show how to create
compiled-in
or compiled-out
versions of modules when rebuilding the kernel.
<P>
</LI>
<LI>Next is the <TT>
<FONT COLOR="#0000ff">System.map</FONT></TT> file, also in <TT>
<FONT COLOR="#0000ff">/boot</FONT></TT>.
It is used by <TT>
<FONT COLOR="#0000ff">klogd</FONT></TT> to resolve kernel address references
to symbols, so as to write logs about them, and then also by
<TT>
<FONT COLOR="#0000ff">depmod</FONT></TT> to work out <I>module dependencies</I> (what
modules need what other modules to be loaded first).
<P>
</LI>
<LI>Finally, the kernel headers <TT>
<FONT COLOR="#0000ff">/usr/src/linux/include</FONT></TT>
are used when certain packages are built.
<P>
</LI>
<LI>The ``various support daemons'' should be running
already. Since <TT>
<FONT COLOR="#0000ff">2.2</FONT></TT>, these have been reduced to <TT>
<FONT COLOR="#0000ff">klogd</FONT></TT>
only. The other kernel daemons that appear to be running are
generated by the kernel itself.
</LI>
</UL>
<P>
<H1><A NAME="SECTION004520000000000000000">
42.2 Kernel Version Numbers</A>
</H1>
<P>
The kernel is versioned like other packages:
<TT>
<FONT COLOR="#0000ff">linux-</FONT></TT><I>major</I><TT>
<FONT COLOR="#0000ff">.</FONT></TT><I>minor</I><TT>
<FONT COLOR="#0000ff">.</FONT></TT><I>patch</I>.
Development kernels are given odd minor version numbers; stable
kernels are given even minor version numbers. At the time of writing, the
stable kernel was <TT>
<FONT COLOR="#0000ff">2.2.17</FONT></TT>,
and <TT>
<FONT COLOR="#0000ff">2.4.0</FONT></TT> was soon to be released.
By the time you read this, <TT>
<FONT COLOR="#0000ff">2.4.0</FONT></TT>
will be available. This chapter should
be entirely applicable to future stable releases of <TT>
<FONT COLOR="#0000ff">2.4</FONT></TT>.
<P>
<H1><A NAME="SECTION004530000000000000000">
42.3 Modules, <TT>
<FONT COLOR="#0000ff">insmod</FONT></TT> Command, and Siblings</A>
</H1>
<P>
A module is usually a device driver pertaining to some device node
generated with the <TT>
<FONT COLOR="#0000ff">mknod</FONT></TT> command or already existing in the
<TT>
<FONT COLOR="#0000ff">/dev/</FONT></TT> directory. For instance, the SCSI driver automatically locks onto
device major = <TT>
<FONT COLOR="#0000ff">8</FONT></TT>, minor = <TT>
<FONT COLOR="#0000ff">0</FONT></TT>, <TT>
<FONT COLOR="#0000ff">1</FONT></TT>,..., when it loads;
and the Sound module onto device major = <TT>
<FONT COLOR="#0000ff">14</FONT></TT>, minor = <TT>
<FONT COLOR="#0000ff">3</FONT></TT>
(<TT>
<FONT COLOR="#0000ff">/dev/dsp</FONT></TT>), and others. The modules people most often play with are
SCSI, Ethernet, and Sound modules. There
are also many modules that support extra features instead of hardware.
<P>
Modules are loaded with the <TT>
<FONT COLOR="#0000ff">insmod</FONT></TT> command, and removed with the
<TT>
<FONT COLOR="#0000ff">rmmod</FONT></TT> command. This is somewhat like the operation of linking
shown in the <TT>
<FONT COLOR="#0000ff">Makefile</FONT></TT> on page <A HREF="node26.html#page:sharemakefile"><IMG ALIGN="BOTTOM" BORDER="1" ALT="[*]" SRC="crossref.png"></A>. To list
currently loaded modules, use <TT>
<FONT COLOR="#0000ff">lsmod</FONT></TT>. Try (kernel <TT>
<FONT COLOR="#0000ff">2.4</FONT></TT> paths are
different and are given in braces)
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>insmod /lib/modules/<version>/fs/fat.o</code><br>
<code>( insmod /lib/modules/<version>/kernel/fs/fat/fat.o )</code><br>
<code>lsmod</code><br>
<code>rmmod fat</code><br>
<code>lsmod</code><br>
</FONT></TD></TR></TABLE><P>
<TT>
<FONT COLOR="#0000ff">rmmod -a</FONT></TT> further removes all unused modules.
<P>
Modules sometimes need other modules to be present in order to
load. If you try to load a module and it gives <TT>
<FONT COLOR="#0000ff"><module-name>:
unresolved symbol <symbol-name></FONT></TT> error messages, then it requires
something else to be loaded first. The <TT>
<FONT COLOR="#0000ff">modprobe</FONT></TT> command loads
a module along with other modules that it depends on. Try
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>insmod /lib/modules/2.2.12-20/fs/vfat.o</code><br>
<code>( insmod /lib/modules/<version>/kernel/fs/vfat/vfat.o )</code><br>
<code>modprobe vfat</code><br>
</FONT></TD></TR></TABLE><P>
<TT>
<FONT COLOR="#0000ff">modprobe</FONT></TT>, however, requires a table of <I>module dependencies</I>.
This table is the
file <TT>
<FONT COLOR="#0000ff">/lib/modules/<version>/modules.dep</FONT></TT> and is
generated automatically by your startup scripts with the command
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>/sbin/depmod -a</code><br>
</FONT></TD></TR></TABLE><P>
although you can run it manually at any time. The <TT>
<FONT COLOR="#0000ff">lsmod</FONT></TT>
listing also shows module dependencies in brackets.
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>10</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>15</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>Module Size Used by</code><br>
<code>de4x5 41396 1 (autoclean)</code><br>
<code>parport_probe 3204 0 (autoclean)</code><br>
<code>parport_pc 5832 1 (autoclean)</code><br>
<code>lp 4648 0 (autoclean)</code><br>
<code>parport 7320 1 (autoclean) [parport_probe parport_pc lp]</code><br>
<code>slip 7932 2 (autoclean)</code><br>
<code>slhc 4504 1 (autoclean) [slip]</code><br>
<code>sb 33812 0 </code><br>
<code>uart401 6224 0 [sb]</code><br>
<code>sound 57464 0 [sb uart401]</code><br>
<code>soundlow 420 0 [sound]</code><br>
<code>soundcore 2596 6 [sb sound]</code><br>
<code>loop 7872 2 (autoclean)</code><br>
<code>nls_iso8859-1 2272 1 (autoclean)</code><br>
<code>nls_cp437 3748 1 (autoclean)</code><br>
<code>vfat 9372 1 (autoclean)</code><br>
<code>fat 30656 1 (autoclean) [vfat]</code><br>
</FONT></TD></TR></TABLE><P>
<P>
<H1><A NAME="SECTION004540000000000000000">
42.4 Interrupts, I/O Ports, and DMA Channels</A>
</H1>
<P>
<A NAME="sec:proc"></A>A loaded module that drives hardware will often consume I/O ports,
IRQs, and possibly a DMA channel, as explained in Chapter
<A HREF="node6.html#chap:pchardware">3</A>. You can get a full list of occupied
resources from the <TT>
<FONT COLOR="#0000ff">/proc/</FONT></TT> directory:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>10</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>15</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>20</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>25</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>30</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>35</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>40</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>45</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>50</code></font><code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>[root@cericon]# <font color="navy"><B>cat /proc/ioports</B></font></code><br>
<code> </code><br>
<code>0000-001f : dma1</code><br>
<code>0020-003f : pic1</code><br>
<code>0040-005f : timer</code><br>
<code>0060-006f : keyboard</code><br>
<code>0070-007f : rtc</code><br>
<code>0080-008f : dma page reg</code><br>
<code>00a0-00bf : pic2</code><br>
<code>00c0-00df : dma2</code><br>
<code>00f0-00ff : fpu</code><br>
<code>0170-0177 : ide1</code><br>
<code>01f0-01f7 : ide0</code><br>
<code>0220-022f : soundblaster</code><br>
<code>02f8-02ff : serial(auto)</code><br>
<code>0330-0333 : MPU-401 UART</code><br>
<code>0376-0376 : ide1</code><br>
<code>0378-037a : parport0</code><br>
<code>0388-038b : OPL3/OPL2</code><br>
<code>03c0-03df : vga+</code><br>
<code>03f0-03f5 : floppy</code><br>
<code>03f6-03f6 : ide0</code><br>
<code>03f7-03f7 : floppy DIR</code><br>
<code>03f8-03ff : serial(auto)</code><br>
<code>e400-e47f : DC21140 (eth0)</code><br>
<code>f000-f007 : ide0</code><br>
<code>f008-f00f : ide1</code><br>
<code> </code><br>
<code>[root@cericon]# <font color="navy"><B>cat /proc/interrupts</B></font></code><br>
<code> </code><br>
<code> CPU0 </code><br>
<code> 0: 8409034 XT-PIC timer</code><br>
<code> 1: 157231 XT-PIC keyboard</code><br>
<code> 2: 0 XT-PIC cascade</code><br>
<code> 3: 104347 XT-PIC serial</code><br>
<code> 5: 2 XT-PIC soundblaster</code><br>
<code> 6: 82 XT-PIC floppy</code><br>
<code> 7: 2 XT-PIC parport0</code><br>
<code> 8: 1 XT-PIC rtc</code><br>
<code> 11: 8 XT-PIC DC21140 (eth0)</code><br>
<code> 13: 1 XT-PIC fpu</code><br>
<code> 14: 237337 XT-PIC ide0</code><br>
<code> 15: 16919 XT-PIC ide1</code><br>
<code>NMI: 0</code><br>
<code> </code><br>
<code>[root@cericon]# <font color="navy"><B>cat /proc/dma</B></font></code><br>
<code> </code><br>
<code> 1: SoundBlaster8</code><br>
<code> 2: floppy</code><br>
<code> 4: cascade</code><br>
<code> 5: SoundBlaster16</code><br>
</FONT></TD></TR></TABLE><P>
<P>
The above configuration is typical. Note that the
second column of the IRQ listing shows the number of interrupts
signals received from the device. Moving my mouse a little
and listing the IRQs again gives me
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code> 3: 104851 XT-PIC serial</code><br>
</FONT></TD></TR></TABLE><P>
showing that several hundred interrupts were since
received. Another useful entry is <TT>
<FONT COLOR="#0000ff">/proc/devices</FONT></TT>, which
shows what major devices numbers were allocated and are being used.
This file is extremely useful for seeing what peripherals are
``alive'' on your system.
<P>
<H1><A NAME="SECTION004550000000000000000">
42.5 Module Options and Device Configuration</A>
</H1>
<P>
<A NAME="sec:modoptions"></A><A NAME="sec:moduleoptions"></A>
Device modules often need information about their hardware
configuration. For instance, ISA device drivers need to know the
IRQ and I/O port that the ISA card is physically configured to
access. This information is passed to the module as <I>module
options</I> that the module uses to initialize itself. Note that most
devices will <I>not</I> need options at all. PCI cards mostly
autodetect; it is mostly ISA cards that require these options.
<P>
<H2><A NAME="SECTION004551000000000000000">
42.5.1 Five ways to pass options to a module</A>
</H2>
<P>
<A NAME="sec:passingmodoptions"></A>
<P>
<DL COMPACT>
<DT>1.</DT>
<DD>If a module is compiled into the kernel, then the module
will be initialized at boot time. <TT>
<FONT COLOR="#0000ff">lilo</FONT></TT> passes module options
to the kernel from the command-line at the <TT>
<FONT COLOR="#0000ff">LILO:</FONT></TT> prompt.
For instance, at the <TT>
<FONT COLOR="#0000ff">LILO:</FONT></TT> prompt, you can
type <FONT COLOR="#ffa500">[See Section <A HREF="node7.html#sec:usagesumm">4.4</A>]</FONT>:
</DD>
</DL>
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>linux aha1542=<portbase>[,<buson>,<busoff>[,<dmaspeed>]]</code><br>
</FONT></TD></TR></TABLE><P>
<DL COMPACT>
<DT></DT>
<DD>to initialize the
Adaptec 1542 SCSI driver. What these options are and exactly
what goes in them can be learned from the file
<TT>
<FONT COLOR="#0000ff">/usr/src/linux-<version>/drivers/scsi/aha1542.c</FONT></TT>. Near
the top of the file are comments explaining the meaning of these
options.
</DD>
<DT>2.</DT>
<DD>If you are using <TT>
<FONT COLOR="#0000ff">LOADLIN.EXE</FONT></TT> or some other
DOS or Windows kernel loader, then it, too, can take similar options.
I will not go into these.
</DD>
<DT>3.</DT>
<DD><TT>
<FONT COLOR="#0000ff">/etc/lilo.conf</FONT></TT> can take the <TT>
<FONT COLOR="#0000ff">append =</FONT></TT>
option, as discussed on page <A HREF="node34.html#page:appendequ"><IMG ALIGN="BOTTOM" BORDER="1" ALT="[*]" SRC="crossref.png"></A>. This options
passes options to the kernel as though you had typed them at the
<TT>
<FONT COLOR="#0000ff">LILO:</FONT></TT> prompt. The equivalent <TT>
<FONT COLOR="#0000ff">lilo.conf</FONT></TT> line is
</DD>
</DL>
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>append = aha1542=<portbase>[,<buson>,<busoff>[,<dmaspeed>]]</code><br>
</FONT></TD></TR></TABLE><P>
<DL COMPACT>
<DT></DT>
<DD>This is the most common way of giving kernel boot options.
</DD>
<DT>4.</DT>
<DD>The <TT>
<FONT COLOR="#0000ff">insmod</FONT></TT> and <TT>
<FONT COLOR="#0000ff">modprobe</FONT></TT> commands
can take options that are passed to the module. These are
vastly different from the way you pass
options with <TT>
<FONT COLOR="#0000ff">append =</FONT></TT>. For instance, you can give options to
a compiled-in Ethernet module with the commands
</DD>
</DL>
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>append = ether=9,0x300,0xd0000,0xd4000,eth0</code><br>
<code>append = ether=0,0,eth1</code><br>
</FONT></TD></TR></TABLE><P>
<DL COMPACT>
<DT></DT>
<DD>from within <TT>
<FONT COLOR="#0000ff">/etc/lilo.conf</FONT></TT>. But then, using
<TT>
<FONT COLOR="#0000ff">modprobe</FONT></TT> on the same ``compiled-out'' modules, these
options have to be specified like this:
</DD>
</DL>
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>modprobe wd irq=9 io=0x300 mem=0xd0000 mem_end=0xd4000</code><br>
<code>modprobe de4x5</code><br>
</FONT></TD></TR></TABLE><P>
<DL COMPACT>
<DT></DT>
<DD>Note that the <TT>
<FONT COLOR="#0000ff">0xd0000,0xd4000</FONT></TT> are only applicable
to a few Ethernet modules and are usually omitted. Also, the <TT>
<FONT COLOR="#0000ff">0</FONT></TT>'s in
<TT>
<FONT COLOR="#0000ff">ether=0,0,eth1</FONT></TT> mean to try autodetect. To find out what
options a module will take, you can use the <TT>
<FONT COLOR="#0000ff">modinfo</FONT></TT> command which
shows that the <TT>
<FONT COLOR="#0000ff">wd</FONT></TT> driver is one of the few Ethernet drivers
where you can set their RAM usage. <FONT COLOR="#ffa500">[This has not been discussed,
but cards can sometimes use areas of memory directly.]</FONT>
</DD>
</DL>
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>[root@cericon]# <font color="navy"><B>modinfo -p /lib/modules/<version>/net/wd.o</B></font></code><br>
<code>( [root@cericon]# <font color="navy"><B>modinfo -p /lib/modules/<version>/kernel/drivers/net/wd.o</B></font> )</code><br>
<code>io int array (min = 1, max = 4)</code><br>
<code>irq int array (min = 1, max = 4)</code><br>
<code>mem int array (min = 1, max = 4)</code><br>
<code>mem_end int array (min = 1, max = 4)</code><br>
</FONT></TD></TR></TABLE><P>
<DL COMPACT>
<DT>5.</DT>
<DD>The file <TT>
<FONT COLOR="#0000ff">/etc/modules.conf</FONT></TT> <FONT COLOR="#ffa500">[Also sometimes
called <TT>
<FONT COLOR="#0000ff">/etc/conf.modules</FONT></TT>, but now deprecated.]</FONT> contains default
options for <TT>
<FONT COLOR="#0000ff">modprobe</FONT></TT>, instead of our giving them on the <TT>
<FONT COLOR="#0000ff">modprobe</FONT></TT>
command-line. This is the preferred and most
common way of giving module options. Our Ethernet example becomes:
</DD>
</DL>
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>alias eth0 wd</code><br>
<code>alias eth1 de4x5</code><br>
<code>options wd irq=9 io=0x300 mem=0xd0000 mem_end=0xd4000</code><br>
</FONT></TD></TR></TABLE><P>
<DL COMPACT>
<DT></DT>
<DD>Having set up an <TT>
<FONT COLOR="#0000ff">/etc/modules.conf</FONT></TT> file allows module
<I>dynamic loading</I> to take place. This means that the kernel
automatically loads the necessary module whenever the device is
required (as when <TT>
<FONT COLOR="#0000ff">ifconfig</FONT></TT> is first used for Ethernet devices). The kernel merely
tries an <TT>
<FONT COLOR="#0000ff">/sbin/modprobe eth0</FONT></TT>, and the <TT>
<FONT COLOR="#0000ff">alias</FONT></TT> line hints
to <TT>
<FONT COLOR="#0000ff">modprobe</FONT></TT> to actually run <TT>
<FONT COLOR="#0000ff">/sbin/modprobe wd</FONT></TT>.
Further, the <TT>
<FONT COLOR="#0000ff">options</FONT></TT> line means to run <TT>
<FONT COLOR="#0000ff">/sbin/modprobe
wd irq=9 io=0x300 mem=0xd0000 mem_end=0xd4000</FONT></TT>. In this way,
<TT>
<FONT COLOR="#0000ff">/etc/modules.conf</FONT></TT> maps devices to drivers.
</DD>
</DL>
<P>
<H2><A NAME="SECTION004552000000000000000">
42.5.2 Module documentation sources</A>
</H2>
<P>
You might like to see a complete summary of all module options with examples of each
of the five ways of passing options. No such summary exists at this point, simply
because there is no overall consistency and because people are mostly interested in
getting one particular device to work, which will doubtless have peculiarities best
discussed in a specialized document. Further, some specialized modules are mostly
used in compiled-out form, whereas others are mostly used in compiled-in form.
<P>
To get an old or esoteric device working, it is best to read the appropriate HOWTO
documents: <TT>
<FONT COLOR="#0000ff">BootPrompt-HOWTO</FONT></TT>, <TT>
<FONT COLOR="#0000ff">Ethernet-HOWTO</FONT></TT>, and
<TT>
<FONT COLOR="#0000ff">Sound-HOWTO</FONT></TT>. The device could also be documented in
<TT>
<FONT COLOR="#0000ff">/usr/linux-<version>/Documentation/</FONT></TT> or under one of its subdirectories like
<TT>
<FONT COLOR="#0000ff">sound/</FONT></TT> and <TT>
<FONT COLOR="#0000ff">networking/</FONT></TT>.
This is documentation written by the driver
authors themselves. Of particular interest is the file
<TT>
<FONT COLOR="#0000ff">/usr/src/linux/Documentation/networking/net-modules.txt</FONT></TT>, which, although
outdated, has a fairly comprehensive list of networking modules and the module
options they take. Another source of documentation is the driver <B>C</B> code itself, as in
the <TT>
<FONT COLOR="#0000ff">aha1542.c</FONT></TT> example above. It may explain the <TT>
<FONT COLOR="#0000ff">/etc/lilo.conf</FONT></TT> or
<TT>
<FONT COLOR="#0000ff">/etc/modules.conf</FONT></TT> options to use but will often be quite cryptic. A driver is
often written with only one of compiled-in or compiled-out support in mind (even
though it really supports both). Choose whether to compile-in or
compiled-out based on what is implied in the documentation or <B>C</B> source.
<P>
<H1><A NAME="SECTION004560000000000000000">
42.6 Configuring Various Devices</A>
</H1>
<P>
Further examples on getting common devices to work now follow but
only a few devices are discussed. See the documentation sources
above for more info. We concentrate here on what is <I>normally</I> done.
<P>
<H2><A NAME="SECTION004561000000000000000">
42.6.1 Sound and <TT>
<FONT COLOR="#0000ff">pnpdump</FONT></TT></A>
</H2>
<P>
<A NAME="sec:soundsandpnpdump"></A>
<P>
Plug-and-Play (PnP) ISA
sound cards (like SoundBlaster cards) are possibly the
more popular of any cards that people have gotten to work under L<SMALL>INUX</SMALL>. Here, we use
the sound card example to show how to get a PnP ISA card working in a few
minutes. <I>This is, of course, applicable to cards other than sound.</I>
<P>
A utility called <TT>
<FONT COLOR="#0000ff">isapnp</FONT></TT> takes one argument, the file
<TT>
<FONT COLOR="#0000ff">/etc/isapnp.conf</FONT></TT>, and configures all ISA Plug-and-Play
devices to the IRQs and I/O ports specified therein.
<TT>
<FONT COLOR="#0000ff">/etc/isapnp.conf</FONT></TT> is a complicated file but can be generated
with the <TT>
<FONT COLOR="#0000ff">pnpdump</FONT></TT> utility. <TT>
<FONT COLOR="#0000ff">pnpdump</FONT></TT> outputs an
example <TT>
<FONT COLOR="#0000ff">isapnp.conf</FONT></TT> file to stdout, which contains IRQ and I/O port
values allowed by your devices. You must edit these to unused
values. Alternatively, you can use <TT>
<FONT COLOR="#0000ff">pnpdump --config</FONT></TT> to get a
<TT>
<FONT COLOR="#0000ff">/etc/isapnp.conf</FONT></TT> file with the correct IRQ, I/O port, and DMA
channels automatically guessed from an examination of the
<TT>
<FONT COLOR="#0000ff">/proc/</FONT></TT> entries. This comes down to
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red size="-1">
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-2"><code>5</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue size="-1">
<code>[root@cericon]# <font color="navy"><B>pnpdump --config | grep -v '^\(#.*\|\)$' > /etc/isapnp.conf</B></font></code><br>
<code>[root@cericon]# <font color="navy"><B>isapnp /etc/isapnp.conf</B></font></code><br>
<code> </code><br>
<code>Board 1 has Identity c9 00 00 ab fa 29 00 8c 0e: CTL0029 Serial No 44026 [checksum c9]</code><br>
<code>CTL0029/44026[0]{Audio }: Ports 0x220 0x330 0x388; IRQ5 DMA1 DMA5 --- Enabled OK</code><br>
<code>CTL0029/44026[1]{IDE }: Ports 0x168 0x36E; IRQ10 --- Enabled OK</code><br>
<code>CTL0029/44026[2]{Game }: Port 0x200; --- Enabled OK</code><br>
</FONT></TD></TR></TABLE><P>
which gets any ISA PnP card configured with just two commands.
Note that the <TT>
<FONT COLOR="#0000ff">/etc/isapnp.gone</FONT></TT>
file can be used to make <TT>
<FONT COLOR="#0000ff">pnpdump</FONT></TT> avoid
using certain IRQ and I/O ports. Mine contains
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>IO 0x378,2</code><br>
<code>IRQ 7</code><br>
</FONT></TD></TR></TABLE><P>
to avoid conflicting with my parallel port.
<TT>
<FONT COLOR="#0000ff">isapnp /etc/isapnp.conf</FONT></TT> must be run each time at
boot and is probably already in your startup scripts.
<P>
Now that your ISA card is enabled, you can install the necessary modules.
You can read the <TT>
<FONT COLOR="#0000ff">/etc/isapnp.conf</FONT></TT> file and also <TT>
<FONT COLOR="#0000ff">isapnp</FONT></TT>'s
output above to reference the I/O ports to the correct module options:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>10</code></font><code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>alias sound-slot-0 sb</code><br>
<code>alias sound-service-0-0 sb</code><br>
<code>alias sound-service-0-1 sb</code><br>
<code>alias sound-service-0-2 sb</code><br>
<code>alias sound-service-0-3 sb</code><br>
<code>alias sound-service-0-4 sb</code><br>
<code>alias synth0 sb</code><br>
<code>post-install sb /sbin/modprobe "-k" "adlib_card"</code><br>
<code>options sb io=0x220 irq=5 dma=1 dma16=5 mpu_io=0x330</code><br>
<code>options adlib_card io=0x388 # FM synthesizer</code><br>
</FONT></TD></TR></TABLE><P>
<P>
Now run
<TT>
<FONT COLOR="#0000ff">tail -f /var/log/messages /var/log/syslog</FONT></TT>, and then at
another terminal type:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>depmod -a</code><br>
<code>modprobe sb</code><br>
</FONT></TD></TR></TABLE><P>
If you get no kernel or other errors, then the devices
are working.
<P>
Now we want to set up dynamic loading of the module. Remove
all the sound and other modules with <TT>
<FONT COLOR="#0000ff">rmmod -a</FONT></TT> (or manually),
and then try:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>aumix</code><br>
</FONT></TD></TR></TABLE><P>
You should get a kernel log like this:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>Sep 24 00:45:19 cericon kernel: Soundblaster audio driver</code><br>
<code> Copyright (C) by Hannu Savolainen 1993-1996</code><br>
<code>Sep 24 00:45:19 cericon kernel: SB 4.13 detected OK (240)</code><br>
</FONT></TD></TR></TABLE><P>
<P>
Then try:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>playmidi <somefile>.mid</code><br>
</FONT></TD></TR></TABLE><P>
<P>
You should get a kernel log like this one:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>Sep 24 00:51:34 cericon kernel: Soundblaster audio driver</code><br>
<code> Copyright (C) by Hannu Savolainen 1993-1996</code><br>
<code>Sep 24 00:51:34 cericon kernel: SB 4.13 detected OK (240)</code><br>
<code>Sep 24 00:51:35 cericon kernel: YM3812 and OPL-3 driver</code><br>
<code> Copyright (C) by Hannu Savolainen, Rob Hooft 1993-1996</code><br>
</FONT></TD></TR></TABLE><P>
If you had to comment out the <TT>
<FONT COLOR="#0000ff">alias</FONT></TT> lines,
then a kernel message like <TT>
<FONT COLOR="#0000ff">modprobe: Can't locate module
sound-slot-0</FONT></TT> would result. This indicates that the kernel is
attempting a <TT>
<FONT COLOR="#0000ff">/sbin/modprobe sound-slot-0</FONT></TT>: a cue to insert an
<TT>
<FONT COLOR="#0000ff">alias</FONT></TT> line. Actually,
<TT>
<FONT COLOR="#0000ff">sound-service-0-0</FONT></TT>,<TT>
<FONT COLOR="#0000ff">1</FONT></TT>,<TT>
<FONT COLOR="#0000ff">2</FONT></TT>,<TT>
<FONT COLOR="#0000ff">3</FONT></TT>,<TT>
<FONT COLOR="#0000ff">4</FONT></TT> are
the
<TT>
<FONT COLOR="#0000ff">/dev/mixer</FONT></TT>,<TT>
<FONT COLOR="#0000ff">sequencer</FONT></TT>,<TT>
<FONT COLOR="#0000ff">midi</FONT></TT>,<TT>
<FONT COLOR="#0000ff">dsp</FONT></TT>,<TT>
<FONT COLOR="#0000ff">audio</FONT></TT>
devices,
respectively. <TT>
<FONT COLOR="#0000ff">sound-slot-0</FONT></TT> means a card that should
supply all of these. The <TT>
<FONT COLOR="#0000ff">post-install</FONT></TT> option means to run an
additional command after installing the <TT>
<FONT COLOR="#0000ff">sb</FONT></TT> module; this takes
care of the Adlib sequencer driver. <FONT COLOR="#ffa500">[I was tempted to try
removing the <TT>
<FONT COLOR="#0000ff">post-install</FONT></TT> line and adding a
<TT>
<FONT COLOR="#0000ff">alias sound-service-0-1 adlib_card</FONT></TT>. This works, but not if
you run <TT>
<FONT COLOR="#0000ff">aumix</FONT></TT> before <TT>
<FONT COLOR="#0000ff">playmidi</FONT></TT>, **<I>shrug</I>**.]</FONT>
<P>
<H2><A NAME="SECTION004562000000000000000">
42.6.2 Parallel port</A>
</H2>
<P>
The parallel port module is much less trouble:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>alias parport_lowlevel parport_pc</code><br>
<code>options parport_lowlevel io=0x378 irq=7</code><br>
</FONT></TD></TR></TABLE><P>
Merely make sure that your IRQ and I/O port match those
in your CMOS (see Section <A HREF="node6.html#sec:cmos">3.3</A>), and that they do not
conflict with any other devices.
<P>
<H2><A NAME="SECTION004563000000000000000">
42.6.3 NIC -- Ethernet, PCI, and old ISA</A>
</H2>
<P>
<A NAME="sec:nicetherisa"></A>Here I demonstrate non-PnP ISA cards and PCI cards, using Ethernet
devices as an example. (NIC stands for Network Interface Card, that is, an
Ethernet 10 or 100 Mb card.)
<P>
For old ISA cards with jumpers, you will need to check your
<TT>
<FONT COLOR="#0000ff">/proc/</FONT></TT> files for unused IRQ and I/O ports and then physically
set the jumpers. Now you can do a <TT>
<FONT COLOR="#0000ff">modprobe</FONT></TT> as usual, for example:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>modinfo -p ne</code><br>
<code>modprobe ne io=0x300 irq=9</code><br>
</FONT></TD></TR></TABLE><P>
<P>
Of course, for dynamic loading, your <TT>
<FONT COLOR="#0000ff">/etc/modules.conf</FONT></TT> file must
have the lines:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>alias eth0 ne</code><br>
<code>options ne io=0x300 irq=9</code><br>
</FONT></TD></TR></TABLE><P>
<P>
On some occasions you will come across a card that has
software configurable jumpers, like PnP, but that can only be
configured with a DOS utility. In this case compiling the
module into the kernel will cause it to be autoprobed on startup
<I>without needing any other configuration</I>.
<P>
A worst case scenario is <I>a card whose make is unknown, as well
its IRQ and I/O ports</I>. The chip number on the card can sometimes give you a
hint (<TT>
<FONT COLOR="#0000ff">grep</FONT></TT> the kernel sources for this number), but not always. To get
this card working, compile in support for several modules, one of which the
card is likely to be. Experience will help you make better guesses. If one of
your guesses is correct, your card will almost certainly be discovered on
reboot. You can find its IRQ and I/O port values in <TT>
<FONT COLOR="#0000ff">/proc/</FONT></TT> or you can run
<TT>
<FONT COLOR="#0000ff">dmesg</FONT></TT> to see the autoprobe message line; the message will begin with
<TT>
<FONT COLOR="#0000ff">eth0: </FONT></TT>...<TT>
<FONT COLOR="#0000ff"> </FONT></TT> and contain some information about the driver.
This information can be used if you decide later to use modules instead of
your custom kernel.
<P>
As explained, PCI devices almost never require IRQ or I/O ports to be given
as options. As long as you have the correct module, a simple
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>modprobe <module></code><br>
</FONT></TD></TR></TABLE><P>
will always work. Finding the correct module can still be a problem,
however, because suppliers will call a card all sorts of marketable things
besides the actual chipset it is compatible with. The utility
<TT>
<FONT COLOR="#0000ff">scanpci</FONT></TT> (which is actually part of <B>X</B>) checks your PCI slots for
PCI devices. Running <TT>
<FONT COLOR="#0000ff">scanpci</FONT></TT> might output something like:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>10</code></font><code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code> . </code><br>
<code> .</code><br>
<code> .</code><br>
<code>pci bus 0x0 cardnum 0x09 function 0x0000: vendor 0x1011 device 0x0009</code><br>
<code> Digital DC21140 10/100 Mb/s Ethernet</code><br>
<code> </code><br>
<code>pci bus 0x0 cardnum 0x0b function 0x0000: vendor 0x8086 device 0x1229</code><br>
<code> Intel 82557/8/9 10/100MBit network controller</code><br>
<code> </code><br>
<code>pci bus 0x0 cardnum 0x0c function 0x0000: vendor 0x1274 device 0x1371</code><br>
<code> Ensoniq es1371</code><br>
</FONT></TD></TR></TABLE><P>
Another utility is <TT>
<FONT COLOR="#0000ff">lspci</FONT></TT> from
the <TT>
<FONT COLOR="#0000ff">pciutils</FONT></TT> package,
which gives comprehensive information where <TT>
<FONT COLOR="#0000ff">scanpci</FONT></TT> sometimes
gives none. Then a simple script (kernel <TT>
<FONT COLOR="#0000ff">2.4</FONT></TT> paths in parentheses again),
<A NAME="page:grepkernmodules"></A>
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>for i in /lib/modules/<version>/net/* ; do strings $i \</code><br>
<code> | grep -q -i 21140 && echo $i ; done</code><br>
<code>( for i in /lib/modules/<version>/kernel/drivers/net/* \</code><br>
<code> ; do strings $i | grep -q -i 21140 && echo $i ; done )</code><br>
<code>for i in /lib/modules/<version>/net/* ; do strings $i \</code><br>
<code> | grep -q -i 8255 && echo $i ; done</code><br>
<code>( for i in /lib/modules/<version>/kernel/drivers/net/* \</code><br>
<code> ; do strings $i | grep -q -i 8255 && echo $i ; done )</code><br>
</FONT></TD></TR></TABLE><P>
faithfully outputs three modules <TT>
<FONT COLOR="#0000ff">de4x5.o</FONT></TT>, <TT>
<FONT COLOR="#0000ff">eepro100.o</FONT></TT>,
and <TT>
<FONT COLOR="#0000ff">tulip.o</FONT></TT>, of which two are correct. On another system <TT>
<FONT COLOR="#0000ff">lspci</FONT></TT>
gave
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code> .</code><br>
<code> .</code><br>
<code> .</code><br>
<code>00:08.0 Ethernet controller: Macronix, Inc. [MXIC] MX987x5 (rev 20)</code><br>
<code>00:0a.0 Ethernet controller: Accton Technology Corporation SMC2-1211TX (rev 10)</code><br>
</FONT></TD></TR></TABLE><P>
and the same <TT>
<FONT COLOR="#0000ff">for</FONT></TT>...<TT>
<FONT COLOR="#0000ff">grep</FONT></TT>...<TT>
<FONT COLOR="#0000ff">Accton</FONT></TT> gave
<TT>
<FONT COLOR="#0000ff">rtl8139.o</FONT></TT> and <TT>
<FONT COLOR="#0000ff">tulip.o</FONT></TT> (the former of which was correct), and
<TT>
<FONT COLOR="#0000ff">for</FONT></TT>...<TT>
<FONT COLOR="#0000ff">grep</FONT></TT>...<TT>
<FONT COLOR="#0000ff">Macronix</FONT></TT> (or even <TT>
<FONT COLOR="#0000ff">987</FONT></TT>) gave
<TT>
<FONT COLOR="#0000ff">tulip.o</FONT></TT>, which hung the machine. I have yet to get that card working,
although Eddie across the room claims he got a similar card working fine.
Cards are cheap--there are enough working brands so that you don't have to waist
your time on difficult ones.
<P>
<H2><A NAME="SECTION004564000000000000000">
42.6.4 PCI vendor ID and device ID</A>
</H2>
<P>
PCI supports the useful concept that every vendor and device have unique hex IDs.
For instance, Intel has chosen to represent themselves by the completely
random number 0x8086 as their vendor ID. PCI cards will provide their IDs on request.
You will see numerical values listed in the output of <TT>
<FONT COLOR="#0000ff">lspci</FONT></TT>,
<TT>
<FONT COLOR="#0000ff">scanpci</FONT></TT>, and
<TT>
<FONT COLOR="#0000ff">cat /proc/pci</FONT></TT>, especially if the respective utility cannot look up
the vendor name from the ID number. The file
<TT>
<FONT COLOR="#0000ff">/usr/share/pci.ids</FONT></TT>
(<TT>
<FONT COLOR="#0000ff">/usr/share/misc/pci.ids</FONT></TT> on Debian) from the
<TT>
<FONT COLOR="#0000ff">pciutils</FONT></TT> package contains a complete
table of all IDs and their corresponding names. The <TT>
<FONT COLOR="#0000ff">kudzu</FONT></TT> package also has
a table <TT>
<FONT COLOR="#0000ff">/usr/share/kudzu/pcitable</FONT></TT>
containing the information we are <I>really</I>
looking for: ID to kernel module mappings. This enables you to
use the intended scientific method for locating
the correct PCI module from the kernel's <TT>
<FONT COLOR="#0000ff">/proc/pci</FONT></TT> data.
The file format is easy to understand, and as an exercise you should
try writing a shell script to do the lookup automatically.
<P>
<H2><A NAME="SECTION004565000000000000000">
42.6.5 PCI and sound</A>
</H2>
<P>
The <TT>
<FONT COLOR="#0000ff">scanpci</FONT></TT> output just above also shows the popular Ensoniq
sound card, sometimes built into motherboards. Simply adding the line
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>alias sound es1371</code><br>
</FONT></TD></TR></TABLE><P>
to your <TT>
<FONT COLOR="#0000ff">modules.conf</FONT></TT> file will get this card working.
It is relatively easy to find the type of card from the card itself--Ensoniq
cards actually have es1371 printed on one of the chips.
<P>
<H2><A NAME="SECTION004566000000000000000">
42.6.6 Commercial sound drivers</A>
</H2>
<P>
If your card is not listed in <TT>
<FONT COLOR="#0000ff">/usr/src/<version>/Documentation/sound/</FONT></TT>,
then you might be able to get a driver from
<EM>Open Sound</EM> <I><<TT><A NAME="tex2html67"
HREF="http://www.opensound.com">http://www.opensound.com</A></TT>></I>. If you still can't find a
driver, complain to the manufacturer by email.
<P>
<I><FONT SIZE="-1">There are a lot of sound (and other) cards whose manufacturers
refuse to supply the Free software community with specs. Disclosure of
programming information would enable L<SMALL>INUX</SMALL> users to buy their cards; Free
software developers would produce a driver at no cost. Actually,
manufacturers' reasons are often just pig-headedness.</FONT></I>
<P>
<H2><A NAME="SECTION004567000000000000000">
42.6.7 The ALSA sound project</A>
</H2>
<P>
The ALSA (<EM>Advanced Linux Sound
Architecture</EM> <I><<TT><A NAME="tex2html68"
HREF="http://www.alsa-project.org/">http://www.alsa-project.org/</A></TT>></I>) project aims to provide better kernel sound support. If
your card is not supported by the standard kernel or you are not getting
the most out of the standard kernel drivers, then do check this web site.
<P>
<H2><A NAME="SECTION004568000000000000000">
42.6.8 Multiple Ethernet cards</A>
</H2>
<P>
If you have more than one Ethernet card, you can easily specify both in your
<TT>
<FONT COLOR="#0000ff">modules.conf</FONT></TT> file, as shown in Section <A HREF="node45.html#sec:modoptions">42.5</A> above.
Modules compiled into the kernel only probe a single card (<TT>
<FONT COLOR="#0000ff">eth0</FONT></TT>) by
default. Adding the line
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>append = "ether=0,0,eth1 ether=0,0,eth2 ether=0,0,eth3"</code><br>
</FONT></TD></TR></TABLE><P>
will cause <TT>
<FONT COLOR="#0000ff">eth1</FONT></TT>, <TT>
<FONT COLOR="#0000ff">eth2</FONT></TT>, and <TT>
<FONT COLOR="#0000ff">eth3</FONT></TT> to be probed
as well. Further, replacing the <TT>
<FONT COLOR="#0000ff">0</FONT></TT>'s with actual values can force
certain interfaces to certain physical cards. If all your cards are
PCI, however, you will have to get the order of assignment by
experimentation.
<P>
<I>If you have two of the same card</I>, your kernel may complain when
you try to load the same module twice. The <TT>
<FONT COLOR="#0000ff">-o</FONT></TT> option to
<TT>
<FONT COLOR="#0000ff">insmod</FONT></TT> specifies a different internal name for the driver to trick the
kernel into thinking that the driver is not really loaded:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>alias eth0 3c509</code><br>
<code>alias eth1 3c509</code><br>
<code>options eth0 -o 3c509-0 io=0x280 irq=5</code><br>
<code>options eth1 -o 3c509-1 io=0x300 irq=7</code><br>
</FONT></TD></TR></TABLE><P>
However, with the following two PCI cards that deception was not necessary:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>alias eth0 rtl8139</code><br>
<code>alias eth1 rtl8139</code><br>
</FONT></TD></TR></TABLE><P>
<P>
<H2><A NAME="SECTION004569000000000000000">
42.6.9 SCSI disks</A>
</H2>
<P>
<A NAME="sec:scsidiskkern"></A>
<P>
SCSI (pronounced <I>scuzzy</I>) stands for <I>Small Computer System
Interface</I>. SCSI is a ribbon, a specification, and an electronic protocol for communication
between devices and computers. Like your IDE ribbons, SCSI ribbons can
connect to their own SCSI hard disks. SCSI ribbons have gone through some
versions to make SCSI faster, the latest ``Ultra-Wide'' SCSI ribbons are thin,
with a dense array of pins. Unlike your IDE, SCSI can also connect tape
drives, scanners, and many other types of peripherals. SCSI theoretically
allows multiple computers to share the same device, although I have not
seen this implemented in practice. Because many U<SMALL>NIX</SMALL> hardware platforms
only support SCSI, it has become an integral part of U<SMALL>NIX</SMALL> operating
systems.
<P>
SCSIs also introduce the concept of <I>LUN</I>s (which
stands for <I>Logical Unit Number</I>), <I>Buses</I>, and <I>ID</I>.
These are just numbers given to each device in order of the SCSI cards
you are using (if more than one), the SCSI cables on those cards, and
the SCSI devices on those cables--the SCSI
standard was designed to support a great many of these. The kernel
assigns each SCSI drive in sequence as it finds them: <TT>
<FONT COLOR="#0000ff">/dev/sda</FONT></TT>,
<TT>
<FONT COLOR="#0000ff">/dev/sdb</FONT></TT>, and so on, so these details are usually irrelevant.
<P>
An enormous amount should be said on SCSI, but the bare bones is that for
90% of situations, <TT>
<FONT COLOR="#0000ff">insmod <pci-scsi-driver></FONT></TT> is all you are going to
need. You can then immediately begin accessing the device through
<TT>
<FONT COLOR="#0000ff">/dev/sd</FONT></TT><I>?</I> for disks, <TT>
<FONT COLOR="#0000ff">/dev/st</FONT></TT><I>?</I> for tapes,
<TT>
<FONT COLOR="#0000ff">/dev/scd</FONT></TT><I>?</I> for CD-ROMs, or <TT>
<FONT COLOR="#0000ff">/dev/sg</FONT></TT><I>?</I> for
scanners. <FONT COLOR="#ffa500">[Scanner user programs will have docs on what devices they
access.]</FONT> SCSIs often also come with their own BIOS
that you can enter on startup (like your CMOS). This will enable you to set
certain things. In some cases, where your distribution compiles-out certain
modules, you may have to load one of <TT>
<FONT COLOR="#0000ff">sd_mod.o</FONT></TT>, <TT>
<FONT COLOR="#0000ff">st.o</FONT></TT>,
<TT>
<FONT COLOR="#0000ff">sr_mod.o</FONT></TT>, or <TT>
<FONT COLOR="#0000ff">sg.o</FONT></TT>, respectively. The core <TT>
<FONT COLOR="#0000ff">scsi_mod.o</FONT></TT>
module may also need loading, and <TT>
<FONT COLOR="#0000ff">/dev/</FONT></TT> devices may need to be
created. A safe bet is to run
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>cd /dev</code><br>
<code>./MAKEDEV -v sd</code><br>
<code>./MAKEDEV -v st0 st1 st2 st3</code><br>
<code>./MAKEDEV -v scd0 scd1 scd2 scd3</code><br>
<code>./MAKEDEV -v sg</code><br>
</FONT></TD></TR></TABLE><P>
to ensure that all necessary device files exist in the first place.
<P>
It is recommended that you compile into your kernel support for your SCSI card
(also called the <I>SCSI Host Adapter</I>) that you have, as well as
support for tapes, CD-ROMs, etc. When your system next boots, everything
will just autoprobe. An example system with a SCSI disk and tape gives
the following at bootup:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>10</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>15</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>20</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>25</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>30</code></font><code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>(scsi0) <Adaptec AIC-7895 Ultra SCSI host adapter> found at PCI 0/12/0</code><br>
<code>(scsi0) Wide Channel A, SCSI ID=7, 32/255 SCBs</code><br>
<code>(scsi0) Cables present (Int-50 YES, Int-68 YES, Ext-68 YES)</code><br>
<code>(scsi0) Illegal cable configuration!! Only two</code><br>
<code>(scsi0) connectors on the SCSI controller may be in use at a time!</code><br>
<code>(scsi0) Downloading sequencer code... 384 instructions downloaded</code><br>
<code>(scsi1) <Adaptec AIC-7895 Ultra SCSI host adapter> found at PCI 0/12/1</code><br>
<code>(scsi1) Wide Channel B, SCSI ID=7, 32/255 SCBs</code><br>
<code>(scsi1) Downloading sequencer code... 384 instructions downloaded</code><br>
<code>scsi0 : Adaptec AHA274x/284x/294x (EISA/VLB/PCI-Fast SCSI) 5.1.28/3.2.4</code><br>
<code> <Adaptec AIC-7895 Ultra SCSI host adapter></code><br>
<code>scsi1 : Adaptec AHA274x/284x/294x (EISA/VLB/PCI-Fast SCSI) 5.1.28/3.2.4</code><br>
<code> <Adaptec AIC-7895 Ultra SCSI host adapter></code><br>
<code>scsi : 2 hosts.</code><br>
<code>(scsi0:0:0:0) Synchronous at 40.0 Mbyte/sec, offset 8.</code><br>
<code> Vendor: FUJITSU Model: MAE3091LP Rev: 0112</code><br>
<code> Type: Direct-Access ANSI SCSI revision: 02</code><br>
<code>Detected scsi disk sda at scsi0, channel 0, id 0, lun 0</code><br>
<code>(scsi0:0:3:0) Synchronous at 10.0 Mbyte/sec, offset 15.</code><br>
<code> Vendor: HP Model: C1533A Rev: A708</code><br>
<code> Type: Sequential-Access ANSI SCSI revision: 02</code><br>
<code>Detected scsi tape st0 at scsi0, channel 0, id 3, lun 0</code><br>
<code>scsi : detected 1 SCSI tape 1 SCSI disk total.</code><br>
<code>SCSI device sda: hdwr sector= 512 bytes. Sectors= 17826240 [8704 MB] [8.7 GB]</code><br>
<code> .</code><br>
<code> .</code><br>
<code> .</code><br>
<code>Partition check:</code><br>
<code> sda: sda1</code><br>
<code> hda: hda1 hda2 hda3 hda4</code><br>
<code> hdb: hdb1</code><br>
</FONT></TD></TR></TABLE><P>
<P>
You should also check Section <A HREF="node34.html#sec:scsiinitrd">31.5</A> to find out how to boot
SCSI disks when the needed module... is on a file system... inside a
SCSI disk... that needs the module.
<P>
For actually using a tape drive, see page <A HREF="node21.html#page:tapebackups"><IMG ALIGN="BOTTOM" BORDER="1" ALT="[*]" SRC="crossref.png"></A>.
<P>
<H2><A NAME="SECTION0045610000000000000000">
42.6.10 SCSI termination and cooling</A>
</H2>
<P>
<A NAME="sec:scsitermandcool"></A>This is the most important section to read regarding SCSI. You may be used
to IDE ribbons that just plug in and work. SCSI ribbons are not of this variety;
they need to be impedance matched and terminated. These are electrical
technicians' terms. Basically, it means that you must use high-quality SCSI
ribbons and <I>terminate</I> your SCSI device. SCSI ribbons allow many
SCSI disks and tapes to be connected to one ribbon. <I>Terminating</I> means
setting certain jumpers or switches on the last devices on the ribbon. It may
also mean plugging the last cable connector into something else. Your
adapter documentation and disk documentation should explain what to do. If you
terminate incorrectly, everything may work fine, but you may get disk errors
later in the life of the machine. Also note that some newer SCSI devices have
automatic termination.
<P>
Cooling is another important consideration. When the documentation
for a disk drive recommends <B>forced air cooling</B> for that drive,
<I>it usually means it</I>. SCSI drives get extremely hot and can burn out
in time. Forced air cooling can mean as little as buying a cheap circuit box
fan and tying it in a strategic position. You should also use very large
cases with several inches of space between drives. Anyone who has
opened up an expensive high end server will see the attention paid to
air cooling.
<P>
<H2><A NAME="SECTION0045611000000000000000">
42.6.11 CD writers</A>
</H2>
<P>
A system with an ATAPI (IDE
CD-Writer <I>and</I> ordinary CD-ROM will
display a message at bootup like,
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>hda: FUJITSU MPE3084AE, ATA DISK drive</code><br>
<code>hdb: CD-ROM 50X L, ATAPI CDROM drive</code><br>
<code>hdd: Hewlett-Packard CD-Writer Plus 9300, ATAPI CDROM drive</code><br>
</FONT></TD></TR></TABLE><P>
<I>Note that these devices should give BIOS messages before
<TT>
<FONT COLOR="#0000ff">LILO:</FONT></TT> starts to indicate that
they are correctly installed.</I>
<P>
The <TT>
<FONT COLOR="#0000ff">/etc/modules.conf</FONT></TT> lines to get the CD-writer
working are:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>alias scd0 sr_mod # load sr_mod upon access of /dev/scd0</code><br>
<code>alias scsi_hostadapter ide-scsi # SCSI hostadaptor emulation</code><br>
<code>options ide-cd ignore="hda hdc hdd" # Our normal IDE CD is on /dev/hdb</code><br>
</FONT></TD></TR></TABLE><P>
The <TT>
<FONT COLOR="#0000ff">alias scd0</FONT></TT> line must be omitted if <TT>
<FONT COLOR="#0000ff">sr_mod</FONT></TT> is
compiled into the kernel--search your <TT>
<FONT COLOR="#0000ff">/lib/modules/<version>/</FONT></TT>
directory. Note that the kernel does not support ATAPI CD-Writers directly.
The <TT>
<FONT COLOR="#0000ff">ide-scsi</FONT></TT> module
<I>emulates</I> a SCSI adapter on
behalf of the ATAPI CD-ROM. CD-Writer
software expects to speak to <TT>
<FONT COLOR="#0000ff">/dev/scd</FONT></TT><I>?</I>, and the
<TT>
<FONT COLOR="#0000ff">ide-scsi</FONT></TT> module makes this device appear like a real
SCSI CD writer. <FONT COLOR="#ffa500">[Real SCSI CD
writers are much more expensive.]</FONT> There is
one caveat: your ordinary IDE CD-ROM driver,
<TT>
<FONT COLOR="#0000ff">ide-cd</FONT></TT>, will also want to probe your CD writer as if it were a normal
CD-ROM. The <TT>
<FONT COLOR="#0000ff">ignore</FONT></TT> option makes the <TT>
<FONT COLOR="#0000ff">ide-cd</FONT></TT> module overlook
any drives that should not be probed--on this system, these would be the
hard disk, CD writer, and non-existent secondary master. <I>However</I>,
there is no way of giving an <TT>
<FONT COLOR="#0000ff">ignore</FONT></TT> option to a compiled-in
<TT>
<FONT COLOR="#0000ff">ide-cd</FONT></TT> module (which is how many distributions ship), so
read on.
<P>
An alternative is to compile in support for <TT>
<FONT COLOR="#0000ff">ide-scsi</FONT></TT> and completely
leave out support for <TT>
<FONT COLOR="#0000ff">ide-cd</FONT></TT>. Your normal CD-ROM will work perfectly
as a read-only CD-ROM under SCSI emulation. <FONT COLOR="#ffa500">[Even with music CDs.]</FONT>This means setting the relevant sections of your kernel configuration menu:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code><*> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support</code><br>
<code>< > Include IDE/ATAPI CDROM support</code><br>
<code><*> SCSI emulation support</code><br>
<code> </code><br>
<code><*> SCSI support</code><br>
<code><*> SCSI CD-ROM support</code><br>
<code>[*] Enable vendor-specific extensions (for SCSI CDROM)</code><br>
<code><*> SCSI generic support</code><br>
</FONT></TD></TR></TABLE><P>
<P>
No further configuration is needed, and on bootup, you will find
messages like:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>10</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>scsi0 : SCSI host adapter emulation for IDE ATAPI devices</code><br>
<code>scsi : 1 host.</code><br>
<code> Vendor: E-IDE Model: CD-ROM 50X L Rev: 12 </code><br>
<code> Type: CD-ROM ANSI SCSI revision: 02</code><br>
<code>Detected scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0</code><br>
<code> Vendor: HP Model: CD-Writer+ 9300 Rev: 1.0b</code><br>
<code> Type: CD-ROM ANSI SCSI revision: 02</code><br>
<code>Detected scsi CD-ROM sr1 at scsi0, channel 0, id 1, lun 0</code><br>
<code>scsi : detected 2 SCSI generics 2 SCSI cdroms total.</code><br>
<code>sr0: scsi3-mmc drive: 4x/50x cd/rw xa/form2 cdda tray</code><br>
<code>Uniform CD-ROM driver Revision: 3.10</code><br>
<code>sr1: scsi3-mmc drive: 32x/32x writer cd/rw xa/form2 cdda tray</code><br>
</FONT></TD></TR></TABLE><P>
<P>
If you do have a real SCSI writer, compiling in support
for your SCSI card will detect it in a similar fashion. Then, for this example,
the device on which to <TT>
<FONT COLOR="#0000ff">mount</FONT></TT> your CD-ROM is <TT>
<FONT COLOR="#0000ff">/dev/scd0</FONT></TT> and
your CD-Writer, <TT>
<FONT COLOR="#0000ff">/dev/scd1</FONT></TT>.
<P>
For actually recording a CD, the <TT>
<FONT COLOR="#0000ff">cdrecord</FONT></TT> command-line program
is simple and robust, although there are also many pretty graphical front ends.
To locate your CD ID, run
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>cdrecord -scanbus</code><br>
</FONT></TD></TR></TABLE><P>
which will give a comma-separated numeric sequence. You can then
use this sequence as the argument to <TT>
<FONT COLOR="#0000ff">cdrecord</FONT></TT>'s <TT>
<FONT COLOR="#0000ff">dev=</FONT></TT> option.
On my machine I type
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>mkisofs -a -A 'Paul Sheer' -J -L -r -P PaulSheer \</code><br>
<code> -p www.icon.co.za/~psheer/ -o my_iso /my/directory</code><br>
<code>cdrecord dev=0,1,0 -v speed=10 -isosize -eject my_iso</code><br>
</FONT></TD></TR></TABLE><P>
to create an ISO9660 CD-ROM out of everything below a
directory <TT>
<FONT COLOR="#0000ff">/my/directory</FONT></TT>. This is most useful for backups. (The <TT>
<FONT COLOR="#0000ff">-a</FONT></TT> option should
be omitted in newer versions of this command.) Beware not to exceed the speed limit of your
CD writer.
<P>
<H2><A NAME="SECTION0045612000000000000000">
42.6.12 Serial devices</A>
</H2>
<P>
<A NAME="page:serialdevices"></A><A NAME="sec:serialdevices"></A>
<P>
You don't need to load any modules to get your mouse and modem to work.
Regular serial devices (COM1 through COM4 under DOS/Windows) will
autoprobe on boot and are available as <TT>
<FONT COLOR="#0000ff">/dev/ttyS0</FONT></TT> through
<TT>
<FONT COLOR="#0000ff">/dev/ttyS3</FONT></TT>. A message on boot, like
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>Serial driver version 4.27 with MANY_PORTS MULTIPORT SHARE_IRQ enabled</code><br>
<code>ttyS00 at 0x03f8 (irq = 4) is a 16550A</code><br>
<code>ttyS01 at 0x02f8 (irq = 3) is a 16550A</code><br>
</FONT></TD></TR></TABLE><P>
will testify to their correct detection.
<P>
On the other hand, multiport serial
cards can be difficult to configure. These
devices are in a category all of their own. Most use a chip called the
<I>16550A UART</I> (Universal Asynchronous Receiver Transmitter),
which is similar to that of your built-in serial port.
The kernel's generic serial code supports them, and
you will not need a separate driver. The UART really <I>is</I> the serial
port and comes in the flavors <TT>
<FONT COLOR="#0000ff">8250</FONT></TT>, <TT>
<FONT COLOR="#0000ff">16450</FONT></TT>, <TT>
<FONT COLOR="#0000ff">16550</FONT></TT>,
<TT>
<FONT COLOR="#0000ff">16550A</FONT></TT>, <TT>
<FONT COLOR="#0000ff">16650</FONT></TT>, <TT>
<FONT COLOR="#0000ff">16650V2</FONT></TT>, and <TT>
<FONT COLOR="#0000ff">16750</FONT></TT>.
<P>
To get these cards working requires the use of the <TT>
<FONT COLOR="#0000ff">setserial</FONT></TT> command. It is
used to configure the kernel's built-in serial driver. A typical example is an
8-port non-PnP ISA card with jumpers set to unused IRQ <TT>
<FONT COLOR="#0000ff">5</FONT></TT> and
ports <TT>
<FONT COLOR="#0000ff">0x180</FONT></TT>-<TT>
<FONT COLOR="#0000ff">0x1BF</FONT></TT>. Note that unlike most devices, many
serial devices can share the same IRQ. <FONT COLOR="#ffa500">[The reason is that serial
devices set an I/O port to tell which device is sending the interrupt. The CPU
just checks every serial device whenever an interrupt comes in.]</FONT> The
card is configured with this script:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>10</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>15</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>cd /dev/</code><br>
<code>./MAKEDEV -v ttyS4</code><br>
<code>./MAKEDEV -v ttyS5</code><br>
<code>./MAKEDEV -v ttyS6</code><br>
<code>./MAKEDEV -v ttyS7</code><br>
<code>./MAKEDEV -v ttyS8</code><br>
<code>./MAKEDEV -v ttyS9</code><br>
<code>./MAKEDEV -v ttyS10</code><br>
<code>./MAKEDEV -v ttyS11</code><br>
<code>/bin/setserial -v /dev/ttyS4 irq 5 port 0x180 uart 16550A skip_test</code><br>
<code>/bin/setserial -v /dev/ttyS5 irq 5 port 0x188 uart 16550A skip_test</code><br>
<code>/bin/setserial -v /dev/ttyS6 irq 5 port 0x190 uart 16550A skip_test</code><br>
<code>/bin/setserial -v /dev/ttyS7 irq 5 port 0x198 uart 16550A skip_test</code><br>
<code>/bin/setserial -v /dev/ttyS8 irq 5 port 0x1A0 uart 16550A skip_test</code><br>
<code>/bin/setserial -v /dev/ttyS9 irq 5 port 0x1A8 uart 16550A skip_test</code><br>
<code>/bin/setserial -v /dev/ttyS10 irq 5 port 0x1B0 uart 16550A skip_test</code><br>
<code>/bin/setserial -v /dev/ttyS11 irq 5 port 0x1B8 uart 16550A skip_test</code><br>
</FONT></TD></TR></TABLE><P>
<P>
You should immediately be able to use these devices as regular ports. Note
that you would expect to see the interrupt in use under
<TT>
<FONT COLOR="#0000ff">/proc/interrupts</FONT></TT>. For serial
devices this is only true after data actually
starts to flow. However, you can check
<TT>
<FONT COLOR="#0000ff">/proc/tty/driver/serial</FONT></TT> to get
more status information. The <TT>
<FONT COLOR="#0000ff">setserial</FONT></TT> man page contains more about
different UARTs and their compatibility problems. It also explains
autoprobing of the UART, IRQ, and I/O ports (although
it is better to be sure of your card and never use autoprobing).
<P>
Serial devices give innumerable problems. There is a very long
<TT>
<FONT COLOR="#0000ff">Serial-HOWTO</FONT></TT> that will help you solve most of them; It goes into
more technical detail. It will also explain special kernel support for
many ``nonstandard'' cards.
<P>
<H1><A NAME="SECTION004570000000000000000">
42.7 Modem Cards</A>
</H1>
<P>
<A NAME="sec:internalmodemcard"></A>
<P>
Elsewhere in this book I refer only to ordinary external modems that connect
to your machine's auxiliary serial port. However, internal ISA modem
cards are cheaper and include their own internal serial port. This card
can be treated as above, like an ISA multiport serial card with only one
port: just set the I/O port and IRQ jumpers and then run
<TT>
<FONT COLOR="#0000ff">setserial /dev/ttyS3</FONT></TT>... .
<P>
Beware that a new variety of modem has been invented called the
``win-modem.'' These cards are actually just sound cards. Your operating
system has to generate the signals needed to talk the same protocol as
a regular modem. Because the CPU has to be very fast to do this, such
modems were probably not viable before 1997 or so.
<I><TT><A NAME="tex2html69"
HREF="http://linmodems.technion.ac.il/">http://linmodems.technion.ac.il/</A></TT></I>,
<I><TT><A NAME="tex2html70"
HREF="http://www.idir.net/~gromitkc/winmodem.html">http://www.idir.net/~gromitkc/winmodem.html</A></TT></I>, and
<I><TT><A NAME="tex2html71"
HREF="http://www.linmodems.org/">http://www.linmodems.org/</A></TT></I> are three resources that cover
these modems.
<P>
<H1><A NAME="SECTION004580000000000000000">
42.8 More on <TT>
<FONT COLOR="#0000ff">LILO:</FONT></TT> Options</A>
</H1>
<P>
The <TT>
<FONT COLOR="#0000ff">BootPrompt-HOWTO</FONT></TT> contains an exhaustive list of things that
can be typed at the boot prompt to do interesting things
like NFS root mounts.
This document is important to read if only to get
an idea of the features that L<SMALL>INUX</SMALL> supports.
<P>
<H1><A NAME="SECTION004590000000000000000">
42.9 Building the Kernel</A>
</H1>
<P>
Summary:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>10</code></font><code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>cd /usr/src/linux/</code><br>
<code>make mrproper</code><br>
<code>make menuconfig</code><br>
<code>make dep</code><br>
<code>make clean</code><br>
<code>make bzImage</code><br>
<code>make modules</code><br>
<code>make modules_install</code><br>
<code>cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-<version></code><br>
<code>cp /usr/src/linux/System.map /boot/System.map-<version></code><br>
</FONT></TD></TR></TABLE><P>
Finally, edit <TT>
<FONT COLOR="#0000ff">/etc/lilo.conf</FONT></TT> and
run <TT>
<FONT COLOR="#0000ff">lilo</FONT></TT>. Details on each of these steps follow.
<P>
<H2><A NAME="SECTION004591000000000000000">
42.9.1 Unpacking and patching</A>
</H2>
<P>
The L<SMALL>INUX</SMALL> kernel is available from various places as
<TT>
<FONT COLOR="#0000ff">linux-</FONT></TT><I>?</I><TT>
<FONT COLOR="#0000ff">.</FONT></TT><I>?</I><TT>
<FONT COLOR="#0000ff">.</FONT></TT><I>?</I><TT>
<FONT COLOR="#0000ff">.tar.gz</FONT></TT>,
but primarily from <EM>the
L<SMALL>INUX</SMALL> kernel's home</EM> <I><<TT><A NAME="tex2html72"
HREF="ftp://ftp.kernel.org/pub/linux/kernel/">ftp://ftp.kernel.org/pub/linux/kernel/</A></TT>></I>.
<P>
The kernel can easily be unpacked with
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>cd /usr/src</code><br>
<code>mv linux linux-OLD</code><br>
<code>tar -xzf linux-2.4.0-test6.tar.gz</code><br>
<code>mv linux linux-2.4.0-test6</code><br>
<code>ln -s linux-2.4.0-test6 linux</code><br>
<code>cd linux</code><br>
</FONT></TD></TR></TABLE><P>
and possibly patched with (see Section <A HREF="node23.html#sec:applyingpatches">20.7.3</A>):
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>bzip2 -cd ../patch-2.4.0-test7.bz2 | patch -s -p1</code><br>
<code>cd ..</code><br>
<code>mv linux-2.4.0-test6 linux-2.4.0-test7</code><br>
<code>ln -sf linux-2.4.0-test7 linux</code><br>
<code>cd linux</code><br>
<code>make mrproper</code><br>
</FONT></TD></TR></TABLE><P>
<P>
Your <TT>
<FONT COLOR="#0000ff">2.4.0-test6</FONT></TT> kernel source tree is now a <TT>
<FONT COLOR="#0000ff">2.4.0-test7</FONT></TT>
kernel source tree. You will often want to patch
the kernel with features that Linus did not include, like security patches or
commercial hardware drivers.
<P>
Important is that the following include directories point to
the correct directories in the kernel source tree:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red size="-1">
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue size="-1">
<code>[root@cericon]# <font color="navy"><B>ls -al /usr/include/{linux,asm} /usr/src/linux/include/asm</B></font></code><br>
<code>lrwxrwxrwx 1 root root 24 Sep 4 13:45 /usr/include/asm -> ../src/linux/include/asm</code><br>
<code>lrwxrwxrwx 1 root root 26 Sep 4 13:44 /usr/include/linux -> ../src/linux/include/linux</code><br>
<code>lrwxrwxrwx 1 root root 8 Sep 4 13:45 /usr/src/linux/include/asm -> asm-i386</code><br>
</FONT></TD></TR></TABLE><P>
<P>
Before continuing, you should read the <TT>
<FONT COLOR="#0000ff">Changes</FONT></TT>
file (under <TT>
<FONT COLOR="#0000ff">/usr/src/linux/Documentation/</FONT></TT>) to find out
what is required to build the kernel. If you have a kernel
source tree supplied by your distribution, everything will
already be up-to-date.
<P>
<H2><A NAME="SECTION004592000000000000000">
42.9.2 Configuring</A>
</H2>
<P>
(A kernel tree that has suffered from previous builds may need you to run
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>make mrproper</code><br>
</FONT></TD></TR></TABLE><P>
before anything else. This completely cleans the tree, as though you
had just unpacked it.)
<P>
There are three kernel configuration interfaces.
The old line-for-line <TT>
<FONT COLOR="#0000ff">y/n</FONT></TT> interface is painful to use. For
a better text mode interface, you can type
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>make menuconfig</code><br>
</FONT></TD></TR></TABLE><P>
otherwise, under <B>X</B> enter
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>make xconfig</code><br>
</FONT></TD></TR></TABLE><P>
to get the graphical configurator. For this discussion, I assume that
you are using the text-mode interface.
<P>
The configure program enables you to specify an enormous
number of features. It is advisable to skim through all the sections to get a
feel for the different things you can do. Most options are about specifying
whether you want a feature <B><TT>
<FONT COLOR="#0000ff">[*]</FONT></TT></B> compiled into the kernel image,
<B><TT>
<FONT COLOR="#0000ff">[M]</FONT></TT></B> compiled as a module, or <B><TT>
<FONT COLOR="#0000ff">[ ]</FONT></TT></B> not compiled at all.
You can also turn off module support altogether from
<B><TT>
<FONT COLOR="#0000ff">Loadable module support --></FONT></TT></B>. The kernel configuration
is one L<SMALL>INUX</SMALL> program that offers lots of help--select <B><TT>
<FONT COLOR="#0000ff">< Help ></FONT></TT></B> on
any feature. The raw help file is
<TT>
<FONT COLOR="#0000ff">/usr/src/linux/Documentation/Configure.help</FONT></TT>
(nearly 700 kilobytes) and is worth reading.
<P>
When you are satisfied with your selection of options, select <B><TT>
<FONT COLOR="#0000ff">< Exit ></FONT></TT></B>
and select <B><TT>
<FONT COLOR="#0000ff">save your new kernel configuration</FONT></TT></B>.
<P>
The kernel configuration is saved in a file <TT>
<FONT COLOR="#0000ff">/usr/src/linux/.config</FONT></TT>. Next
time you run <TT>
<FONT COLOR="#0000ff">make menuconfig</FONT></TT>,
your configuration will default to these settings.
The file
<TT>
<FONT COLOR="#0000ff">/usr/src/linux/arch/i386/defconfig</FONT></TT>
contains defaults to use in the
absence of a <TT>
<FONT COLOR="#0000ff">.config</FONT></TT> file. Note that the command <TT>
<FONT COLOR="#0000ff">make mrproper</FONT></TT> removes
the <TT>
<FONT COLOR="#0000ff">.config</FONT></TT> file.
<P>
<H1><A NAME="SECTION0045100000000000000000">
42.10 Using Packaged Kernel Source</A>
</H1>
<P>
Your distribution will probably have a kernel source package ready to build.
This package is better to use than downloading the source yourself because all the default
build options will be present; for instance, RedHat 7.0 comes with the file
<TT>
<FONT COLOR="#0000ff">/usr/src/linux-2.2.16/configs/kernel-2.2.16-i586-smp.config</FONT></TT>, which
can be copied over the <TT>
<FONT COLOR="#0000ff">/usr/src/linux-2.2.16/.config</FONT></TT> to build a kernel
optimized for SMP (<I>Symmetric Multiprocessor Support</I>)
with all of RedHat's defaults enabled. It also comes with a
custom <TT>
<FONT COLOR="#0000ff">defconfig</FONT></TT> file to
build kernels identical to those of RedHat. Finally,
RedHat would have applied many patches to add features that may be
time consuming to do yourself. The same goes for Debian.
<P>
You should try to enable or ``compile-in''
features rather than disable anything,
since the default RedHat kernel supports almost every kernel feature, and
later it may be more convenient to have left it that way. On the other hand, a
minimal kernel will compile much faster.
<P>
<H1><A NAME="SECTION0045110000000000000000">
42.11 Building, Installing</A>
</H1>
<P>
Run the following commands to build the kernel; this process may take anything from
a few minutes to several hours, depending on what you have enabled. After
each command completes, check the last few messages for errors (or check the return
code, <TT>
<FONT COLOR="#0000ff">$?</FONT></TT>), rather than blindly typing the next commands.
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<font size="-1"><code>5</code></font><code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>make dep && \</code><br>
<code>make clean && \</code><br>
<code>make bzImage && \</code><br>
<code>make modules && \</code><br>
<code>make modules_install</code><br>
</FONT></TD></TR></TABLE><P>
The command <TT>
<FONT COLOR="#0000ff">make modules_install</FONT></TT> would have installed all modules
into <TT>
<FONT COLOR="#0000ff">/lib/modules/<version></FONT></TT>. <FONT COLOR="#ffa500">[You may like to clear out this
directory at some point and rerun <TT>
<FONT COLOR="#0000ff">make modules_install</FONT></TT>, since stale
modules cause problems with <TT>
<FONT COLOR="#0000ff">depmod -a</FONT></TT>.]</FONT>
<P>
The kernel image itself, <TT>
<FONT COLOR="#0000ff">/usr/src/linux/arch/i386/boot/bzImage</FONT></TT>,
and <TT>
<FONT COLOR="#0000ff">/usr/src/linux/System.map</FONT></TT> are two other files
produced
by the build.
These must be copied to <TT>
<FONT COLOR="#0000ff">/boot/</FONT></TT>, possibly creating neat symlinks:
<P><TABLE nowrap="1" width="100%" border="0" cellspacing="0" cellpadding="0">
<TR>
<TD valign="top" class="source" width="2%"><FONT color=red>
<code> </code><br>
<code> </code><br>
<code> </code><br>
<code> </code><br>
</FONT></TD><TD valign="top" class="source" bgcolor="#FFE0C0"><FONT color=blue>
<code>cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-<version></code><br>
<code>cp /usr/src/linux/System.map /boot/System.map-<version></code><br>
<code>ln -sf System.map-<version> /boot/System.map</code><br>
<code>ln -sf /boot/vmlinuz-<version> vmlinuz</code><br>
</FONT></TD></TR></TABLE><P>
<P>
Finally, your <TT>
<FONT COLOR="#0000ff">lilo.conf</FONT></TT> may be
edited as described in Chapter <A HREF="node34.html#chap:lilo">31</A>.
Most people now forget to run <TT>
<FONT COLOR="#0000ff">lilo</FONT></TT> and
find their system unbootable.
Do run <TT>
<FONT COLOR="#0000ff">lilo</FONT></TT>, making sure that you have left your
old kernel in as an option, in case you need to return to it.
Also make a boot floppy from your
kernel, as shown in Section <A HREF="node34.html#sec:bootfloppy">31.4</A>.
<P>
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html2824"
HREF="node46.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A>
<A NAME="tex2html2820"
HREF="rute.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A>
<A NAME="tex2html2814"
HREF="node44.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A>
<A NAME="tex2html2822"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html2825"
HREF="node46.html">43. The X Window</A>
<B> Up:</B> <A NAME="tex2html2821"
HREF="rute.html">rute</A>
<B> Previous:</B> <A NAME="tex2html2815"
HREF="node44.html">41. Point-to-Point Protocol </A>
  <B> <A NAME="tex2html2823"
HREF="node1.html">Contents</A></B>
<!--End of Navigation Panel-->
</BODY>
</HTML>
|