Kernel compilation - detecting hardware - in the box vs. out
I was thinking about compiling your own Linux kernel and the choices
it gives you between compiling a feature into the kernel and compiling
it as a module which gets loaded by hotplugging. The way I would like
it to work for my system is the following:
1) If a driver is for a device that's inside my computer, I want it to
be compiled directly into the kernel.
2) If a driver is for a device that normally goes inside your
computer, but is not inside my computer, don't compile it at all.
3) If a driver is for an external device (such as a USB device),
compile it as a module, whether the device is currently connected to
the computer or not. This way any time someone wants to use a
Linux-supported external device on my computer, they can do so without
any configuration.
Now, I could do all this manually (and indeed I have kind of done so).
But it would be very convenient if there was some kind of hardware
detection program or script to do it for me. Now, I've never written
a hardware detecting program, so maybe such a program wouldn't be able
to tell the difference between an internal and external device. If
not, I think it would still be possible - there would just have to be
a "database" somewhere of each kernel symbol and whether it's a symbol
for an internal device, external, or neither.
I know many distributions automatically detect your hardware during
the installation process, but Mandrake, and I suspect most of the
major distributions, already have a compiled kernel containing
virtually every device you could possibly want to use compiled as a
module. Basically, I don't need the modules for every sound card in
existence on my computer. I think it would be much better if the
installation process compiled a custom kernel during installation
based on my hardware.
Of course, this means that whenever I open up my computer and change
something I'll have to do some re-compilation. That doesn't really
bother me, though, and if the process was automated it wouldn't be
much of a problem at all (heck, I bet it could detect at start-up
whether the hardware in your computer has changed).
Does anyone know of a program or script that already does something
like this, or a distribution that already compiles a custom kernel
based on the hardware of the computer it's being installed on?
|