Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Maybe it's newbie question but it doesn't want to leave me alone. Question concerning build of kernel.
Why is kernel built that way that you have to choose devices it will control and then compile it and then you can't change anything in it?.
(Unless you compile it again). What are advantages and disadvantages of such build?. Why isn't it like in Windows (I'm not saying that it's better, I just don't know) that you can install new device without necessity of rebuilding kernel?. Is this related to stability issues?.
You can build the kernel the "Windows way", and include lots of drivers for everything you can think of. Especially if you use modules for the drivers, there's not much reason why you shouldn't do that. Most distros do this already - I've never had to compile a kernel for Debian, for instance.
Why not to do it this way? Some people like their software small and neat, and some people have old machines with not enough RAM to hold big kernels. Also, there are a few drivers that don't like some other drivers to be in the kernel at the same time, so they only get built for people that REALLY need them.
But it's still different from Windows when you practically get each time you buy some device - the driver to it. And this driver is usually made by the producent. I'm not saying that everything what is made by producent is best but it's more consistent: one device - one driver. In Linux you have to look into kernel config to know what you can use.
So, in Linux, I can compile driver "from the outside"?. Without necessity of compiling whole kernel?. So if I would like to add functionality to my kernel without compiling it I could build module to particular device?. Would I have to first compile kernel in some special way for this reason?.
Last edited by mac1234mac; 05-21-2006 at 11:18 AM.
All you need are the modprobe and/or insmod commands.
But I would have to first compile such module?. Is there possibility to compile one module from kernel without compiling the rest?.
I think that I run into external modules, I guess it is the case with lirc and nvidia drivers. But I'm not sure. Is lirc_gpio module external or integral part of kernel?. How to check it?.
Maybe it would explain things if we review just what the kernel is, what role it plays, and how it is built and then loaded...
"The kernel" is, first and foremost, a device-control program. If you open your computer's case and look inside (and nearby), "if you can see it and touch it, then the kernel controls it .. or, at least, facilitates its control." That includes the CPU(s), memory, the motherboard, and any peripheral devices and cards attached to it. Any interrupts received, any low-level switches or I/O ports used to communicate with any device ... all of these are handled by the kernel.
"The kernel" includes both a memory-resident portion and, optionally, loadable modules that are not memory-resident. You can decide, with some restrictions, which portions shall be memory-resident and which shall not. Still, all of it is "the kernel." And every portion, modular or not, is always resident in privileged kernel-memory space whenever it is being used.
The main reason for using modules, if you choose to do so, is that they're great for taking care of device-drivers or cipher routines or whatnot that you may use sometimes, but otherwise do not need. The drivers for your USB digital camera, for example, are needed only while the camera is attached.
If we compare this system to Microsoft Windows, we can basically say that (almost) all Windows device-drivers are loadable modules. The Windows kernel is strictly a "stock part," the same for every system that uses it. A standard binary Linux distro is very much the same.
To review... a "device driver" is the piece of software that controls a piece of hardware. All drivers present a uniform appearance to the rest of the Linux system, on the "back end," while their "front end" hardware manipulation routines are device specific.
Also note that X-Windows (or XOrg), the [non-privileged] GUI subsystem of Linux, has its own notion of "device drivers" even though it is not a part of the kernel. This is using the same words ("device driver") to mean a slightly different thing...
But one can build external module?. Or is it not equivalent?.
When, for example, I install nvidia driver it says that there is no precompiled module for my kernel so installer compiles it for me, is that not so?. So there are modules, external modules with which kernel can work. Or perhaps these are not the same kinds of modules?.
Last edited by mac1234mac; 05-23-2006 at 03:44 PM.
But one can build external module?. Or is it not equivalent?.
When, for example, I install nvidia driver it says that there is no precompiled module for my kernel so installer compiles it for me, is that not so?. So there are modules, external modules with which kernel can work. Or perhaps these are not the same kinds of modules?.
Yes, external modules are built, as you say, and they are the same kind of modules.
Just to chime in a bit - the Windows kernel does include drivers for most common pieces of hardware, but it doesn't contain *good* drivers for that software. Which is why, when you buy new hardware such as a motherboard, video card, modern usb key or printer, they give you a CD or point you to a website which will provide you with the drivers that you really ought to be using.
So I'm not sure that it's really fair to compare the models without realizing that since even though Windows' is a macrokernel, it really doesn't contain the right drivers for all the various hardware that you'll be throwing at it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.