Kernel Modules

Team-Fly    

Solaris™ Operating Environment Boot Camp
By David Rhodes, Dominic Butler
Table of Contents
Chapter 21.  Kernels and All About Them


We saw at the beginning of the chapter that the kernel deals with all hardware communication and it does this by the means of system calls. But how does the kernel know how to talk to so many different hardware devices, and what happens when a new device that it doesn't know about is added?

The answer is found in the heading of this section. Kernel modules provide the kernel with all the information it needs to be able to talk to a specific type of device. This information includes how to open and close the device, how to read from and write to it, and how to configure and control it. Because there are so many different devices available and only a fraction of them would ever be connected to any given Sun computer, the information is provided in the form of individual modules that can be loaded into the kernel (usually at boot-time, but not exclusively) or unloaded as required. Originally, the kernel had to be recompiled to add a new module, but now (and for some time) it was possible to load and unload modules while the system is actually running, although it would normally be done at boot-time.

The kernel modules are located in the directory /kernel/drv. Each module usually consists of two files: a binary file (which is the actual driver for the hardware) and a configuration file (which allows the device to be easily configured). For example, if we purchased a Quad Fast Ethernet (qfe) Card we would need to load the qfe module into the kernel to be able to use it. The module would include a driver called qfe and a configuration file called qfe.conf. Editing the qfe.conf file allows us to set such attributes as the transmission speed and whether the card should run in full- or half-duplex mode.

We can see the modules we have loaded by using the modinfo command:

 hydrogen# modinfo <lines removed for clarity>  95 f5aee750    e53  24   1  pts (Slave Stream Pseudo Terminal dr)  96 f5b11eb0   163b  14   1  ptem (pty hardware emulator)  97 f5a0f994   1972  15   1  telmod (telnet module)  98 f5ab8294   1ad8   4   1  logindmux ( LOGIND MUX Driver)  99 f5aef2dc    858  72   1  ksyms (kernel symbols driver) 100 f6101000   29de  88   1  devinfo (DEVINFO Driver 1.24) hydrogen# 

Modules can be loaded into the kernel using modload and unloaded using unloadmod while the system is running (see the man pages), but this is not usually required as modules are automatically loaded as soon as any program tries to access any device that is controlled by one. It is also possible to force the system to load a kernel module at boot-time; this is done by updating the file /etc/system.


    Team-Fly    
    Top
     



    Solaris Operating Environment Boot Camp
    Solaris Operating Environment Boot Camp
    ISBN: 0130342874
    EAN: 2147483647
    Year: 2002
    Pages: 301

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net