Building slimmed-down kernel

I need to create a slimmed down kernel configuration for OpenSuse 11.1 for use in my operating system course-- mostly so the students can build a kernel in a reasonable amount of time.

When I go through the gconfig process to strip out stuff that we don’t need, I end up with a broken kernel due to missing kernel modules. However, a check of the .config file and the build log indicates that the “missing” modules were actually included in the configuration and were actually built. They just did not get included in the kernel for some mysterious reason.

In fact, after a detailed check of the .config file and some controlled experiments, I cannot figure out why some kernel modules are correctly included and others are missing. I also cannot find anything in OpenSuse or any other Linux kernel documentation that tells how to specify that a kernel module gets included in the kernel or not.

Can anyone help or point me in the right direction? If this is the wrong forum for this question, could you please directy me to a better one?

Thanks,

You go to kernel-source, best is to copy it somewhere and name the folder a bit else than the original. Then you extract /proc/config.gz to your kernel source directory. After that install qt3-devel and invoke:
make xconfig (to help you know what is needed open terminal and invoke lsmod | sort and search for that in the xconfig window)

It is safe to get rid of unused drivers but you need to know which ones you need (lsmod above).

I tried copying config file from 2.6.30.1 to 2.6.20.2 and somehow it unmarked everything, no idea why as it’s almost the same kernel right?

After that you type in terminal:

make

make modules_install

make install

Forgot one thing, you need to name that kernel a bit else than the original or else you’ll have a royal mess there (i’ve been there :|)

Also you always click every module to either have it built in or built as a module.

If you have a quad core then make -j5 will build it almost four times faster :slight_smile: cores amount = -j+1

Thanks, but I am way beyond that point.

In gconfig, I can cut out a few drivers and devices that I clearly don’t need without a problem, saving perhaps 10% in build time. But when I cut out a lot more stuff –

Is there a difference between make xconfig and make gconfig? I have used both and also menuconfig; I prefer gconfig.

Thanks, but I am way beyond that point.

In gconfig, I can cut out a few drivers and devices that I clearly don’t need without a problem, saving perhaps 10% in build time. But when I cut out a lot more stuff – which I am also sure that I don’t need – it starts to drop some of the kernel modules, and I cannot figure out what to include to get them back.

I really need to cut build time by about 75%. There are two approaches:-- ruthlessly cut stuff out using one of the config interfaces, or using a script such as the one published by Roel Kluin in

http://wiki.linuxquestions.org/wiki/Configuring_linux_kernel

The best I have been able to do with the first approach is reduce build time by about 40-50%, but losing a few kernel modules. The second approach reduces build time by 80% but manages to miss almost all of the kernel modules.

Incidentally, lsmod lists only about a hundred or so modules on my configuration, out of the 4000 or so in the OpenSuse 11.1 distribution. So there is a lot of scope for reduction.

Is there a difference between make xconfig and make gconfig? I have used both and also menuconfig; I prefer gconfig?

I guess xconfig and gconfig boils down to a GTK or Qt interface :slight_smile:

menuconfig is simle ncurses interface.

You won’t build kernel in 5 minutes. Just create one that works for You, copy that, rename to a version higher and experiment with it:)

I just built an even more stripped down version and i’ll be checking it in a minute :wink: