# Do I need to load modules? Which ones?

## GetLinux

Gentoo Installation & Current Environment:

tarball:  stage3-i686-2005.1.tar.bz2

kernel:  2.6.13-gentoo-r5

i686

Intel Celeron Coppermine Processor 32k/128k

chipset:  i810

hard disk:  30GB, 5400rpm

 ---------------------------------------------------------------

I edited "make.conf", installed the kernel, did "make menuconfig" (after using lspci to get system info) and "make && make modules_install". I installed the kernel and copied the kernel configuration to a backup file as instructed in the handbook. But I am lost (or maybe not) about Configuring Kernel Modules.

The handbook says to list any modules I want to auto-load in "/etc/modules.autoload.d/kernel-2.6", and that I might want to view all available modules.

```
find /lib/modules/2.6.13-gentoo-r5/ -type f -iname '*.o' -or -iname '*.ko'
```

brought up a list of modules.

The handbook says to build things into the kernel where possible, which I did. The thing is, I'm not sure I need to install any modules. Am I in error thinking that? There are a couple things that either I don't know what they are, or I don't remember if they were in "menuconfig". 

Modules in "/lib/modules/2.6.13-gentoo-r5/kernel/"

(Paths are relative. I'm leaving out anything regarding "scsi" because I don't have scsi hard drives!)

/lib/libcrc32c.ko

/net/ipv4/netfilter/ipt_NOTRACK.ko

/net/ipv4/netfilter/iptable_raw.ko

/drivers/net/s2io.ko

/drivers/net/dummy.ko

/drivers/usb/misc/phidgetservo.ko

/drivers/usb/input/touchkitusb.ko

/drivers/acpi/ibm_acpi.ko

/drivers/acpi/video.ko

Do I actually need any of these modules?

----------

## guduri

If you are sure that you built in all the modules required into the kernel you dont need to add anything to the autoload file. But I would doubt if you could build everything into the kernel. There would be some which you might have to add to the autoload file.

Try and see what modules you might need by doing an lsmod when you boot of the installation cd. From the list of modules add the modules you could not build into the kernel to the autoload file.

----------

## GetLinux

 *guduri wrote:*   

> Try and see what modules you might need by doing an lsmod when you boot of the installation cd. From the list of modules add the modules you could not build into the kernel to the autoload file.

 

There is no overlap between "lsmod" and the list of available modules from "/lib/.../kernel/". I guess that means I'm all set?

What about the "ipt_NOTRACK.ko" and "iptable_raw.ko", though? Are these needed for anyone to access the Internet? Or is that just for certain things?

----------

## guduri

Those are if you want to use iptables on the machine running gentoo to enable a firewall and control the rules for the firewall.

----------

## yak.skylark

just one question - did you biuld your kernel with "modules autoloading" support?

in that case you can just leave the "autoload" file empty - since all required modules will be automatically inserted, when their functionality is needed.

the only case you really need to autoload stuff is when concearning (sorry, my "russian" english sucks) the boot process - like NIC driver module an so on ...

 *Quote:*   

> The handbook says to build things into the kernel where possible

 

well, this is for speed gain - 'cause the overhead of the module loader will not be present (but i have never noticed any difference)

my advice is to build in everything you constantly use - like hard drive, NIC, mouse, etc. Everything else, that you use seldom you could just build as modules. This is for keeping the kernel "as small as possible" most of the time.

PS

just for some sick kind of fun i once tried to build the kernel with EVERYTHING build in - and ended up with "no space left" error - 2.5 G was not enouth for the build process

----------

## GetLinux

 *yak.skylark wrote:*   

> just one question - did you biuld your kernel with "modules autoloading" support?

 

I don't think so. I don't see that under the list of available USE flags, nor in USE= in "make.defaults", nor in USE= in "make.conf". Not unless it is a default somewhere other than those .conf files.

----------

## GetLinux

 *guduri wrote:*   

> Those are if you want to use iptables on the machine running gentoo to enable a firewall and control the rules for the firewall.

 

So I can't run a firewall without these ("ipt_NOTRACK.ko" and "iptable_raw.ko")?

----------

## guduri

I think that is the case if you have used genkernel.

----------

## GetLinux

 *guduri wrote:*   

> I think that is the case if you have used genkernel.

 No, I didn't use genkernel.

I'm sorry, were you referring to the "modules autoload"???

<EDIT> No, nevermind, you were referring to the firewall issue.   :Wink: 

----------

## GetLinux

 *yak.skylark wrote:*   

> just one question - did you build your kernel with "modules autoloading" support?

 

After reading an answer to a related post of mine, I found out I can read the backup copy of the configuration file that the handbook recommend I save in /boot. I don't even see an option for anything regarding "autoloading" in there, but here is what's in there:

```
# Loadable module support

#

CONFIG_MODULES=y

# CONFIG_MODULE_UNLOAD is not set

CONFIG_OBSOLETE_MODPARM=y

# CONFIG_MODVERSIONS is not set

# CONFIG_MODULE_SRCVERSION_ALL is not set

CONFIG_KMOD=y
```

That is the end of the section regarding modules. This is the copy of the configuration file generated by "make menuconfig".

----------

## sundialsvc4

As you know, a "kernel module" is an external file that can be loaded into the kernel, to become "fully part of the kernel" until (and if) it is unloaded again.  Now, indeed why might we wish to use kernel modules .. or, wish not to?

(1) "Distros" use modules, loaded before the kernel actually boots (by an "initial ramdisk," or "initrd") to provide the flexibility needed to get a "stock," pre-compiled kernel quickly running on "any" machine, no matter what actual hardware may be installed.  The initial-ramdisk contains a program that looks over the hardware, loads modules needed to make it possible to boot on this hardware, and then finishes booting Linux.  "Distros" (and LiveCDs) commonly have dozens of modules that ("DECSystem token-ring interface card model R2-D2, anyone?") probably will never be used.

(2) Modules needed to run the hardware, but not to boot it can be put into an autoload file.  They are loaded before the system finishes the complete startup procedure...  but much later in the process than (1).  

(3) Modules needed to run occasionally-used equipment can be explicitly loaded at your request, or requested by the system itself with the "modules autoloading" kernel feature.  (Some part of the system discovers that it needs a module but doesn't have it, so a daemon called kerneld or kmod goes out and loads it.  Another procedure can "sweep" now-unused modules out of memory again.

(4) Modules are used for cryptography, for firewall features, and other things where there are several options to choose from, and the desire is to reduce the amount of unused material that gets loaded into kernel-space; to be able to load only those options that you've actually decided to use.  (For example, you can use (say) the CAST cipher in a secure internet connection, but if you never do ... if (say) you only use 3DES, then "why load CAST?")

(5) Kernels that need to run on all the various computers in a business might be an excellent candidate for using modules, because you can prepare them with all of the device-support that "might be needed anywhere in the shop," and the proper set of modules will be selected upon startup for each actual computer.  Much as "distro" writers do, and for the same reasons...

----------

## GetLinux

Thanks, but how do I find out if "modules autoload" has even been configured?

I didn't see it as an option in the configuration menu that results from "make menuconfig", but then I didn't read every option. I followed the handbook recommendations and did a quick look-see to make sure there wasn't anything else I wanted to enable. The name-value pairs that appear in the backup copy of the configuration file seem to indicate it wasn't an option as well.

Do you know if "modules autoload" maybe is built into the kernel already?

If I need to specifically enable "modules autoload" and re-compile the kernel, is it in that menu, or if not, how do I specify it?

----------

## pjp

Moved from Installing Gentoo

----------

## GetLinux

(bump)

----------

## nichocouk

I would guess that the right option for Module autoload is 'Enable loadable module support', which is CONFIG_MODULES, so yes, you have enabled it.

----------

## GetLinux

 *nichocouk wrote:*   

> I would guess that the right option for Module autoload is 'Enable loadable module support', which is CONFIG_MODULES, so yes, you have enabled it.

 

Thank you.

OK, so I'll need to either emerge those 2 modules seperately or compile them into my kernel. Is there any difference in performance (how fast your firewall loads after system startup)?

----------

