From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752090AbYIVKCG (ORCPT ); Mon, 22 Sep 2008 06:02:06 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751645AbYIVKBy (ORCPT ); Mon, 22 Sep 2008 06:01:54 -0400 Received: from mx1.suse.de ([195.135.220.2]:45446 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751592AbYIVKBx (ORCPT ); Mon, 22 Sep 2008 06:01:53 -0400 Date: Mon, 22 Sep 2008 12:01:51 +0200 Message-ID: From: Takashi Iwai To: "Chris Li" Cc: "Giacomo A. Catenazzi" , "Mauro Carvalho Chehab" , "Steven Rostedt" , linux-kernel@vger.kernel.org Subject: Re: diet-kconfig: a script to trim unneeded kconfigs In-Reply-To: <70318cbf0809191655m89e4b4fo68c3693487afed98@mail.gmail.com> References: <20080918122541.2c3c7b39@areia.chehab.org> <48D27734.3040600@cateee.net> <48D36D02.4090003@cateee.net> <70318cbf0809191655m89e4b4fo68c3693487afed98@mail.gmail.com> User-Agent: Wanderlust/2.12.0 (Your Wildest Dreams) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 Emacs/22.2 (x86_64-suse-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Fri, 19 Sep 2008 16:55:51 -0700, Chris Li wrote: > > On Fri, Sep 19, 2008 at 9:01 AM, Takashi Iwai wrote: > > Yes. Your stuff would be actually helpful for people who want > > a really slim kernel config. > > Incidentally, I wrote such a script as well. In 64 lines of python code. > I attach the script in question in the mail. I use a approach very > similar to yours. But I work around some of the nasty part. Thanks, I'll check yours too soon. > It needs to start with kernel config has most of the modules enabled. > Most of the kernel config from the linux distribution is like that. > Then it try to parse the Kbuild looking for what kernel config produce > what module. It is not a 1 to 1 mapping. > > Once we have the mapping. It open /proc/modules to go over every > module. Remove the config which can produce those module from the > mapping. > > Now we have a blacklist of config produce modules but not the one we want. > > Then the last stage is just open a config file and filter out the config > option on the blacklist. Write the result to a new config file. I think a whitelist would be useful, too, e.g. for hotplug devices like usb. > I avoid arch/ and firmware/ because it is nasty. I figure module in > arch/ is small enough I don't mind building it. And the firmware directory, > if I don't build the module loads it. Those firmware will automatically skipped > any way. Agreed. > The little tricky part is some thing like this: > ======================== > ifeq ($(CONFIG_BLK_DEV_CMD640), m) > obj-m += cmd640.o > endif > ======================== > Internally it get convert it into: > "obj-$(CONFIG_BLK_DEV_CMD640) += cmd640.o" This should be fixed in Makefile. Care to submit a patch? Takashi