Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262630AbVCKJJ5 (ORCPT ); Fri, 11 Mar 2005 04:09:57 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262632AbVCKJJ5 (ORCPT ); Fri, 11 Mar 2005 04:09:57 -0500 Received: from cpe-24-94-57-164.stny.res.rr.com ([24.94.57.164]:51621 "EHLO localhost.localdomain") by vger.kernel.org with ESMTP id S262630AbVCKJHn (ORCPT ); Fri, 11 Mar 2005 04:07:43 -0500 Date: Fri, 11 Mar 2005 04:07:41 -0500 (EST) From: Steven Rostedt X-X-Sender: rostedt@localhost.localdomain Reply-To: rostedt@goodmis.org To: LKML Subject: [Announce] Stream line modules from .config with streamline_config.pl In-Reply-To: <200503110223.34461.dtor_core@ameritech.net> Message-ID: References: <200503110223.34461.dtor_core@ameritech.net> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-693439761-1110532061=:19798" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 7573 Lines: 157 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --8323328-693439761-1110532061=:19798 Content-Type: TEXT/PLAIN; charset=US-ASCII Hi all, I'm not sure if someone else did this, but I wrote this simple script that turns off the modules from your config file that you are not currently using. After downloading a new kernel I usually use the .config from my Debian distribution. But this usually has way too many modules turned on and my compile takes much longer than I prefer. So instead of searching for all the modules that I need in "make *config" I wrote this script to do it for me. It's a small simple perl script (that's why it's attached and not on some web site), and it can easily have options added to it, but it's good enough for me, so that's where I left it. Here's how it works and what it does. 1. Boot up the kernel that has the modules you want to load. 2. cd to the directory that holds the source of the kernel you just booted. 3. If it's not already there, copy the config file you want to start with to this directory, as .config. 4. Make sure all the modules you want/need are loaded. 5. run this script redirecting the output to another file. 6. copy this other file to .config (backing up your old one if you want). 7. Run "make oldconfig". What this script does is simply, reads all the makefiles in the current directory tree (find . -name Makefile). Searches each of these Makefiles for the string "obj-$(CONFIG.*) += ..." (the real regular expression is more complex, and the file is attached if you want to see it). It then stores the object files associated to the CONFIG_.* and it handles multiple lines that end with "\". Then it runs "lsmod" to get what modules are loaded. Finally it reads the .config file in the directory and prints it to standard output. When it finds a CONFIG_.*=m it checks to see if that config had an object from lsmod associated to it, if so, then it prints it as is, otherwise it turns it off. Here's what I did with my Debian distribution: cd /usr/src/linux-2.6.10 cp /boot/config-2.6.10-1-686-smp .config ~/bin/streamline_config > config_strip mv .config config_sav mv config_strip .config make oldconfig Now this is the config file that I start with when downloading other kernels. Obviously if you don't load all the modules you want, or later buy a new device that needs a module that wasn't loaded, you will need to figure out what module to add and compile it. Or use the saved config again (you did save it?) and do this all over. Well, do what you want with this, it's an unrescricted license. Comments? If someone else had already done something like this, let me know. But I wrote this and a colleage of mine suggested to send it here. So here it is. Cheers, -- Steve --8323328-693439761-1110532061=:19798 Content-Type: TEXT/x-perl; charset=US-ASCII; name="streamline_config.pl" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename="streamline_config.pl" IyEvdXNyL2Jpbi9wZXJsIC13DQojDQojIENvcHl3cml0ZSAyMDA1IC0gU3Rl dmVuIFJvc3RlZHQNCiMNCiMgVGhpcyBjb2RlIGhhcyBubyByZXN0cmljdGlv bnMgYW5kIE5PIFdBUlJBTlRZLiANCiMgIFVzZSBpdCBhdCB5b3VyIG93biBy aXNrLCBkbyB3aGF0IHlvdSB3YW50IHdpdGggaXQsDQojICBKdXN0IGRvbid0 IGJsYW1lIG1lLg0KIw0KIyAgSXQncyBzaW1wbGUgZW5vdWdoIHRvIGZpZ3Vy ZSBvdXQgaG93IHRoaXMgd29ya3MuDQojICBJZiBub3QsIHRoZW4geW91IGNh biBhc2sgbWUgYXQgc3RyaXBjb25maWdAZ29vZG1pcy5vcmcNCiMgIA0KIyBX aGF0IGl0IGRvZXM/DQojDQojICAgSWYgeW91IGhhdmUgaW5zd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IgIiRtb2R1bGUgY29uZmlnIG5vdCBmb3VuZCEhXG4i Ow0KCX0NCn0NCg0Kd2hpbGUoPENJTj4pIHsNCglpZiAoL14oQ09ORklHLiop PW0vKSB7DQoJCWlmIChkZWZpbmVkKCRjb25maWdzeyQxfSkpIHsNCgkJCXBy aW50Ow0KCQl9IGVsc2Ugew0KCQkJcHJpbnQgIiMgJDEgaXMgbm90IHNldFxu IjsNCgkJfQ0KCX0gZWxzZSB7DQoJCXByaW50Ow0KCX0NCn0NCmNsb3NlKENJ Tik7DQo= --8323328-693439761-1110532061=:19798-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/