Drivers in Linux


What to do with static drivers, module drivers, append=, and insmod.

Drivers in Linux can take on two forms:

  • Built in statically
  • Built as a module
  • Driver Built in Statically:

    Any drivers that are built in statically in the kernel are always loaded. This means that this causes the total amount of memory the kernel uses to be greater than a kernel with those same drivers built in as a module. It is ok to have some drivers built in statically and others built in as modules.

    Driver Built as a Module:

    Drivers built in as a module are able to be loaded when needed and unloaded when not needed. This conserves the amount of memory that the entire kernel needs. It is ok to have some drivers built in statically and others built in as modules.

    Initrd:

    An initrd is an initial ramdisk. If you have your SCSI drivers loaded as a module then you need an initrd in order to boot your system. An initrd is not usually required for an IDE system. If your SCSI drivers are built in statically to the kernel, then an initrd isn’t required.

    Passing parameters to drivers built in statically in the kernel:

    If you need to pass parameters to a driver that is built in statically in the kernel, then there are two locations to do this:

  • At the LILO boot prompt
  • In an append= line in /etc/lilo.conf
  • Note: A driver built in statically will never look in /etc/conf.modules for parameters. Any parameters put there for a static driver will not be read.

    Passing parameters to drivers built as a module:

    If you need to pass parameters to a driver built as a module, then there are two ways to do this.

  • in /etc/conf.modules
  • as part of the insmod string
  • Normally you will put parameters to be passed to driver modules into /etc/conf.modules. Then when the driver tries to load, it reads that file and processes those parameters.

    If you are loading a modular driver manually, then you can either put the correct parameters in /etc/conf.modules or include it as part of the insmod string.

    Note: A driver built in as a module will never read the LILO boot prompt, nor the append= lines for parameters. Any parameters put there for the moduler driver will not be read.

    Notes about Parameters:

    Quite often parameter names will change based on the fact if it is for a static driver or a modular driver. Here is one example of how the parameter names differ:

    cpqarray/smart2 as a module:
    eisa=0x5000

    cpqarray/smart2 built in staticaly:
    smart2=0x5000


    Real Life Examples of modular/static:

    Cpqarray/smart2 loaded as a module:

  • cpqarray/smart2 built as a module
  • correct initrd exists
  • /etc/conf.modules should look like the following:
  • alias scsi_hostadapter cpqarray
    options cpqarray eisa=0x6000
    

    Cpqarray/smart2 built in statically:

  • cpqarray/smart2 built in statically
  • no initrd needed
  • append= line added to /etc/lilo.conf. Sample /etc/lilo.conf:
  • boot=/dev/ida/c0d0p1
    map=/boot/map
    install=/boot/boot.b
    prompt
    timeout=50
    default=linux
    
    image=/boot/vmlinuz-2.2.12-20
            label=linux
            root=/dev/ida/c0d0p6
            initrd=/boot/initrd-2.2.12-20.img
            append="smart2=0x5000 mem=48M"
            read-only
    
    other=/dev/ida/c0d0p3
            label=scu
            table=/dev/ida/c0d0
    

    Note the append= line, we put smart2= which is the correct format for the smart2 driver. Also note we put mem=48M, on most EISA systems, you would need to specify the amount of memory in the system in order to get more than 16MB of memory recognized.

    Leave a Comment

    This site uses Akismet to reduce spam. Learn how your comment data is processed.