SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 2.6.29.6 to 2.6.32, if you load the .config from 2.6.29.6 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.
As to using an old config file, yes it's what I always do. Copy the old .config file to your new build directory and then run
Code:
make O=/your/build/directory oldconfig
And it will only ask you questions for new or changed features. After that you can double check with menuconfig/xconfig to make sure it's how you want it.
localmodconfig does look interesting but I haven't used it yet. I feel like I already have my configuration the way I want it. Of course there's always room for improvement.
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.
... But I would start with a generic kernel as if I understand well the only removed drivers with "make localmodconfig" are among those previously configured as modules.
Modules that aren't already loaded won't be available with your new kernel, plug in a USB stick before running "make localmodconfig". Or else no USB support.
Support for filesystems not currently in use will also be removed.
Check the config for excluded filesystems you may need (XFS, JFS and the like).
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.