Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Kernel Module Question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
jschweg
Tux's lil' helper
Tux's lil' helper


Joined: 21 Feb 2004
Posts: 85

PostPosted: Mon May 21, 2007 3:21 am    Post subject: Kernel Module Question Reply with quote

I'm going to be building my first kernel on my gentoo system, have a quick noob question.

When I run menuconfig, I can obviously choose to build items into the kernel or make them modules. I guess what I'm wondering is why can't you just build everything into the kernel? Is there a recommendation on which items should be modules and which items shouldn't be?
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23103

PostPosted: Mon May 21, 2007 4:31 am    Post subject: Reply with quote

You should build into the kernel anything that you need to be able to boot, such as your hard disk driver. You can get away with making it a module if you use an initramfs, but it is easier just to build the driver in. You could build everything you need into the kernel, and then disable support for modules entirely. This approach is taken on some hardened systems, since it prevents an attacker from loading "evil" modules via the normal module loading interface. However, this step alone does not completely protect the system against a privileged attacker inserting code into the kernel.

Modules can be desirable for several purposes. For example, binary distributions often build a huge number of options as modules, since the end users will not be rolling a personal kernel, and thus will be reliant on the distributor to provide any required functionality. Building all that extra code into the kernel would bloat the main kernel image. By leaving it as a module, it is not loaded until it is needed. Building code as a module can also be a useful way to test a module that you are developing, since it can be unloaded, rebuilt, and reloaded without rebooting.

As for which items should and should not be modules, my preference is to build in any required drivers and any functionality I expect to use constantly, such as Netfilter for a firewall machine. I build other features, such as TUN/TAP support or Microsoft filesystem support as modules, since I use them only rarely. This is just my preference. You can use any combination of built-in and module that you can get to run, though some configurations will be easier to setup and maintain than others.
Back to top
View user's profile Send private message
jschweg
Tux's lil' helper
Tux's lil' helper


Joined: 21 Feb 2004
Posts: 85

PostPosted: Mon May 21, 2007 5:32 pm    Post subject: Reply with quote

Thanks for the insight, appreciate it.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Mon May 21, 2007 7:55 pm    Post subject: Reply with quote

The items in the kernel is sometimes too old.

e.g. Fuse; so the module is newer.
Also my rt2500 driver for my wireless nic is only available as module. No kernel option for it.

If you use modules you will have to emerge those packages again, when you make a newer kernel. Everytime this step is necessary.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54850
Location: 56N 3W

PostPosted: Mon May 21, 2007 9:00 pm    Post subject: Reply with quote

jschweg,

Modules make debug easier and may be compiled and loaded without a restart, so you can add them any time.
No need for a full kernel build. Heres my take on it.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
jschweg
Tux's lil' helper
Tux's lil' helper


Joined: 21 Feb 2004
Posts: 85

PostPosted: Thu May 24, 2007 2:56 am    Post subject: Reply with quote

Good DIY. That helps a lot. Thanks all :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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