View previous topic :: View next topic |
Author |
Message |
andrewski Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/984752232410132e8dd4c0.jpg)
Joined: 30 Apr 2004 Posts: 366 Location: Royersford, PA, USA
|
Posted: Mon Nov 22, 2004 6:15 am Post subject: Modules vs. in-kernel? |
|
|
I saw on this message that Daniel Drake thinks that building important hardware into the kernel is a better idea than making modules. Kind of a revolutionary idea to a lamer like I am, who's always gone by the "when in doubt, build as module, unless needed at boot" rule....
What is the general consensus on this? Is Daniel just ultra-733T (no offense, I'm trying to be funny)? Or does he have a good point?
I have an NVIDIA video card, a Creative SB sound card, a madwifi-powered wifi card, and two hard drives. Should I build any of this into my kernel? Is there anything else that's not obvious that I should consider building in-kernel? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Moriah Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/5229545064dad0ea85f50b.gif)
Joined: 27 Mar 2004 Posts: 2383 Location: Kentucky
|
Posted: Mon Nov 22, 2004 6:41 am Post subject: module or kernel resident? |
|
|
There are good reasons for going either way. This is the Gentoo distribution of Linux -- the Burger King "have-it-your-way" Linux. How would you like your kernel, sir? Any fries with that?
Modules are favored by driver writers because you do not have to reboot to unload and reinstall a driver or other module. They are also essential for dynamic boot-time configuration and hotplugging. If you think you might ever have to repair a broken box by pulling a bad board and plugging a similar board of a different kind -- such as a video board -- then you want to use a module for that functionality.
Kernel resident is essential for things needed at boot time, before modules are loaded, unless you can use an initrd to load those modules. Kernel resident modules make for a faster boot time -- important for some high availability server applications. Kernel resident modules also eliminate the possibility that a successful intrusion exploit would also be able to substitute a hacked version of a module into your running system. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
andrewski Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/984752232410132e8dd4c0.jpg)
Joined: 30 Apr 2004 Posts: 366 Location: Royersford, PA, USA
|
Posted: Mon Nov 22, 2004 6:52 am Post subject: |
|
|
Well, my system is just a desktop (ATM, hopefully a home server soon ) so the largest appeal is faster boot times. Since I usually just reboot when I update a kernel driver (except nvidia or madwifi), would I benefit to have other drivers reside in the kernel? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Moriah Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/5229545064dad0ea85f50b.gif)
Joined: 27 Mar 2004 Posts: 2383 Location: Kentucky
|
Posted: Mon Nov 22, 2004 7:18 am Post subject: KISS for workstations |
|
|
I usually follow the KISS principle for workstations, as they are usually behind several layers of defense, and thus not as exposed to attack from outside, and they do not need such fast boot times, as usually only one person is waiting for them, not a whole corporation or all of its customers.
I would use modules for everything on a workstation unless you had an definite needs to have something kernel resident for boot, such as a particular filesystem type, or LVM, or EVMS, or RAID, etc., and that only if it applies to the root filesystem. ![Very Happy :D](images/smiles/icon_biggrin.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Deranger Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/1467692247458b0af6b0072.jpg)
Joined: 26 Aug 2004 Posts: 1215
|
Posted: Mon Nov 22, 2004 8:43 am Post subject: |
|
|
I am using this rule: "Disable everything that you don't need" --> Resulting 1.4 MB kernel, all compiled in except iptables. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Moriah Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/5229545064dad0ea85f50b.gif)
Joined: 27 Mar 2004 Posts: 2383 Location: Kentucky
|
Posted: Mon Nov 22, 2004 9:15 am Post subject: so what happens if a board dies? |
|
|
So if you have a board fail, such as a disk controller, how do you boot your system if you have to replace it with a different type -- such as lets say you loose your SCSI board that runs your RAID on a server, and its the middle of the night on a weekend, and although the old board was a Bus-Logic, all you can find in the spare parts bin is an Adaptec? How do you boot the system after the board swap? Do you have to boot with a live CD, and the build another kernel? If you used modules and genkernel, this would not be necessary, thus getting the system back online faster. ![Surprised :o](images/smiles/icon_surprised.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Moriah Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/5229545064dad0ea85f50b.gif)
Joined: 27 Mar 2004 Posts: 2383 Location: Kentucky
|
Posted: Mon Nov 22, 2004 9:22 am Post subject: one more thing... |
|
|
One more point: if you are building for a very tiny system, such as an embedded application, or a very old slow box with limited ram and disk size, them compile everything in you need, and nothing you don't need.
It is important to realize that, at least for most of my usual situations, the above is not the case. I prefer to keep things as flexible as possible -- unless I feel I have a good reason to do otherwise. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
popel n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 29 May 2004 Posts: 3
|
Posted: Mon Nov 22, 2004 10:20 am Post subject: my 2 cents |
|
|
put everything into the kernel that is realy stable:
- discdrivers
- network drivers
- usb driver
- ...
everything that is not that stable should be done as module.
examples:
- dvb driver
- graphics device drivers
- lirc
- and everything for ugly hardware.
normaly u know what makes problems. Modules alow u to reload/reset a brocken driver without reboot.
hope this helps
popel |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Moriah Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/5229545064dad0ea85f50b.gif)
Joined: 27 Mar 2004 Posts: 2383 Location: Kentucky
|
Posted: Mon Nov 22, 2004 10:30 am Post subject: ans then your ethernet board dies... |
|
|
So if your ethernet board dies, and it was installed in the kernel, and you replace it with whatever you can get your hands on quickly, and its not the same kind, then you have to do a kernel build to get the network up.
This is especially inconvenient if you need to fetch a file over the network to do this, as you have no network to fetch it over.
Use modules unless you must use kernel resident! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Moriah Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/5229545064dad0ea85f50b.gif)
Joined: 27 Mar 2004 Posts: 2383 Location: Kentucky
|
Posted: Mon Nov 22, 2004 10:32 am Post subject: or at least... |
|
|
Or at least keep a bootable kernel in your /boot partition with a line in your /boot/grub/grub.conf that will let you boot a kernel that uses modules in an emergency. ![Very Happy :D](images/smiles/icon_biggrin.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
numerodix l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/50ca19a23ded101ddd1e4.jpg)
Joined: 18 Jul 2002 Posts: 743 Location: nl.eu
|
Posted: Mon Nov 22, 2004 4:05 pm Post subject: Re: ans then your ethernet board dies... |
|
|
Moriah wrote: | So if your ethernet board dies, and it was installed in the kernel, and you replace it with whatever you can get your hands on quickly, and its not the same kind, then you have to do a kernel build to get the network up.
This is especially inconvenient if you need to fetch a file over the network to do this, as you have no network to fetch it over.
Use modules unless you must use kernel resident! |
You keep insisting on modules being so much better but what's the big deal about whipping out the livecd in a hardware emergency/replacement situation? It's not like it happens often.. does it? _________________ undvd - ripping dvds should be as simple as unzip |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Moriah Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/5229545064dad0ea85f50b.gif)
Joined: 27 Mar 2004 Posts: 2383 Location: Kentucky
|
Posted: Mon Nov 22, 2004 4:40 pm Post subject: Sometimes it *IS* a big deal |
|
|
Not all of the boxes here have a CD drive, and I have had *MANY* occasions when I tried to use a CD drive only to find out that the thing no longer worked.
I usually do my installs directly over the network, booting from some other distribution. I use redhat as a bootstrap loader to install gentoo if I have to start from scratch because I can install redhat from my local webserver with only 2 floppies.
I have only had a very few times when a floppy drive did not work, and some of my systems have all the IDE ports taken by disk drives, so there is not even any place to connect a CD drive in an emergency. ![Surprised :o](images/smiles/icon_surprised.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Soul_rebel Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 12 Nov 2004 Posts: 88
|
Posted: Mon Nov 22, 2004 5:05 pm Post subject: |
|
|
sometimes is nice to have usb as a module: for example it lets you "turn off" an adsl modem that has lost syncronization without having to be physically in the proximity... i have got a script that uses this for my router-server pc. _________________ LinuX @ the Speed of Thought |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
andrewski Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/984752232410132e8dd4c0.jpg)
Joined: 30 Apr 2004 Posts: 366 Location: Royersford, PA, USA
|
Posted: Mon Nov 22, 2004 5:14 pm Post subject: Re: ans then your ethernet board dies... |
|
|
Moriah wrote: | So if your ethernet board dies, and it was installed in the kernel, and you replace it with whatever you can get your hands on quickly, and its not the same kind, then you have to do a kernel build to get the network up.
This is especially inconvenient if you need to fetch a file over the network to do this, as you have no network to fetch it over.
Use modules unless you must use kernel resident! | But if I have a kernel custom-compiled for my system and I put something in that's not in my kernel, it won't matter whether it's a module or not; it won't be there and I'll have to resort to something else anyway. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Fitzsimmons Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/1348444184419eba6fc1d67.gif)
Joined: 01 Jan 2003 Posts: 415 Location: Waterloo, Ontario, Canada
|
Posted: Mon Nov 22, 2004 5:19 pm Post subject: Re: ans then your ethernet board dies... |
|
|
Moriah wrote: | So if your ethernet board dies, and it was installed in the kernel, and you replace it with whatever you can get your hands on quickly, and its not the same kind, then you have to do a kernel build to get the network up.
[snip]
|
No you don't! You just compile the module for the new ethernet board and modprobe it. You don't need to build the whole kernel again, just the modules. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Moriah Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/5229545064dad0ea85f50b.gif)
Joined: 27 Mar 2004 Posts: 2383 Location: Kentucky
|
Posted: Mon Nov 22, 2004 6:21 pm Post subject: |
|
|
Good point!
But what if it was your disk interface instead of your ethernet board? You change the disk interface to a different brand, and you still have problems unless you used genkernel or some other boot-time hardware detection mechanism.
At the least, you must have another machine you can compile the necessary module on, and then you still have to use trinux or something like it to get the module on your boot disk so you can boot, assuming there is no cd drive on the sick box.
Moral: make an optimized kernel if you want to, but keep a genkernel around so you can boot in an emergency. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
andrewski Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/984752232410132e8dd4c0.jpg)
Joined: 30 Apr 2004 Posts: 366 Location: Royersford, PA, USA
|
Posted: Mon Nov 22, 2004 6:24 pm Post subject: |
|
|
Moriah wrote: | Moral: make an optimized kernel if you want to, but keep a genkernel around so you can boot in an emergency. | Ah, but to be sure, that's something different than you've been saying the last few posts. That (in my head, anyway) seems like a good moral. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
MK Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/gallery/Diablo/Diablo_2_-_Necromancer.gif)
Joined: 27 Nov 2002 Posts: 97 Location: Bærum, Norway
|
Posted: Mon Nov 22, 2004 6:30 pm Post subject: |
|
|
I prefer having as much as possible as modules, don't like having a static kernel, and modules isn't that much slower. Also I got lots of SCSI drives I don't use anymore, so I can load the module when I need the cdr etc, no need to wait for scsi drivers to load at boot. I also always keep a kernel where everything is compiled in, because of some bad experience in the past... |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
numerodix l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/50ca19a23ded101ddd1e4.jpg)
Joined: 18 Jul 2002 Posts: 743 Location: nl.eu
|
Posted: Mon Nov 22, 2004 6:57 pm Post subject: Re: Sometimes it *IS* a big deal |
|
|
Moriah wrote: | Not all of the boxes here have a CD drive, and I have had *MANY* occasions when I tried to use a CD drive only to find out that the thing no longer worked.
I usually do my installs directly over the network, booting from some other distribution. I use redhat as a bootstrap loader to install gentoo if I have to start from scratch because I can install redhat from my local webserver with only 2 floppies.
I have only had a very few times when a floppy drive did not work, and some of my systems have all the IDE ports taken by disk drives, so there is not even any place to connect a CD drive in an emergency. ![Surprised :o](images/smiles/icon_surprised.gif) |
Well if your setup is that particular, maybe you should have stated those reasons in your argumentation?
For most desktop users, I would imagine genkernel is a bit unnecessary for daily use. Not only does it take longer to boot because of the hardware auto-detection, it also takes ages to compile because you need boatloads of modules. I suppose for servers it doesn't matter whether it takes a minute or three minutes to boot cause you're not sitting around waiting for it to boot anyway. And you probably don't reboot often, so why not genkernel. _________________ undvd - ripping dvds should be as simple as unzip |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Deranger Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/1467692247458b0af6b0072.jpg)
Joined: 26 Aug 2004 Posts: 1215
|
Posted: Mon Nov 22, 2004 8:16 pm Post subject: |
|
|
I have never used genkernel and I'm proud of it
LiveCD is definately the fastest way to deal all the problems. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
MighMoS Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/51447706341b384651f07e.png)
Joined: 24 Apr 2003 Posts: 416 Location: @ ~
|
Posted: Mon Nov 22, 2004 8:31 pm Post subject: |
|
|
For a server I have, I've disabled all modules, and module loading functionality, closing one way a hacker could gain full kernel access to my system . But for my desktop I still build most things into the kernel so I don't have to worry about hot/coldplugging, or stuffs like that. Its not mission critical, hardware doesn't die every week, and what's in there doesn't really move around. I know what I use my box for, so I don't need every possible option. For me it just makes sense to build it into the kernel. _________________ jabber: MighMoS@jabber.org
localhost # export HOME=`which heart` |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Fitzsimmons Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/1348444184419eba6fc1d67.gif)
Joined: 01 Jan 2003 Posts: 415 Location: Waterloo, Ontario, Canada
|
Posted: Mon Nov 22, 2004 8:58 pm Post subject: |
|
|
MK wrote: | I prefer having as much as possible as modules, don't like having a static kernel, and modules isn't that much slower. Also I got lots of SCSI drives I don't use anymore, so I can load the module when I need the cdr etc, no need to wait for scsi drivers to load at boot. I also always keep a kernel where everything is compiled in, because of some bad experience in the past... |
Actually I've heard that modules are actually slightly faster than builtin. However, I've also heard that -ffast-math and -funroll-loops are good ideas, so like everything else, I took it with my obligitory salt. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
tuber Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 12 Nov 2004 Posts: 267
|
Posted: Mon Nov 22, 2004 11:15 pm Post subject: Re: ans then your ethernet board dies... |
|
|
Fitzsimmons wrote: |
No you don't! You just compile the module for the new ethernet board and modprobe it. You don't need to build the whole kernel again, just the modules. |
So if I decide that I want to enable a module that was previously disabled, I can just run "make menuconfig" (or something), enable the module, skip making the kernel, and go directly to "make modules_install" and modprobe with the currently running kernel? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Fitzsimmons Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/1348444184419eba6fc1d67.gif)
Joined: 01 Jan 2003 Posts: 415 Location: Waterloo, Ontario, Canada
|
Posted: Tue Nov 23, 2004 5:11 pm Post subject: |
|
|
I believe it would be
Code: |
#make modules modules_install
|
but otherwise, yes. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Archangel1 Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/10640655464313fa93b48a7.png)
Joined: 21 Apr 2004 Posts: 1212 Location: Work
|
Posted: Tue Nov 23, 2004 9:47 pm Post subject: |
|
|
I haven't bothered to modularise everything on mine. If by some freak a bit of hardware died, and both CD drives nuked themselves so I couldn't restore off a LiveCD, there's a fair chance the computer won't be usable *anyway* because it's been dropped or hit by a power spike or something. I'm not likely to fix it by compiling new modules inside the existing system.
Some things are necessary as modules though; USB on a laptop springs to mind (the modules are removed before suspending), and ALSA apparently likes modules better, although I've heard of it working fine built-in.
And of course the nVidia drivers; if not for them I could probably set up my desktop without module loading capability. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|