I'm a gentoo user. When compiling the kernel there are a lot of options which one may enable depending on one's hardware.

My question is how to know what to enable/disable, I'm aware of the hardware I'm using (processor instruction set, number of cores, etc./ motherboard NB and SB/sata drives, etc.) but still don't have a clear idea what to do when choosing options in the kernel setup script.

I've had weird issues because of this (solved after some help from #gentoo). Can someone give me some references on this topic? How do people learn to do this?

P.S. Please don't tell me I should not be compiling the kernel, it's something I want to learn and also why not get some speed and better use of my hardware.

  • 1
    After invoking make menuconfig, for most menu entries there is associated <Help>. It should give you a brief description of that particular section/subsection/option/etc. An online version can be found here. Mar 10 '13 at 13:00

It's strange to see such a question from gentoo user.

To be able to choose thoughtfully you need to know what's each option about, so you'd better have a basic understanding of what the kernel is and how it works.

For start try read the gentoo manual http://www.gentoo.org/doc/en/kernel-config.xml, http://kernelnewbies.org/ or google about the linux kernel.

  • I know those sources but I still don't have a clear understanding. Specially that gentoo guide is a practical guide designed to help first time users to install gentoo, that's not what I'm looking for.
    – Vicfred
    Mar 10 '13 at 8:31

The simplest way to get to know the proper options would be to get a "default" .config file. Most kernel sources are distributed with a default file with all the proper options set for various configurations. These are stored in the directory configs, in the main kernel directory. If your architecture/system is supported, it might be quite simple to type:

make rconfig

where rconfig is the name of the default .config file for your system, located in configs folder.

Once this is done, you get a .config file in the kernel root, with all default options set. At this point, if you type:

make menuconfig

It will load all those defaults from the new .config file, and your task is now easier. You just need to scan over the options and see if you need to modify them yourself to suit any specific configuration needs. The .config file is a text file, which can be grep-ed to see where your default option lies.

Let's say you have a default config file and you're seeing how you can implement tunneling support into it. You can simply do the following:

grep -in 'tun' .config

And you will see it output the line:


Once you remove the comment and put Y instead of N, the kernel configuration changes to provide tunneling driver.


This is what I do when I install gentoo on new hardware.

  • Start with a default config from kernel-seeds

  • Inspect (lsmod, modinfo) the modules loaded by the livecd (which I'm running to install gentoo) and enable them

This gets me started with a bootable kernel, and after that I keep on tweaking the options, keeping this kernel as backup.


I found this document which explains exactly what I was looking for, I hope it's useful for some of you http://www.linuxtopia.org/online_books/linux_kernel/kernel_configuration/ch08s02.html

Read the entire document, it's full of nice things, specially this:

When the topic of this book was first presented to me, I dismissed it as something that was already covered by the plentiful documentation about the Linux kernel. Surely someone had already written down all of the basics needed in order to build, install, and customize the Linux kernel, as it seemed to be a very simple task to me.

After digging through the different HOWTOs and the Linux kernel Documentation directory, I came to the conclusion that there was not any one place where all of this information could be found. It could be gleaned by referencing a few files here, and a few outdated websites there, but this was not acceptable for anyone who did not know exactly what they were looking in the first place.

So this book was created with the goal of consolidating all of the existing information already scattered around the Internet about building the Linux kernel, as well as adding a lot of new and useful information that was not written down anywhere but had been learned by trial and error over my years of doing kernel development.

My secret goal of this book is to bring more people into the Linux kernel development fold. The act of building a customized kernel for your machine is one of the basic tasks needed to become a Linux kernel developer. The more people that try this out, and realize that there is not any real magic behind the whole Linux kernel process, the more people will be willing to jump in and help out in making the kernel the best that it can be.


You won't get better speed from compiling your own kernel. You will get the experience and a memory of the pain. You will save hundreds of kilobytes of memory if you do it right.

At a minimum, run make localmodconfig to include all the drivers that are currently loaded into the kernel. This will ensure that you aren't missing some key driver that you are using right now.

You should still include additional drivers as modules for all the USB and other hotpluggable devices you'll want to add one day. Check that you have included everything you need to boot directly in the kernel, too. It's easier on that front if you only include initramfs capability and put everything else as a module — but don't forget to rebuild the initramfs.

  • As I said I'm doing this mainly because of knowledge, also your answer does not really answer anything. Next time actually read the question.
    – Vicfred
    Mar 10 '13 at 23:28
  • @Vicfred Did you read my answer? Most issues when compiling your own kernel are due to forgetting a necessary driver, and make localmodconfig ensures that all necessary drivers are included. Mar 10 '13 at 23:32
  • That sounds like I'm already running a compiled kernel. I'm interested in general methods to know which modules are necessary and which are not.
    – Vicfred
    Mar 10 '13 at 23:59
  • @Vicfred There is no general method. You need to carefully read the description of every option and decide whether it applies to you. After all, if there was a magic wand you could wave, it wouldn't be fun, would it? If you want something that works, use the tools that were designed for the purpose and learn from the experience of others. Mar 11 '13 at 22:04
  • using the tools is general enough for me, I just want to know more tools
    – Vicfred
    Mar 12 '13 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.