LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
LinkBack Search this Thread
Old 05-21-2006, 10:37 AM   #1
mac1234mac
Member
 
Registered: Sep 2005
Posts: 182

Rep: Reputation: 30
Why kernel is built this way?.


Hello

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?.

Cheers
 
Old 05-21-2006, 10:48 AM   #2
ataraxia
Member
 
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
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.
 
Old 05-21-2006, 11:14 AM   #3
mac1234mac
Member
 
Registered: Sep 2005
Posts: 182

Original Poster
Rep: Reputation: 30
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.
 
Old 05-21-2006, 04:22 PM   #4
RavenOfOdin
Member
 
Registered: Feb 2006
Location: Arkansas, C.S.A
Distribution: Ubuntu 6.06 LTS, PC / Debian Etch 2.6.16.17 PPC
Posts: 60

Rep: Reputation: 15
Quote:
Originally Posted by mac1234mac
So if I would like to add functionality to my kernel without compiling it I could build module to particular device?.
You don't need to compile the kernel in any special way. All you need are the modprobe and/or insmod commands.
 
Old 05-22-2006, 08:39 AM   #5
mac1234mac
Member
 
Registered: Sep 2005
Posts: 182

Original Poster
Rep: Reputation: 30
Quote:
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?.
 
Old 05-23-2006, 02:54 PM   #6
sundialsvcs
Senior Member
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 3,681

Rep: Reputation: 329Reputation: 329Reputation: 329Reputation: 329
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...
 
Old 05-23-2006, 03:41 PM   #7
mac1234mac
Member
 
Registered: Sep 2005
Posts: 182

Original Poster
Rep: Reputation: 30
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.
 
Old 05-24-2006, 04:30 PM   #8
ataraxia
Member
 
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
Quote:
Originally Posted by mac1234mac
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.
 
Old 05-24-2006, 08:28 PM   #9
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Slack 10.2, Slack 12, Suse 10.0, DSL 2.2, Xubuntu 7.04
Posts: 920

Rep: Reputation: 30
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel: modules or built in? sh4d0w13 Linux - Newbie 1 10-31-2005 07:00 PM
How to backup new built kernel intmail Slackware 1 08-01-2005 07:53 AM
new kernel built....no modules linuxhippy Slackware 11 03-10-2005 03:54 PM
How to built-in a driver when compiling the kernel 7helix Linux - Software 9 06-18-2004 02:17 PM
Just built my first kernel, but... plisken Linux - General 7 10-01-2003 09:03 AM


All times are GMT -5. The time now is 12:50 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration