6.5 Specifying Modules to be Loaded at Boot Time

The following lines in /etc/rc.sysinit defines how the init process runs scripts in the /etc/sysconfig/modules directory at boot time:

# Load other user-defined modules
for file in /etc/sysconfig/modules/*.modules ; do
  [ -x $file ] && $file
done

To load a module at boot time:

  1. Create a file in the /etc/sysconfig/modules directory. The file name must have the extension .modules, for example foo.modules.

  2. Edit the file to create the script that loads the module.

    The script to load a module can be a simple modprobe call, for example:

    #!/bin/sh
    modprobe foo

    or more complex to include error handling:

    #!/bin/sh
    if [ ! -c /dev/foo ] ; then
      exec /sbin/modprobe foo > /dev/null 2>&1
    fi
  3. Use the following command to make the script executable:

    # chmod 755 /etc/sysconfig/modules/foo.modules