Re: [PATCH 2/2] Enable 'make CONFIG_FOO=y oldconfig'

From: David Woodhouse
Date: Wed Aug 10 2011 - 09:08:06 EST


On Wed, 2011-08-10 at 14:59 +0200, Michal Marek wrote:
> I wasn't talking about the env= syntax, but about
>
> make CONFIG_EXT2_FS=m all
> which makes kbuild visit fs/ext2 even if CONFIG_EXT2_FS is disabled in
> .config. With no update of the configuration or checking the dependencies.
>
> Hm, actually this would be a problem even if kconfig does read the
> CONFIG_* variables from the environment, because it could result in a
> mismatch if kconfig determines that the variable cannot be set, but make
> still sees it in the environment. So we would have to use 'undefine
> CONFIG_FOO' instead of '# CONFIG_FOO is not set' in
> include/config/auto.conf, to be able to properly support make CONFIG_FOO=y.

That's always been true; it's *always* been broken like that.

But now we're actually *encouraging* people to start setting
CONFIG_FOO=y in the environment or the make command line, so we should
certainly make it more robust.

It should be simple enough to force a reconfig if CONFIG_* is specified
in the environment.

Actually, while we're at it let's stop just picking it up from the
environment and pick it up *only* if it's overridden in the make flags.

Something like this will list the variables which are overridden on the
command line:

CONFIG_OVERRIDES := $(patsubst line:%,%,$(filter line:%,$(foreach var, $(filter CONFIG_%,$(.VARIABLES)), $(origin $(var)):$(var))))

Then we can make auto.conf.cmd trigger a reconfig if it's non-empty, and
make the kconfig tool allow overrides *only* for those variables
specified in $CONFIG_OVERRIDES... which avoids any worries about "stray"
environment variables too.

I'll see if I can clean the above expression up and do that.

--
David Woodhouse Open Source Technology Centre
David.Woodhouse@xxxxxxxxx Intel Corporation

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/