Click to See Complete Forum and Search --> : Kernel Modules


johntramp
05-27-2004, 07:31 AM
Hi, when I use menuconfig to setup the kernel, I have no idea realy what I am supposed to be doing. If I go into knoppix or something and run # lspci -v or # lsmod will that give me the modules I should be looking to add into the kernel?? This and etc-update seems to be the only things holding me back from gentoo.

Thanks

Dark Ninja
05-27-2004, 08:03 AM
Well, it really depends on how you want to setup your kernel. Some people want to keep the kernel as small as possible and abstract most of the "work" out to individual modules. Others (like myself) want the kernel to handle as much as possible.

When you are setting up your own kernel (make menuconfig), you have to choose the aspects of the kernel that will allow your system to work. I realize it's a little intimidating at first, but, remember two things about setting up the kernel:

1.) You can always go back and change it. Worst case scenario, you can't even boot up into your system (because you didn't choose certain options in the kernel), use the Gentoo CD (or whatever Linux distro CD) to boot up into the system -- edit the kernel -- then try again.

The good thing is that, once you get a working kernel, you can always save it and, when you are compiling a new release of the kernel, if something goes wrong, you can always boot into the old kernel to change it.

2.) Make sure you understand what hardware is on your system. This is especially true for sound cards, video cards and network cards. These tend to be the three major trouble spots for people compiling their own kernel. Once you know what hardware you have, just read carefully through the different options in the kernel. Sometimes it'll flat out tell you if something is needed (for example, networking capabilities via TCP). Sometimes, it's pretty obvious (if you have EXT3 partitions, you want EXT3 support). Sometimes, it can get a little tricky (do I want to compile in support for this graphics card or that one).

Rule of thumb for first time kernel compilers -- if you're unsure, say "Yes" This may be considered to be bad advice because this *could* lead to security issues and could also lead to an enormous kernel -- but, at least you can get things to work and start trimming down the kernel afterwords. (For example, my original kernel compile was almost 2MB. Now, I'm down to 1.3MB.)

So, hopefully that helps you a bit.


As for etc-update, I woudn't worry about it all that much. As long as you are careful (AKA - NEVER SELECT OPTIONS 3 or 5 UNTIL YOU'VE VERIFIED THAT YOU ARE NOT OVERWRITING ANYTHING IMPORTAT!), you shouldn't have any real problems. Besides -- if you screw things up, you get to set up again, and that allows you to learn even more. :D

xdakorx
05-27-2004, 08:11 AM
When I had to compile my first kernel I uised a kernel stock kernel config from a diff distro slack and Arch have good stock configs then when you are ready compile ur own but this way u can always fall back on the stock.

bs_texas
05-27-2004, 08:53 AM
Originally posted by Dark Ninja
(For example, my original kernel compile was almost 2MB. Now, I'm down to 1.3MB.)

Which file is that?
And where is it located?

Thanks...

Edit: I'm assuming it is /boot/vmlinuz. I thought it might have been /usr/src/linux-2.4.22/.config, but I see that my un-tweaked slackware vmlinuz is 1,226,706 bytes. Maybe it gets bigger once it is customized.
And the .config is only 38,645 bytes.

johntramp
05-27-2004, 09:01 AM
I uised a kernel stock kernel config from a diff distro

how would I go about doing that? -I am using slackware at the moment.. Is this a good way of going about it?

Otherwise I will just go through menuconfig with a fine toothd comb.

-Having a smaller kernel will make the whole OS run faster then I am gathering?
What kind of sized kernel would slackware be using then?

I am not realy that bothered in getting my computer to run at the maximum possible. I am more interested in using Gentoo for the portage system and because it is annoying me that I can't get it running.. A challenge I suppose.

Would you recommend installing Gentoo from my slack distro, or from the live cd?

Thanks :)

Uranus
05-27-2004, 09:33 AM
Originally posted by bs_2003
Which file is that?
And where is it located?
The kernel is the part of your system that controls the hardware. It is called bzImage after you compiled it and is located in [source directory]/arch/[architecture]/boot/bzImage - after that you can move it to any place you want, as long as you configure your bootloader to use that file. It's generally in the /boot directory (possibly a partition of its own, not mounted automagically).
If you have /boot on a partition of its own, mount /boot and you will find it there.
Originally posted by johntramp
how would I go about doing that?
Find a general config file, move it to your kernel source directory (make sure it's called .config) and run the appropriate commands for the version (2.4 and 2.6 use different make commands).
Originally posted by johntramp
What kind of sized kernel would slackware be using then?
Probably large, since they want a lot of hardware to work with it. Find out by running du -f /path/to/bzImage
Originally posted by johntramp
Would you recommend installing Gentoo from my slack distro, or from the live cd?
I installed from the liveCD and liked that - it went a lot faster when I found out you could switch virtual consoles :) I wouldn't know about installing from an existing distribution, but I've heard installing from Knoppix is lovely, since you have a graphical environment you can use to do the things you have to.

Dark Ninja
05-27-2004, 09:41 AM
My recommendation would be to install Gentoo from the LiveCD. When the LiveCD starts up, it automatically tries to detect items on your computer, such as network/video/etc. It then creates a config file for "genkernel" (this is described in Gentoo's Install Handbook). This "genkernel" can then be used later to create your own kernel. From there, you can go back later and emerge development-sources and attempt to setup your own kernel. Then, if you screw up, you always have the genkernel to fall back on.

And, that's a good question you bring up -- I'm not sure what kind of performance effect a smaller kernel has on the system. I know I boot fater now because I removed support for firewire and a couple other things, so that's less "stuff" the kernel has to start up. However, I'm not really sure if it provides any other enhancements. (Well...I take that back slightly. Having a smaller kernel can provide a security increase because it reduces the number of modules on your system that COULD potentially have a security hole.)

Can anybody help out with that? Thanks.

bs_texas
05-27-2004, 09:48 AM
Hmmm... I don't have a bzImage anywhere on my slackware system. Is that only created after you do some customizing?

(sorry, I don't mean to hijack the thread. But this is about kernel modules and therefore, where is the kernel, I suppose. I'm right on the verge of jumping into this kernel stuff, if I can just get past some of the WTF stack that I always run into. ;) )

Dark Ninja
05-27-2004, 09:59 AM
If you didn't compile your own kernel, and use one of Slack's premade kernels, then you most likely will not have a bzImage file on your system. (I can't remember if you compile your own kernel or not in a Slack install.)

Check under /boot -- that's where the kernel is *probably* located. (Or, look in your lilo or grub config file. That will surely tell you.)

bs_texas
05-27-2004, 10:06 AM
So, am I correct in assuming that the kernel is in vmlinuz and not bzImage on my system?
And if I do compile a kernel and use make menuconfig in there somewhere, then vmlinuz is no longer the kernel being used and bzImage will be.

I see that johntramp is dealing with a slackware machine also, so I assume that this is apropos to his situation also.

I've never compiled a kernel and I have 2 slackware machines and a Red Hat 8 machine, currently.

Thanks...

johntramp
05-28-2004, 03:12 AM
ok, I am beginning to understand... but this still brings me back to my origonal question. If I go into knoppix or something and run # lspci -v or # lsmod will that give me the modules I should be looking to add into the kernel?
Will this give me the information I require on my hardware to compile the kernel?

Thanks :)

Loki3
05-28-2004, 04:18 AM
More than likely. For example if your networking card works under knoppix but not gentoo, boot knoppix, lsmod for the networking card's module/s, then boot into gentoo, use menuconfig to add it to your kernel, re-compile, do the happy-dance.

Uranus
05-28-2004, 09:55 AM
Originally posted by bs_2003
So, am I correct in assuming that the kernel is in vmlinuz and not bzImage on my system?
And if I do compile a kernel and use make menuconfig in there somewhere, then vmlinuz is no longer the kernel being used and bzImage will be.
Sorry, hadn't thought of that - Slackware installs your kernel under the name vmlinuz, I think it has to do with lilo. I'm not sure though, you can name the kernel anything you want as long as it's referred to correctly in the bootloader. When you build a kernel I believe it is generally called bzImage. So vmlinuz is the same as bzImage - naming habits just differ.
Hope this clarifies things a little
Sam