LINUX MODULES INSTALLATION MINI-HOWTO Contents * Purpose of this document * Pre-requisites * Recompiling the kernel for modules * Configuring Debian or RedHat for modules * Configuring Slackware for modules * Configuring other distributions for modules * Copyright and other Legalities _________________________________________________________________ Purpose of this document My experience with Linux and modules has been that the existing documents fail to provide a satisfactory explanation as to how to successfully set up Linux with modules configured and working. The procedure explained in this document has been successfully used several times, both on my own system and over the Internet to give directions to somebody trying to get some feature to work which requires a driver supplied only in module form. My own system runs from a RedHat 4.2 distribution of Linux, and it was on this setup that I developed the procedure. I have since successfully installed it on systems running from various Slackware distributions, and on one system running from a Debian distribution, and the necessary procedure to correctly configure modules under Linux in all three is documented herein. _________________________________________________________________ Pre-requisites * Before the steps in this document can be applied, the reader MUST have a working Linux installation in which one can get to the Linux prompt as user root since the majority of the steps involved can only be undertaken by the said user. * The existing kernel may be compiled either to use modules or not to use modules, and can even display error messages during the boot-up procedure as a result of modules being configured which aren't available at the moment, providing the above condition is met. * The source tree for the current kernel is assumed to be found rooted at /usr/src/linux and that is also assumed to be the current directory throughout this document at the start of any sequence of commands to be issued. _________________________________________________________________ Recompiling the kernel for modules The kernel needs to be reconfigured to use modules for everything other than the file system mounted as root (in most cases, this is the ext2 file system), and should then be recompiled. The following sequence appears to work best: cd /usr/src/linux make menuconfig make dep make clean make modules make modules_install make zImage Having done that, the module dependencies need to be mapped out. This is done with the following command: depmod -a The new kernel now needs to be inserted in the boot chain. I am assuming the reader is using LILO for this purpose, since this is the only loader I have any experience with. I recommend that one does NOT automatically insert the newly compiled kernel as the default Linux kernel since if it should fail, it is then extremely difficult to recover one's Linux setup without doing a complete reinstallation, which is not to be recommended. For this reason, I have the following entry in my /etc/lilo.conf file: image=/boot/newlinux label=new alias=n read-only vga=ask optional This entry says that there is an OPTIONAL boot option (which will be ignored if the image in question does not exist) which boots the file /boot/newlinux if selected, and allows one to select the video mode it is to be booted in. Assuming the existence of the above entry in /etc/lilo.conf the revised kernel can be installed via the following two steps: cp arch/i386/boot/vmimage /boot/newlinux lilo Having done that, the reader needs to follow the further steps relevant to their selected distribution, as follows: * Configuring Debian or RedHat for modules * Configuring Slackware for modules * Configuring other distributions for modules _________________________________________________________________ Configuring Debian or RedHat for Modules Prior to carrying out the steps listed here, the steps listed in Recompiling the kernel for modules are assumed to have been carried out. The Debian and RedHat distributions have identical boot procedures, so also have identical procedures for configuring modules into them. 1. Having logged in as root, use your favourite text editor to create a new file called _/etc/rc.d/init.d/modules.init_ with the following contents therein: # Modules initialisation. # # Start up the module auto-loading daemon. /sbin/kerneld # Mount all currently unmounted auto-mounted partitions. /sbin/mount -a 2. Having created the above file, perform the following steps whilst logged on as root: cd /etc/rc.d chmod 755 init.d/* cd rc3.d ln -s ../init.d/modules.init 05modules.init The system can now be rebooted, and on doing so, it will be found that modules are fully implemented _________________________________________________________________ Configuring Slackware for Modules Prior to carrying out the steps listed here, the steps listed in Recompiling the kernel for modules are assumed to have been carried out. 1. The file _/etc/rc.d/rc.M_ needs to be edited as follows: 1. Around line 18, there is a section reading as follows: # Screen blanks after 15 minutes idle time. /bin/setterm -blank 15 Immediately after this, insert the following paragraph, with the usual blank lines either side of it: # Load the kernel module auto-loader. /sbin/kerneld 2. About 12 lines further down is the following: # if there is no /etc/HOSTNAME, fall back on this default: Immediately prior to this, insert the following paragraph, again with the usual blank lines either side of it: # Mount remaining unmounted auto-mount drives. /sbin/mount -a When those changes have been made, save the file. No further modifications are required for Slackware. _________________________________________________________________ Configuring other distributions for Modules Prior to carrying out the steps listed here, the steps listed in Recompiling the kernel for modules are assumed to have been carried out. The precice procedure for other distributions has not been ascertained, but is probably one of the above. To determine which one, display a directory of the contents of the _/etc/rc.d_ directory, as follows: cd /etc/rc.d ls -l *.d rc.* 1. If this list includes a directory named _init.d_ and some directories with names matching _rc?.d_ where the question mark is replaced by single digits, and does _NOT_ include a file with the name _rc.M_, that distribution can be configured for modules by following the procedure listed above for the Debian and RedHat Distributions. 2. If this list does not include a directory named _init.d_ but includes a file named _rc.M_ then that distribution can be configured for modules by following the procedure listed above for the Slackware distribution. 3. If this list matches neither of the above criteria, then the distribution has a boot script not covered by this HowTo. In that case, you are invited to contact the author of this document for advice. _________________________________________________________________ Copyright and other Legalities This document is covered by the terms of the GNU General Public Licence. The author may be contacted by email at rhw@bigfoot.com.