12. Kernel devices

If it works, it works. If it doesn't ...

To make the eth0 device work, the kernel must be able to drive the ethernet card. If you have two, you may need to pick which is which.

Kernel configuration is simple, but very configurable. If you don't want a driver you exclude it for the compilation. Drivers exist for TCP/IP itself, ne2000 eth cards (and many others), slip, ppp, serial, ...

As well as including or excluding drivers, most drivers can be made as modules. This is a very exciting feature of Linux, that is NOT (yet) available on much more expensive SVR4 boxes. IE you can re-compile a module and reload it, without rebooting.

A module, is a kernel driver, loaded by running the command "insmod driver.o" before you need it. Of course you must have compiled the driver, and placed it where kerneld will find it. Normally you don't use "insmod", but allow kerneld to load it automatically for you.

12.1 compiling the kernel and modules
12.2 /sbin/kerneld
12.3 /etc/conf.modules

12.1

compiling the kernel and modules

If you have an old 1.2.13 kernel you should consider (you don't have to) upgrading to a recent kernel, eg 2.0.0 or more recent. You will also need the associated modules packages (1.3.69f ++), and the recent ppp-2.2.0f (++) package. Other upgrades may be necessary such as lilo, libc and gcc. See the README's in the /usr/src/linux tree, look in linux/Documentation/Changes.

When you have these installed, you have to rebuild the kernel deselecting the devices you don't have, and making modules of the ones you can load from disk.

cd /usr/src/linux
make clean
make menuconfig		# answer all the questions
make dep
make install		# or zlilo # see Issue-1
make modules
make modules_install
depmod -a
You have to run depmod -a with the new kernel running (or same version numbers), so two reboots may be necessary.

You have to have /sbin/kerneld somewhere, such as /etc/rc.d/rc.S, so that it is loaded before you attempt to load the eth0 module.

You have to have edited /etc/conf.modules, so that kerneld knows that the "eth0" module (which is an alias) is really the ne.o module (NE2000), and has parameters such as the IO_PORT address.

kerneld also loads the ppp0 devices, as well as drivers for (well almost anything). If these don't have parameters that need setting, ( such as IO_PORT) they won't be listed in /etc/conf.modules. Use lsmod to list those currently loaded.

The modules get placed in /lib/modules/2.0.0/. where kerneld or insmod can find them.

12.2

/sbin/kerneld

The kernel can detect when a call is made to a module that isn't loaded (or doesn't exist). If you have started kerneld (before it is needed), that module will get automatically loaded. when it is first accessed.

This has three main advantages; firstly it saves having to type insmod into a script somewhere. Secondly it allows better memory management, a driver isn't loaded if you don't need it. Thirdly it allows boot disks to load strange drivers as required. (As long as the driver isn't on a disk that needs the driver to be readable!)

/sbin/kerneld has to be started, eg in /etc/rc.d/rc.S

12.3

/etc/conf.modules

Here is mine, which tells kerneld to load the NE2000 driver when using eth0. It tells it to use IO_ADDR 0x300 (which used to be in /etc/lilo.conf). IRQ-12 gets groped by the driver.

# This is an example of additional definitions you can put in /etc/conf.modules
# Note that modprobe has some default aliases built in ("modprobe -c").
# The built-in aliases will be overridden by any definitions in this file.

alias eth0 ne
options ne io=0x300

# alias eth1 de620
# options lp irq=7 

Other modules, such as isofs.o (a filesystem driver), don't need to be listed here, because they don't need extra parameters, or aliases.

<-! lines starting ' fail sgml2text ->