home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Edition 1: Linux / CD1.iso / doc / HOWTO / mini / Modules < prev    next >
Text File  |  1998-10-14  |  11KB  |  404 lines

  1.  
  2.                      LINUX MODULES INSTALLATION MINI-HOWTO
  3.                                        
  4. Contents
  5.  
  6.    
  7.        
  8.      * Purpose of this document
  9.      * WARNING
  10.      * Pre-requisites
  11.      * Recompiling the kernel for modules
  12.      * Configuring Debian or RedHat for modules
  13.      * Configuring Slackware for modules
  14.      * Configuring other distributions for modules
  15.      * Copyright and other Legalities
  16.        
  17.    
  18.      _________________________________________________________________
  19.    
  20.    
  21.    
  22. Purpose of this document
  23.  
  24.    
  25.    
  26.    My experience with Linux and modules has been that the existing
  27.    documents fail to provide a satisfactory explanation as to how to
  28.    successfully set up Linux with modules configured and working. The
  29.    procedure explained in this document has been successfully used
  30.    several times, both on my own system and over the Internet to give
  31.    directions to somebody trying to get some feature to work which
  32.    requires a driver supplied only in module form.
  33.    
  34.    My own system runs from a RedHat 4.1 distribution of Linux, and it was
  35.    on this setup that I developed the procedure. I have since
  36.    successfully installed it on systems running from various Slackware
  37.    distributions, and on one system running from a Debian distribution,
  38.    and the necessary procedure to correctly configure modules under Linux
  39.    in all three is documented herein.
  40.    
  41.    
  42.      _________________________________________________________________
  43.    
  44.    
  45.    
  46. WARNING
  47.  
  48.    
  49.    
  50.    I have recently used the same procedure with RedHat 4.2, but with
  51.    inconsistant results on apparently identical systems. I have NOT yet
  52.    determined what the problem is, so can make NO guarantees at this
  53.    stage as to whether or not it will work on your system.
  54.    
  55.    
  56.      _________________________________________________________________
  57.    
  58.    
  59.    
  60. Pre-requisites
  61.  
  62.    
  63.        
  64.        
  65.      * Before the steps in this document can be applied, the reader MUST
  66.        have a working Linux installation in which one can get to the
  67.        Linux prompt as user root since the majority of the steps involved
  68.        can only be undertaken by the said user.
  69.        
  70.        
  71.      * The existing kernel may be compiled either to use modules or not
  72.        to use modules, and can even display error messages during the
  73.        boot-up procedure as a result of modules being configured which
  74.        aren't available at the moment, providing the above condition is
  75.        met.
  76.        
  77.        
  78.      * The source tree for the current kernel is assumed to be found
  79.        rooted at /usr/src/linux and that is also assumed to be the
  80.        current directory throughout this document at the start of any
  81.        sequence of commands to be issued.
  82.        
  83.    
  84.    
  85.    
  86.      _________________________________________________________________
  87.    
  88.    
  89.    
  90. Compiler Speed-up
  91.  
  92.    
  93.    
  94.    If your machine has 16 or more Megabytes of RAM, there is a useful
  95.    speed-up that can be done, which is to permit the kernel to compile
  96.    two or modules in parallel. This will increase the load on the machine
  97.    whilst the kernel is being recompiled, but will reduce the time during
  98.    which the compilation will be taking place.
  99.    
  100.    Before you can use this method, you need to check the amount of RAM
  101.    present in your machine, as if you set this too high, the compilation
  102.    will actually slow down. Experience has shown that the optimum value
  103.    depends on the amount of RAM in your system according to the following
  104.    formula, at least for systems with up to 32 Megabytes of RAM, although
  105.    it may be a little conservative for systems with larger amounts of
  106.    RAM:
  107.    
  108.    N = [RAM in Megabytes] / 8 + 1
  109.    
  110.    For the benefit of those with a dislike of maths, the values for the
  111.    common amounts of RAM are as follows:
  112.    
  113.    RAM size Value to use 16 Megs 3 24 Megs 4 32 Megs 5 40 Megs 6 48 Megs
  114.    7 56 Megs 8 64 Megs 9 80 Megs 11 96 Megs 13 112 Megs 15 128 Megs 17
  115.    
  116.    When you have decided on the correct number, edit the file
  117.    /usr/src/linux/Makefile and find the line that currently reads:
  118.    
  119.    
  120.  
  121.    MAKE=make
  122.  
  123.  
  124.    
  125.    
  126.    Replace it with one reading:
  127.    
  128.    
  129.  
  130.    MAKE=make -j N
  131.  
  132.  
  133.    where N is the number determined above.
  134.    
  135.    
  136.      _________________________________________________________________
  137.    
  138.    
  139.    
  140. Recompiling the kernel for modules
  141.  
  142.    
  143.    
  144.    The kernel can be reconfigured to use modules for everything other
  145.    than the file system mounted as root (in most cases, this is the ext2
  146.    file system).
  147.    
  148.    However, there are certain items that appear to be difficult to set up
  149.    properly as modules, so I would recommend the following be compiled
  150.    into the kernel:
  151.    
  152.        
  153.        
  154.      * Ethernet hardware drivers.
  155.        
  156.        
  157.      * SCSI CD-ROM drivers.
  158.        
  159.    
  160.    
  161.    On the other hand, there are certain driver combinations that ONLY
  162.    work as modules, especially combinations of two or more of the
  163.    following group:
  164.    
  165.        
  166.        
  167.      * A Parallel Printer,
  168.        
  169.        
  170.      * A Parallel Port drive, such as the IOMEGA ZipDrive or JazzDrive,
  171.        or the BackPack CD-ROM drive, and
  172.        
  173.        
  174.      * The PLIP Daemon.
  175.        
  176.    
  177.    
  178.    You will need to decide what you are compiling into the kernel, and
  179.    what as modules, but should take the above points into consideration.
  180.    The actual choices are made during the compilation, by the second of
  181.    the following sequence of instructions:
  182.    
  183.    
  184.  
  185.    cd /usr/src/linux
  186.    make menuconfig
  187.    make dep clean modules modules_install zImage
  188.  
  189.  
  190.    
  191.    
  192.    Having done that, the module dependencies need to be mapped out. This
  193.    is done with the following command:
  194.    
  195.    
  196.  
  197.    depmod -a
  198.  
  199.  
  200.    
  201.    
  202.    The new kernel now needs to be inserted in the boot chain. I am
  203.    assuming the reader is using LILO for this purpose, since this is the
  204.    only loader I have any experience with.
  205.    
  206.    I recommend that one does NOT automatically insert the newly compiled
  207.    kernel as the default Linux kernel since if it should fail, it is then
  208.    extremely difficult to recover one's Linux setup without doing a
  209.    complete reinstallation, which is not to be recommended. For this
  210.    reason, I have the following entry in my /etc/lilo.conf file:
  211.    
  212.    
  213.  
  214.    image=/usr/src/linux/arch/i386/boot/zImage
  215.       label=new
  216.       alias=n
  217.       read-only
  218.       vga=ask
  219.       optional
  220.  
  221.  
  222.    
  223.    
  224.    This entry says that there is an OPTIONAL boot option (which will be
  225.    ignored if the image in question does not exist) which boots the file
  226.    /boot/newlinux if selected, and allows one to select the video mode it
  227.    is to be booted in.
  228.    
  229.    Assuming the existence of the above entry in /etc/lilo.conf the
  230.    revised kernel is already correctly located at the end of compilation,
  231.    and it can be installed via the following command:
  232.    
  233.    
  234.  
  235.    lilo
  236.  
  237.  
  238.    
  239.    
  240.    Having done that, the reader needs to follow the further steps
  241.    relevant to their selected distribution, as follows:
  242.    
  243.      * Configuring Debian or RedHat for modules
  244.      * Configuring Slackware for modules
  245.      * Configuring other distributions for modules
  246.        
  247.    
  248.    
  249.    
  250.      _________________________________________________________________
  251.    
  252.    
  253.    
  254. Configuring Debian or RedHat for Modules
  255.  
  256.    
  257.    
  258.    Prior to carrying out the steps listed here, the steps listed in
  259.    Recompiling the kernel for modules are assumed to have been carried
  260.    out.
  261.    
  262.    The Debian and RedHat distributions have identical boot procedures, so
  263.    also have identical procedures for configuring modules into them.
  264.    
  265.        
  266.     1. Having logged in as root, use your favourite text editor to create
  267.        a new file called _/etc/rc.d/init.d/modules.init_ with the
  268.        following contents therein:
  269.        
  270.  
  271.    # Modules initialisation.
  272.    #
  273.    # Start up the module auto-loading daemon.
  274.    /sbin/kerneld
  275.  
  276.    # Mount all currently unmounted auto-mounted partitions.
  277.    /sbin/mount -a
  278.    
  279.        
  280.     2. Having created the above file, perform the following steps whilst
  281.        logged on as root:
  282.        
  283.  
  284.    cd /etc/rc.d
  285.    chmod 755 init.d/*
  286.    cd rc3.d
  287.    ln -s ../init.d/modules.init 05modules.init
  288.  
  289.    
  290.    
  291.    The system can now be rebooted, and on doing so, it will be found that
  292.    modules are fully implemented
  293.    
  294.    
  295.      _________________________________________________________________
  296.    
  297.    
  298.    
  299. Configuring Slackware for Modules
  300.  
  301.    
  302.    
  303.    Prior to carrying out the steps listed here, the steps listed in
  304.    Recompiling the kernel for modules are assumed to have been carried
  305.    out.
  306.    
  307.        
  308.     1. The file _/etc/rc.d/rc.M_ needs to be edited as follows:
  309.         
  310.             
  311.          1. Around line 18, there is a section reading as follows:
  312.             
  313.  
  314.    # Screen blanks after 15 minutes idle time.
  315.    /bin/setterm -blank 15
  316.         
  317.             
  318.             Immediately after this, insert the following paragraph, with
  319.             the usual blank lines either side of it:
  320.             
  321.  
  322.    # Load the kernel module auto-loader.
  323.    /sbin/kerneld
  324.         
  325.             
  326.          2. About 12 lines further down is the following:
  327.             
  328.  
  329.    # if there is no /etc/HOSTNAME, fall back on this default:
  330.         Immediately prior to this, insert the following paragraph, again
  331.             with the usual blank lines either side of it:
  332.             
  333.  
  334.    # Mount remaining unmounted auto-mount drives.
  335.    /sbin/mount -a
  336.    
  337.        
  338.        When those changes have been made, save the file.
  339.        
  340.    
  341.    
  342.    No further modifications are required for Slackware.
  343.    
  344.    
  345.      _________________________________________________________________
  346.    
  347.    
  348.    
  349. Configuring other distributions for Modules
  350.  
  351.    
  352.    
  353.    Prior to carrying out the steps listed here, the steps listed in
  354.    Recompiling the kernel for modules are assumed to have been carried
  355.    out.
  356.    
  357.    The precice procedure for other distributions has not been
  358.    ascertained, but is probably one of the above. To determine which one,
  359.    display a directory of the contents of the _/etc/rc.d_ directory, as
  360.    follows:
  361.    
  362.  
  363.    cd /etc/rc.d
  364.    ls -l *.d rc.*
  365.  
  366.    
  367.    
  368.    From this resulting display, you can select one of the following three
  369.    options:
  370.    
  371.        
  372.     1. If this list includes a directory named _init.d_ and some
  373.        directories with names matching _rc?.d_ where the question mark is
  374.        replaced by single digits, and does _NOT_ include a file with the
  375.        name _rc.M_, that distribution can be configured for modules by
  376.        following the procedure listed above for the Debian and RedHat
  377.        Distributions.
  378.        
  379.     2. If this list does not include a directory named _init.d_ but
  380.        includes a file named _rc.M_ then that distribution can be
  381.        configured for modules by following the procedure listed above for
  382.        the Slackware distribution.
  383.        
  384.     3. If this list matches neither of the above criteria, then the
  385.        distribution has a boot script not covered by this HowTo. In that
  386.        case, you are invited to contact the author of this document for
  387.        advice.
  388.        
  389.    
  390.    
  391.    
  392.      _________________________________________________________________
  393.    
  394.    
  395.    
  396. Copyright and other Legalities
  397.  
  398.    
  399.    
  400.    This document is covered by the terms of the GNU General Public
  401.    Licence (GPL), and all terms and limitations therein apply.
  402.    
  403.    The author may be contacted by email at rhw@bigfoot.com. 
  404.