[PATCH 0/4] localmodconfig: Improve the number of modules removed

Steven Rostedt
2012-06-20T02:50:11Z

[-- Attachment #1: Type: text/plain, Size: 3000 bytes --]

make localmodconfig was used to make a minimal config but still make
sure that everything you enabled stays enabled. Thus, it took a
conservative approach when it came to disabling configs. If there was a
chance that disabling a config would cause a required module not to be
built, it would keep that config set.

There was a time it was discovered that a config without a prompt
may be required to build a module, but it was only set if another
config option was set, because that config option would select it.
If the second config option was a tristate, but did not directly
enable a module, localmodconfig would deselect it and cause the required
module to be built.

The simple and conservative way to handle this was to also enable all
configs that select a required module config. But this caused those
configs to include the configs that they depend on, as well as all
the configs that select it. This increased the number of modules being
kept much higher than what the minimal set that was needed.

One issue was that it would even include configs that were core and not
even a module.

Another issue is that there was no reason to enable all configs when just
one select would do.

The second and third patches fix this (the other two are clean ups
and added debugging facility). The first of the fix reads the original
.config file and only processes configs that are modules, and ignores
configs that are set as core (localmodconfig will not touch them anyway).

The second of the fixes was a bit of code change that would process
the direct modules first (one to one relationship with configs to their
modules in the Makefiles). Then it will include all the configs that
those modules depend on. After that set is complete, it kept track
of the configs without prompts (needing to enable the selects), it
would look at those configs requiring selects, check to see if one
of their selects is already selected by a set config (do nothing in
that case), and if not, then pick only one config that selects it and
set that.

With these changes, the number of modules my test case had went from
leaving 356 CONFIG_*=m set, to just 67 of them set.

A much smaller and quicker build.

Thanks to John David Yost (AlleyTrotter) for testing his config and
build as well.

If you want this code, I've already sent it to my for-next branch.

-- Steve

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-kconfig.git
for-next

Head SHA1: 4503379cb811809470ebefb58c943fe605bc3e29

Steven Rostedt (4):
localmodconfig: Comments and cleanup for streamline_config.pl
localmodconfig: Read in orig config file to avoid extra processing
localmodconfig: Check if configs are already set for selects
localmodconfig: Add debug environment variable LOCALMODCONFIG_DEBUG

----
scripts/kconfig/streamline_config.pl | 175 ++++++++++++++++++++++++++++++----
1 file changed, 158 insertions(+), 17 deletions(-)