Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[FAQF] KC7: Compiling directly into a kernel vs. modules
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
TGL
Bodhisattva
Bodhisattva


Joined: 02 Jun 2002
Posts: 1978
Location: Rennes, France

PostPosted: Fri Jun 06, 2003 6:37 am    Post subject: [FAQF] KC7: Compiling directly into a kernel vs. modules Reply with quote

I would add that compiling something, for instance a driver, as a module allows to easily tweak it options, which is sometimes indispensable.
Back to top
View user's profile Send private message
wilburpan
l33t
l33t


Joined: 21 Jan 2003
Posts: 977

PostPosted: Thu Jun 12, 2003 4:05 pm    Post subject: Reply with quote

Thanks for the suggestion. I incorporated it into my FAQ.
Back to top
View user's profile Send private message
spamspam
Apprentice
Apprentice


Joined: 05 Dec 2003
Posts: 153

PostPosted: Sat Dec 06, 2003 8:07 am    Post subject: The advantage of non-modular kernels Reply with quote

There is something to be said for making a non-modular kernel.

Some of the most effective rootkits are (or include) kernel modules. By compiling all needed features into the kernel, and disabling modules entirely, you can block them.

This technique is usefull on servers where the hardware seldom changes. It is not reccommended for desktops which are likely to need to hotplug USB or FireWire devices, or mount a variety of filesystems from time to time.
Back to top
View user's profile Send private message
rogerx
n00b
n00b


Joined: 06 Apr 2004
Posts: 70

PostPosted: Tue Apr 06, 2004 7:23 pm    Post subject: Reply with quote

I find building everything statically reduces the errors when trying to load a module/driver or messing with the modules.conf file... as most times, the module is already loaded with the features I need.

So what I do, is patch the kernel-2.6 w/ supermount and an orinoco hack for monitoring -- with the intent to keep the kernel as clean of patches as possible. I have also recently started to build ieee1394/firewire statically since this feature now supports hotplugging... no need to unload & load ieee1394 modules as almost all the bugs are worked out of hotplugging hdd's and cdrom drives.

The only thing I'm loading as a module is the evdev due to my wacom pad or synaptics touch pad ... and I forget why! ;-)

As a side note, I find that the o/s loads faster with a monolithic kernel versus modular. But load times for the kernel are slightly increased on the monolithic kernel. ... no biggy.

Prior to kernel-2.6, I was still loading allot of stuff as module (ie pcmcia/ieee1394/ide-scsi/scsi, ...).
_________________
Roger
http://rogerx.freeshell.org/
Back to top
View user's profile Send private message
Caalvin
n00b
n00b


Joined: 15 Apr 2004
Posts: 20
Location: Wiesbaden/Germany

PostPosted: Thu Jul 01, 2004 10:41 pm    Post subject: Reply with quote

ok, i think compiling some drivers as module only make sense if you often change your hardware... the most desktop-system are "static" in that point..so building a monolith kernel would be the better choice.

On a notebook the situation is an other. I use Gentoo on a notebook, which i sometimes use in a docking, in several different networkenvironments, diverent monitors, printers, scanners and so on.. in this case, it is better to compile a lot drivers as modules, so they will only be loaded if the appropiated hardware is present... the "main"-drivers for the notebook itself surely as "compiled-in" for .

I hope this could help those, who are undecisive, if not, ok shame on me, this another useless post....

cheers
torsten
Back to top
View user's profile Send private message
rogerx
n00b
n00b


Joined: 06 Apr 2004
Posts: 70

PostPosted: Fri Jul 02, 2004 12:27 am    Post subject: Reply with quote

Ok. granite. Using kernel-2.6 here on my dell inspiron laptop.

To be honest, I *try* to compile everything statically into the kernel (to avoid loading modules on startup as it does somewhat slow down the boot process & sometimes using modules can conflict (atleast in kernel-2.4 modules did)).

But the clincher on the laptops are that sometimes you need to patch the kernel drivers with either more up-to-date code or because the driver isn't in the kernel yet (ie wacom, nvidia, orinoco monitor patch, ...)

Module Size Used by
ppp_deflate 4992 0
bsd_comp 5632 0
agpgart 27688 0
ipt_TOS 2176 12
ipt_LOG 6016 7
ipt_REJECT 5760 4
ipt_pkttype 1664 4
ipt_state 1792 14
ip_nat_irc 4080 0
ip_nat_tftp 3056 0
ip_nat_ftp 5104 0
ip_conntrack_irc 70832 1 ip_nat_irc
ip_conntrack_tftp 3120 0
ip_conntrack_ftp 71600 1 ip_nat_ftp
ipt_multiport 1920 0
ipt_conntrack 2304 0
iptable_filter 2432 1
iptable_mangle 2432 1
iptable_nat 27436 3 ip_nat_irc,ip_nat_tftp,ip_nat_ftp
ip_conntrack 38928 9 ipt_state,ip_nat_irc,ip_nat_tftp,ip_nat_ftp,ip_conntrack_irc,ip_conntrack_tftp,ip_conntrack_ftp,ipt_conntrack,iptable_nat
ip_tables 19456 10 ipt_TOS,ipt_LOG,ipt_REJECT,ipt_pkttype,ipt_state,ipt_multiport,ipt_conntrack,iptable_filter,iptable_mangle,iptable_nat
e100 29824 0
rivafb 46916 0
vgastate 9600 1 rivafb
joydev 8128 0
ppp_async 9984 1
ppp_generic 21780 7 ppp_deflate,bsd_comp,ppp_async
slhc 6656 1 ppp_generic
evdev 7552 1
nvidia 2074184 14

As you can see, I also have firewall as modules.

I tend to just compile all my usb printer/scanner drivers right in too. Unless you're worried about memory usage, laptops these days can have plenty of memory... granite, 512MB ain't exactly over doing it!

Again, pro's/cons of usb drivers as static/modules -- do you want to have the kernel fiddle with loading these during runtime and hope they load ok? ... or do you just want to plug in h/w and already have the driver up and waiting to run? Allot of pros/cons to consider -- And I still do not believe that there is one single "right way" of doing this (ie. the freedom of doing it your way.)

If I was running low on memory (which I do sometimes), I might use more modules. Another thing one has to consider is "just how much memory" is saved by doing so... sometimes the module "help" text does offer size info, but most times, it's either negligable or not listed.

User pref, no right or wrong way as long as you use some commom sense. ;-)
_________________
Roger
http://rogerx.freeshell.org/
Back to top
View user's profile Send private message
Gherald2
Guru
Guru


Joined: 02 Jul 2003
Posts: 326
Location: Madison, WI USA

PostPosted: Fri Jul 23, 2004 1:22 am    Post subject: Reply with quote

Pedantic: "In my case, if I have PCMCIA support built into the kernel, then metworking works.
_________________
Unregistered Linux User #17598363
Back to top
View user's profile Send private message
rogerx
n00b
n00b


Joined: 06 Apr 2004
Posts: 70

PostPosted: Fri Jul 23, 2004 3:15 am    Post subject: Reply with quote

More then likely sounds like an irq or ioport conflict.

Monitor the following:
/proc/interrupts
/proc/ioports

... and then configure the device stealing the interrupt or ioport address to use a specific address. I'm going to guess you have your network card or other device as a module and having the pcmcia network device get first take at the pool of addresses is fixing the problem. No sweat though, as I do the same thing as you to resolve them as it is easier! ;-)

I had to compile something as module and set pcmcia init.d to a default rather then boot. The proper way for me would have been to exclude/include the address within the config file of pcmcia! ;-)
_________________
Roger
http://rogerx.freeshell.org/
Back to top
View user's profile Send private message
cdunham
Apprentice
Apprentice


Joined: 06 Jun 2003
Posts: 211
Location: Rhode Island

PostPosted: Mon Aug 09, 2004 1:30 am    Post subject: Reply with quote

There have been a couple of annoyances I've run into running monolithic servers. As someone pointed out, it is part of a set of tactics for making more secure systems, which is great, especially if you have static hardware and don't mind recompling to get new stuff.

The annoyances are:

1) entries in the system log like:

modprobe: FATAL: Could not load /lib/modules/2.6.7-gentoo-r11/modules.dep: No such file or directory

Somewhere, someone is calling modprobe, and I can't figure out who or why. They also show up during boot, and although /etc/init.d/modules is depended on all over the place (and listed in CRITICAL_SERVICES in /sbin/rc), it is smart enough to exit cleanly if it doesn't see /proc/modules, so I'm pretty sure it's not to blame.

2) sensors-detect and other misc programs barf and die if they can't load modules. I *could* try to configure sensors by hand, but I enjoy being somewhat sane, thank you.

Perhaps I just missed the "modules=no" param in /etc/rc.conf ^_^
_________________
This post more meaningful in a scalar context.
Back to top
View user's profile Send private message
rogerx
n00b
n00b


Joined: 06 Apr 2004
Posts: 70

PostPosted: Mon Aug 09, 2004 9:04 pm    Post subject: Reply with quote

yes. some of the init.d services (ie hotplug may be a culprit also), where if everything is static/monolithic, then you will get false errors posted to the syslog about not being able to load a module. Usually, I tend to ignore these as it's obvious this gets down to providing a proper script to recognize the module is statically compiled. This does not affect run time.
ie: cat /proc/config.gz |gzip -dc

And yes, newer modules or experimental (buggy) modules may have a rougher time being statically linked. All modules seem to go through this phase where they need to be unloaded & reloaded due to bugs.

So, what I do, to try to stay completely monolithic, compile almost everything statically except for the few buggy ones.

Yes. sensors are a pain imo. ;-)
_________________
Roger
http://rogerx.freeshell.org/
Back to top
View user's profile Send private message
cdunham
Apprentice
Apprentice


Joined: 06 Jun 2003
Posts: 211
Location: Rhode Island

PostPosted: Mon Aug 16, 2004 3:06 pm    Post subject: Reply with quote

rogerx wrote:
yes. some of the init.d services (ie hotplug may be a culprit also), where if everything is static/monolithic, then you will get false errors posted to the syslog about not being able to load a module.


Interestingly, 'ps' seems to be a big culprit...
_________________
This post more meaningful in a scalar context.
Back to top
View user's profile Send private message
betoe
n00b
n00b


Joined: 25 Jul 2005
Posts: 6
Location: Mazatlán, México

PostPosted: Tue Oct 18, 2005 2:09 am    Post subject: Reply with quote

Hi guys, hope i will explain this correctly (english isnt my first language). Searching on google i came here coz i have a problem (again...) with my gentoo installation.

I had installed gentoo yesterday, and after the system reboot, i see this message error.

"Modprobe: FATAL: Could not load lib/modules/2.6.12-gentoo-r6/module.dep No such file or directory"

This error appear with:
1) Syncing hardware clock...
2) Settings DNS domain to...
3) Bringing eth0 up via DHCP...

As its fast, i can write only that.

I searched on my HDD and i have lib/modules/2.6.13-gentoo-r3 , not 2.6.13-gentoo-r6.


So what can i do for fix that? Thanks by your help.
Back to top
View user's profile Send private message
cdunham
Apprentice
Apprentice


Joined: 06 Jun 2003
Posts: 211
Location: Rhode Island

PostPosted: Tue Oct 18, 2005 4:06 am    Post subject: Reply with quote

Is your kernel built with module support?
_________________
This post more meaningful in a scalar context.
Back to top
View user's profile Send private message
betoe
n00b
n00b


Joined: 25 Jul 2005
Posts: 6
Location: Mazatlán, México

PostPosted: Wed Oct 19, 2005 4:35 pm    Post subject: Reply with quote

Hi. I really dont remember that exactly. Maybe i must reinstall the kernel carefully, i will do it this night (here its same time than mountain time in the US).
Back to top
View user's profile Send private message
cdunham
Apprentice
Apprentice


Joined: 06 Jun 2003
Posts: 211
Location: Rhode Island

PostPosted: Wed Oct 19, 2005 11:23 pm    Post subject: Reply with quote

If not, you can fix these messages with a small hack:
Code:
touch /lib/modules/2.6.12-gentoo-r6/module.dep

_________________
This post more meaningful in a scalar context.
Back to top
View user's profile Send private message
betoe
n00b
n00b


Joined: 25 Jul 2005
Posts: 6
Location: Mazatlán, México

PostPosted: Thu Oct 20, 2005 3:18 am    Post subject: Reply with quote

I cant do that cdunham, coz that path doesnt exist:
/lib/modules/2.6.12-gentoo-r6/module.dep

Damn i want to have gentoo working but i dont have enough time for (try) fix it til next sunday.
Back to top
View user's profile Send private message
cdunham
Apprentice
Apprentice


Joined: 06 Jun 2003
Posts: 211
Location: Rhode Island

PostPosted: Thu Oct 20, 2005 6:12 am    Post subject: Reply with quote

Code:
mkdir -p /lib/modules/2.6.12-gentoo-r6
touch /lib/modules/2.6.12-gentoo-r6/module.dep

_________________
This post more meaningful in a scalar context.
Back to top
View user's profile Send private message
betoe
n00b
n00b


Joined: 25 Jul 2005
Posts: 6
Location: Mazatlán, México

PostPosted: Thu Oct 20, 2005 10:31 pm    Post subject: Reply with quote

Thanks cdunham, sorry for being so noob and thanks to you for being so nice with me. That error has gone, but i still have a problem with the intenet connection, now i will try on IRC channels and searching on google.
Back to top
View user's profile Send private message
cdunham
Apprentice
Apprentice


Joined: 06 Jun 2003
Posts: 211
Location: Rhode Island

PostPosted: Sat Oct 22, 2005 6:25 pm    Post subject: Reply with quote

No worries, pass it forward...
_________________
This post more meaningful in a scalar context.
Back to top
View user's profile Send private message
HydroDiOxide
n00b
n00b


Joined: 22 May 2007
Posts: 55
Location: Groningen

PostPosted: Mon Sep 17, 2007 9:44 am    Post subject: Reply with quote

Don't know if this is the right place to post this question, but it struck me when reading the faq.

The TS of the faq says
Quote:
...and your Linux system will theoretically only load the driver that is appropriate for the hardware setup at the time.

Does this mean that, when I compile something as a module, I won't need to load it manually, but that the system will load it when it detects the hardware? IOW, when the hardware is detected, but support isn't built into the kernel the system will look for the appropriate module and when the module isn't compiled the hardware fails to work?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum