diff mbox series

[04/23] kconfig: set SYMBOL_AUTO to the symbol marked with defconfig_list

Message ID 1518806331-7101-5-git-send-email-yamada.masahiro@socionext.com
State Accepted
Commit f4bc1eefc1608e9a7d40f5fdfc3acd560ba6f477
Headers show
Series kconfig: move compiler capability tests to Kconfig | expand

Commit Message

Masahiro Yamada Feb. 16, 2018, 6:38 p.m. UTC
The 'defconfig_list' is a weird attribute.  If the '.config' is
missing, conf_read_simple() iterates over all visible defaults,
then it uses the first one for which fopen() succeeds.

config DEFCONFIG_LIST
	string
	depends on !UML
	option defconfig_list
	default "/lib/modules/$UNAME_RELEASE/.config"
	default "/etc/kernel-config"
	default "/boot/config-$UNAME_RELEASE"
	default "$ARCH_DEFCONFIG"
	default "arch/$ARCH/defconfig"

However, like other symbols, the first visible default is always
written out to the .config file.  This might be different from what
has been actually used.

For example, on my machine, the third one "/boot/config-$UNAME_RELEASE"
is opened, like follows:

  $ rm .config
  $ make oldconfig 2>/dev/null
  scripts/kconfig/conf  --oldconfig Kconfig
  #
  # using defaults found in /boot/config-4.4.0-112-generic
  #
  *
  * Restart config...
  *
  *
  * IRQ subsystem
  *
  Expose irq internals in debugfs (GENERIC_IRQ_DEBUGFS) [N/y/?] (NEW)

However, the resulted .config file contains the first one since it is
visible:

  $ grep CONFIG_DEFCONFIG_LIST .config
  CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"

In order to stop confusing people, prevent this CONFIG option from
being written to the .config file.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

I'd like to fix the root case of this weirdness later.
(and other 'option' attributes as well)

But, this series is focusing a more important work in a bigger picture.

For now, I decided to just hide CONFIG_DEFCONFIG_LIST
from the .config file.


 scripts/kconfig/menu.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.7.4

Comments

Masahiro Yamada March 1, 2018, 3:05 p.m. UTC | #1
2018-02-17 3:38 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> The 'defconfig_list' is a weird attribute.  If the '.config' is

> missing, conf_read_simple() iterates over all visible defaults,

> then it uses the first one for which fopen() succeeds.

>

> config DEFCONFIG_LIST

>         string

>         depends on !UML

>         option defconfig_list

>         default "/lib/modules/$UNAME_RELEASE/.config"

>         default "/etc/kernel-config"

>         default "/boot/config-$UNAME_RELEASE"

>         default "$ARCH_DEFCONFIG"

>         default "arch/$ARCH/defconfig"

>

> However, like other symbols, the first visible default is always

> written out to the .config file.  This might be different from what

> has been actually used.

>

> For example, on my machine, the third one "/boot/config-$UNAME_RELEASE"

> is opened, like follows:

>

>   $ rm .config

>   $ make oldconfig 2>/dev/null

>   scripts/kconfig/conf  --oldconfig Kconfig

>   #

>   # using defaults found in /boot/config-4.4.0-112-generic

>   #

>   *

>   * Restart config...

>   *

>   *

>   * IRQ subsystem

>   *

>   Expose irq internals in debugfs (GENERIC_IRQ_DEBUGFS) [N/y/?] (NEW)

>

> However, the resulted .config file contains the first one since it is

> visible:

>

>   $ grep CONFIG_DEFCONFIG_LIST .config

>   CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"

>

> In order to stop confusing people, prevent this CONFIG option from

> being written to the .config file.

>

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

> ---



This one is almost trivial, so I will pick it up now.

Ulf, do you have any comment about this one?




> I'd like to fix the root case of this weirdness later.

> (and other 'option' attributes as well)

>

> But, this series is focusing a more important work in a bigger picture.

>

> For now, I decided to just hide CONFIG_DEFCONFIG_LIST

> from the .config file.

>

>

>  scripts/kconfig/menu.c | 1 +

>  1 file changed, 1 insertion(+)

>

> diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c

> index 9922285..36cd3e1 100644

> --- a/scripts/kconfig/menu.c

> +++ b/scripts/kconfig/menu.c

> @@ -212,6 +212,7 @@ void menu_add_option(int token, char *arg)

>                         sym_defconfig_list = current_entry->sym;

>                 else if (sym_defconfig_list != current_entry->sym)

>                         zconf_error("trying to redefine defconfig symbol");

> +               sym_defconfig_list->flags |= SYMBOL_AUTO;

>                 break;

>         case T_OPT_ENV:

>                 prop_add_env(arg);

> --

> 2.7.4

>

> --

> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in

> the body of a message to majordomo@vger.kernel.org

> More majordomo info at  http://vger.kernel.org/majordomo-info.html




-- 
Best Regards
Masahiro Yamada
Ulf Magnusson March 1, 2018, 5:11 p.m. UTC | #2
On Thu, Mar 1, 2018 at 4:05 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> 2018-02-17 3:38 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:

>> The 'defconfig_list' is a weird attribute.  If the '.config' is

>> missing, conf_read_simple() iterates over all visible defaults,

>> then it uses the first one for which fopen() succeeds.

>>

>> config DEFCONFIG_LIST

>>         string

>>         depends on !UML

>>         option defconfig_list

>>         default "/lib/modules/$UNAME_RELEASE/.config"

>>         default "/etc/kernel-config"

>>         default "/boot/config-$UNAME_RELEASE"

>>         default "$ARCH_DEFCONFIG"

>>         default "arch/$ARCH/defconfig"

>>

>> However, like other symbols, the first visible default is always

>> written out to the .config file.  This might be different from what

>> has been actually used.

>>

>> For example, on my machine, the third one "/boot/config-$UNAME_RELEASE"

>> is opened, like follows:

>>

>>   $ rm .config

>>   $ make oldconfig 2>/dev/null

>>   scripts/kconfig/conf  --oldconfig Kconfig

>>   #

>>   # using defaults found in /boot/config-4.4.0-112-generic

>>   #

>>   *

>>   * Restart config...

>>   *

>>   *

>>   * IRQ subsystem

>>   *

>>   Expose irq internals in debugfs (GENERIC_IRQ_DEBUGFS) [N/y/?] (NEW)

>>

>> However, the resulted .config file contains the first one since it is

>> visible:

>>

>>   $ grep CONFIG_DEFCONFIG_LIST .config

>>   CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"

>>

>> In order to stop confusing people, prevent this CONFIG option from

>> being written to the .config file.

>>

>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

>> ---

>

>

> This one is almost trivial, so I will pick it up now.

>

> Ulf, do you have any comment about this one?

>

>

>

>

>> I'd like to fix the root case of this weirdness later.

>> (and other 'option' attributes as well)

>>

>> But, this series is focusing a more important work in a bigger picture.

>>

>> For now, I decided to just hide CONFIG_DEFCONFIG_LIST

>> from the .config file.

>>

>>

>>  scripts/kconfig/menu.c | 1 +

>>  1 file changed, 1 insertion(+)

>>

>> diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c

>> index 9922285..36cd3e1 100644

>> --- a/scripts/kconfig/menu.c

>> +++ b/scripts/kconfig/menu.c

>> @@ -212,6 +212,7 @@ void menu_add_option(int token, char *arg)

>>                         sym_defconfig_list = current_entry->sym;

>>                 else if (sym_defconfig_list != current_entry->sym)

>>                         zconf_error("trying to redefine defconfig symbol");

>> +               sym_defconfig_list->flags |= SYMBOL_AUTO;

>>                 break;

>>         case T_OPT_ENV:

>>                 prop_add_env(arg);

>> --

>> 2.7.4

>>

>> --

>> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in

>> the body of a message to majordomo@vger.kernel.org

>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

>

>

>

> --

> Best Regards

> Masahiro Yamada


Seems reasonable to me.

Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>


Cheers,
Ulf
diff mbox series

Patch

diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 9922285..36cd3e1 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -212,6 +212,7 @@  void menu_add_option(int token, char *arg)
 			sym_defconfig_list = current_entry->sym;
 		else if (sym_defconfig_list != current_entry->sym)
 			zconf_error("trying to redefine defconfig symbol");
+		sym_defconfig_list->flags |= SYMBOL_AUTO;
 		break;
 	case T_OPT_ENV:
 		prop_add_env(arg);