Generic kernel: hardware and loading the right modules
I've asked this on IRC and the forums, but I'm not getting any further.
Maybe I'm asking the wrong question or misunderstanding the few replies
I get, but allow me to pose my question on the mailing list as well.
Over the last few years, I have been compiling kernels for well-defined
sets of hardware, i.e. the systems I myself was working on. The items
and devices I knew I had and needed were compiled in-kernel, some
optional things as modules (that is, the more "functional" modules like
file systems or support for Ethernet bridging, not the "hardware"
modules). I knew about udev, and primarily thought of it as the program
that could enforce persistent naming, heck, it could even rename network
interfaces from the standard eth0 to something more meaningful. How
I recently found myself in a new and unexplored situation: I needed a
generic kernel/module combination (precompiled) that would work on a
variety of hardware in the x86 architecture, and especially a way to
load the right modules. I always assumed there would be some kind of
magic at work, but I guess there isn't.
First idea: genkernel. Never used it before, but it seemed to work ok.
The initrd generated by genkernel works with busybox's mdev. The net
effect seems to be that every driver module (I noted IDE and SATA
chipsets I never even heard of) in the initrd is loaded, relevant or
not, and stays loaded. Ok, that'll probably work, but why bother
creating modules, if I still use them all. And sure, I could unload most
of them, but I don't want to bother my users with that. And it seems
kind of inefficient, I mean, I wouldn't expect a 2009 Linux system to
work like that.
Second idea: manual initramfs creation. Very insightful and a
recommended exercise. Problem: I have no idea how to handle the loading
of modules the way I want. Questions: Should I use udev instead of mdev
in the initrd? Would that make a difference? Why doesn't genkernel use
udev too then? Does udev do any module loading or does it just act upon
device file creation (meaning the relevant module is already loaded)?
Somebody on IRC coined the term "hotplug", but the hotplug ebuilds have
version names beginning with 2004. The elogs of those ebuilds talk about
modules loaded at boot (yay!) and something called "coldplug", but
coldplug is blocked by recent udev versions (aww!). So maybe udev does
have the capability of loading relevant modules?
Maybe I'm expecting too much, maybe I'm confusing device drivers with
the genericity of what a module is, maybe I haven't read the right man
pages or googled the right keywords. I would just really like someone to
give me a clear explanation :-)