
On Thu, May 19, 2016 at 1:51 AM, Masahiro Yamada yamada.masahiro@socionext.com wrote:
Commit 96464badc794 ("moveconfig: Always run savedefconfig on the moved config") changed the work flow of this tool a lot from the original intention when this tool was designed first.
Since then, before running this tool, users must edit the Kconfig to add the menu entries for the configs they are moving. It means users had already specified the type and the default value for each CONFIG via the Kconfig entries. Nevertheless, users are still required to dictate the same type and the default value in each line of the input file. So, my idea here is to deprecate the latter.
Before moving forward with it, there is one thing worth mentioning; since the savedefconfig re-sync was introduced, there is a case this tool can not handle correctly.
Let's say we are moving CONFIG_FOO from board headers to Kconfig, and we want to make it "default y" option. First, we are supposed to create an entry:
config FOO bool "foo" default y
CONFIG_FOO=y will appear in the .config for every processed defconfig. It will be duplicated to the include/autoconf.mk as well unless the board explicitly #undef's it. Therefore, the defconfig without "#define CONFIG_FOO" or "#undef CONFIG_FOO" that should be converted to "unset" would be misconverted to "=y".
I solved this in a patch I sent long ago, but it was never applied.
Anyway, this has been a problem for a while. Yet, I am not inclined to revert that commit because the "create a Kconfig entry beforehand, and sync with savedefconfig" approach has been successful in practical use cases. I will come back to this problem with a different solution in a few commits later.
For other use cases, I see no reason to require redundant dictation in the input file of this tool. Instead, the tool can know the types and default values by parsing the .config file.
This commit changes the tool to use the CONFIG names, but ignore the types and default values given by the input file.
This commit also fixes one bug. Before this commit, the tool could not move a integer-typed CONFIG with value 1.
For example, assume we are moving CONFIG_CONS_INDEX. Please note this is a integer type option.
Many board headers define this CONFIG as 1.
#define CONFIG_CONS_INDEX 1
It will be converted to
CONFIG_CONS_INDEX=y
and moved to include/autoconf.mk, by the tools/scripts/define2mk.sed. It will cause "make savedefconfig" to fail due to the type conflict.
This commit takes care of it by detecting the type and converting the CONFIG value correctly.
Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com
Reviewed-by: Joe Hershberger joe.hershberger@ni.com