-->
Previous Table of Contents Next


Using Kernel Modules

The kernels used in Slackware are designed to support the hardware needed to get Linux installed. Once you’ve installed and rebooted your system, you may find that your kernel lacks support for some of your hardware, such as a CD-ROM drive or Ethernet card. In this case, there are a couple of ways you can add this support. The traditional way would be to compile a custom Linux kernel that includes drivers for all your hardware. This requires that you have the Linux source code and C compiler installed and that you know exactly which options need to be compiled into your kernel. In short, compiling a custom kernel can be a rather difficult task for Linux beginners.

Kernel modules to the rescue! If you’ve installed device drivers before on MS-DOS, you’ll probably find this a familiar way of adding support—just think of the module configuration file /etc/rc.d/rc. modules as being the Linux counterpart of DOS’s CONFIG.SYS file. To add support for new hardware, you need to edit the file and uncomment the lines that load the needed support. As an example, let’s look at the section of the file used to load CD-ROM support, as shown in Figure 2.5.


# These modules add CD-ROM drive support. Most of these drivers will probe

# for the I/O address and IRQ of the drive automatically if the parameters

# to configure them are omitted. Typically the I/O address will be specified

# in hexadecimal, e.g.: cm206=0x300,11

#

#/sbin/modprobe aztcd aztcd=<I/O address>

#/sbin/modprobe cdu31a cdu31a_port=<I/O address> cdu31a_irq=<interrupt>

#/sbin/modprobe cm206 cm206=<I/O address>,<IRQ>

#/sbin/modprobe gscd gscd=<I/O address>

#/sbin/modprobe mcd mcd=<I/O address>,<IRQ>

#/sbin/modprobe mcdx mcdx=<I/O address>,<IRQ>

#/sbin/modprobe optcd optcd=<I/O address>

# Below, this last number is "1" for SoundBlaster Pro card, or "0" for a clone.

#/sbin/modprobe sbpcd sbpcd=<I/O address>,1

#/sbin/modprobe sonycd535 sonycd535=<I/O address>

#/sbin/modprobe sjcd sjcd=<I/O address>

Figure 2.5 A section of the /etc/rc.d/rc.modules file.

You’ll notice that each of the lines starts with #. In most Linux configuration files, any line beginning with # is ignored, much like lines in DOS configuration files that begin with REM. To activate support for one of these devices, you’ll need to remove the # from the beginning of the line and edit the line to include any extra information about your hardware needed by the kernel module. For example, if your machine needs support for a SoundBlaster CD-ROM drive on port 0x300, you’d need to edit the line for sbpcd support so that it looks like this:


     /sbin/modprobe sbpcd sbpcd=0x300,1

Then, the next time you boot your machine, the sbpcd module will be loaded, and you’ll be able to use your drive. Drivers for nearly every device supported by Linux can be added in a similar fashion.


NOTE:  If you use kernel modules and decide later to upgrade your kernel, you’ll need to upgrade your kernel modules as well. When configuring the kernel, select M instead of Y to build selected drivers as kernel modules instead of building them into the kernel. Once you’ve compiled your kernel with:

make dep ; make clean ; make zImage

you can compile and install the kernel modules with the command:


make modules ; make modules_install

The modules will be installed in a directory named for the running kernel—if you’re running Linux 2.0.0, you’ll find them under /lib/modules/2.0.0.


Looking for Help

Most UNIX systems have an online-manual page system, and Linux is no exception. You can use the man command to summon information about specific commands:


     darkstar:~# man man

Online-manual pages aren’t organized by topic; they’re organized by specific command.


NOTE:  There are other informational sources included with the Linux operating system. They’ll be discussed in Chapter 5.

Shutting Linux Down

Like any good UNIX, Linux responds to the shutdown command. You’ll need to provide it with a command-like parameter and an amount of time to wait before actually shutting the system down. This may seem odd if you’re used to working alone on a PC, but the shutdown command is usually saved for serious shutdowns, as most UNIX installations support many users and rarely shutdown. In fact, you must be logged in as root in order to use the shutdown command. Use the following command line:


     $ shutdown -r now

This shuts down the system immediately.


WARNING:  Don’t just turn off the power to turn off a Linux system. This can cause damage to important files.

An alternative method of shutting down Linux is the old tried-and-true PC Ctrl-Alt-Del sequence, which is used to reboot a system. When running Linux, this sequence performs the same functions as shutdown -r now. When the PC cycles to reboot, simply turn it off. Despite what others may claim, this is a perfectly acceptable way to shutdown a Linux system.


Previous Table of Contents Next