SlackwareThis Forum is for the discussion of Slackware Linux.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Most people uses the kernel shipped by distros - and that's good. But some people like to compile their own kernels from kernel.org, or maybe they like following the Linux development and want to try it. Configuring your own kernel, however, has become a very difficult and tedious task - there're too many options, and some times userspace software will stop working if you don't enable some key option. You can use a standard distro .config file, but it takes too many time to compile all the options it enables.
To make easier the process of configuration, a new build target has been added: make localmodconfig. It runs "lsmod" to find all the modules loaded on the current running system. It will read all the Makefiles to map which CONFIG enables a module. It will read the Kconfig files to find the dependencies and selects that may be needed to support a CONFIG. Finally, it reads the .config file and removes any module "=m" that is not needed to enable the currently loaded modules. With this tool, you can strip a distro .config of all the unuseful drivers that are not needed in our machine, and it will take much less time to build the kernel. There's an additional "make localyesconfig" target, in case you don't want to use modules and/or initrds.
That's good news for those of us needing or wanting to build a new kernel and using a Slackware config file as a starting point
That is interesting news, and which will be very useful. On this note, I have always wondered if it was problematic with using a .config file from an earlier kernel release to use to build a new kernel from source. For example, if going from 22.214.171.124 to 2.6.32, if you load the .config from 126.96.36.199 into 2.6.32 when compiling, would problems result from this? The reason I ask is that I have done this before, and noticed when I loaded an older .config from an older kernel branch that there a few text exceptions thrown in the background, but couldn't quite make them out due to the kernel configuration menu being in the foreground. All seemed to build well with no errors in the process, so I don't know. Anyway, I'll be trying this new method in the future to see what results. Thanks for sharing this.
Last edited by swampdog2002; 12-07-2009 at 06:23 PM.
This is very interesting. I'll have to give this a try when I get off work tonight. Thanks for the heads up. I always have my custom configs saved but maybe this can help me thin out a few unneeded modues.
Very useful for people who do not "chop & change" their hardware. If this works well it should be possible to take a newly installed system with a huge.s kernel, run a script and have a kernel (optimised for your system) created and automatically added to your boot loader.
Thanks, this is useful info and will probably save plenty of time when building a kernel. Thanks also goes out to all the Linux kernel devs that made this possible.
Personally, I would start with perhaps a generic kernel, then run the 'make localmodconfig', then 'make menuconfig' and make sure things look good. You may want to enable some things that were not detected, but I'm sure it will help in keeping the kernel small, and possibly fast.
Ok I finally did it. Now with a customized 2.6.32 kernel. localmodconfig is quite useful but not that well implemented yet. I had inserted my USB drive before running localmodconfig, but at the end of the compilation process I was left without any USB support. I did a make clean and make menuconfig again to check out what happened and saw that "USB Mass storage support" was off and many USB options weren't auto-detected. My soundcard module wasnt picked up either. It's a generic Intel sound card. So I had to enable those modules and recompile kernel. Now everything works great. However this option did help me getting rid of a lot of unnecessary stuffs quite easily.
Last edited by ~sHyLoCk~; 12-08-2009 at 10:41 PM.
Reason: bad grammar :((
As seen through "make help", "make localyesconfig" could be handy too for people preferring having everything built-in.
Caveat: as already said, plug in your USB devices (or, more generally, removable devices) needing a specific driver first, or at least take a note of the modules they use so you can add it afterwards. For instance issue "make localmodconfig" then "make menuconfig" to add what would have been be missing.
Last edited by Didier Spaier; 12-10-2009 at 08:40 AM.
Reason: typo corrected