All of lore.kernel.org
 help / color / mirror / Atom feed
* hidden string Kconfig ?
@ 2018-11-14 22:32 Daniel Walker
  2018-11-14 23:16 ` Randy Dunlap
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Walker @ 2018-11-14 22:32 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild

Hi,


I'm trying to find out if it's possible to have a string in Kconfig which is
hidden from the menu, but still exists in the .config? 

Like,

HIDDEN_STRING
	string

then in the config file there would be,
CONFIG_HIDDEN_STRING="hidden"

and the config option wouldn't be used for anything inside Kconfig. It would
just get set from the .config , or not be set?

The above sample, I've not been able to make work. The string in the .config
gets erased when menuconfig runs.

Any help appreciated.

Daniel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: hidden string Kconfig ?
  2018-11-14 22:32 hidden string Kconfig ? Daniel Walker
@ 2018-11-14 23:16 ` Randy Dunlap
  2018-11-14 23:56   ` Ulf Magnusson
  2018-11-15  0:07   ` Daniel Walker
  0 siblings, 2 replies; 13+ messages in thread
From: Randy Dunlap @ 2018-11-14 23:16 UTC (permalink / raw)
  To: Daniel Walker, Masahiro Yamada; +Cc: linux-kbuild

On 11/14/18 2:32 PM, Daniel Walker wrote:
> Hi,
> 
> 
> I'm trying to find out if it's possible to have a string in Kconfig which is
> hidden from the menu, but still exists in the .config? 
> 
> Like,
> 
> HIDDEN_STRING
> 	string
> 
> then in the config file there would be,
> CONFIG_HIDDEN_STRING="hidden"
> 
> and the config option wouldn't be used for anything inside Kconfig. It would
> just get set from the .config , or not be set?
> 
> The above sample, I've not been able to make work. The string in the .config
> gets erased when menuconfig runs.
> 
> Any help appreciated.

Hi,

There are several "string" Kconfig symbols in init/Kconfig that do not have
a prompt string after them.  I believe that these do what you are asking about.
If not, please provide your example that is not working.

Or:  this one works for me:

---
 init/Kconfig |    4 ++++
 1 file changed, 4 insertions(+)

--- linux-next-20181114.orig/init/Kconfig
+++ linux-next-20181114/init/Kconfig
@@ -1858,6 +1858,10 @@ config CMDLINE
 
 endif
 
+config SPECIAL_STRING
+	string
+	default "special"
+
 endmenu		# General setup
 
 source "arch/Kconfig"


and "make oldconfig" gives me a .config file that contains:
CONFIG_SPECIAL_STRING="special"


HTH.  or ask more questions...

-- 
~Randy

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: hidden string Kconfig ?
  2018-11-14 23:16 ` Randy Dunlap
@ 2018-11-14 23:56   ` Ulf Magnusson
  2018-11-15  0:07   ` Daniel Walker
  1 sibling, 0 replies; 13+ messages in thread
From: Ulf Magnusson @ 2018-11-14 23:56 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: danielwa, Masahiro Yamada, Linux Kbuild mailing list

On Thu, Nov 15, 2018 at 12:16 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> On 11/14/18 2:32 PM, Daniel Walker wrote:
> > Hi,
> >
> >
> > I'm trying to find out if it's possible to have a string in Kconfig which is
> > hidden from the menu, but still exists in the .config?
> >
> > Like,
> >
> > HIDDEN_STRING
> >       string
> >
> > then in the config file there would be,
> > CONFIG_HIDDEN_STRING="hidden"
> >
> > and the config option wouldn't be used for anything inside Kconfig. It would
> > just get set from the .config , or not be set?
> >
> > The above sample, I've not been able to make work. The string in the .config
> > gets erased when menuconfig runs.
> >
> > Any help appreciated.
>
> Hi,
>
> There are several "string" Kconfig symbols in init/Kconfig that do not have
> a prompt string after them.  I believe that these do what you are asking about.
> If not, please provide your example that is not working.
>
> Or:  this one works for me:
>
> ---
>  init/Kconfig |    4 ++++
>  1 file changed, 4 insertions(+)
>
> --- linux-next-20181114.orig/init/Kconfig
> +++ linux-next-20181114/init/Kconfig
> @@ -1858,6 +1858,10 @@ config CMDLINE
>
>  endif
>
> +config SPECIAL_STRING
> +       string
> +       default "special"
> +
>  endmenu                # General setup
>
>  source "arch/Kconfig"

This will work.

Also worth noting is that assignments to symbols without prompts
('string "prompt"') in .config files have no effect on the symbol's
value when the .config file is read back in by Kconfig. Setting a
symbol's value in a .config file is effectively the same as setting it
in the menuconfig interface.

The reason promptless symbols still get written out is that it makes
.config a complete configuration file, which is important when .config
files are included in Makefiles to read configuration settings from
there (.config files use Make syntax).

As a note, Kbuild includes include/config/auto.conf (a generated
configuration file) instead of .config. That makes the build work even
if .config is outdated (you get an implicit olddefconfig).

Cheers,
Ulf

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: hidden string Kconfig ?
  2018-11-14 23:16 ` Randy Dunlap
  2018-11-14 23:56   ` Ulf Magnusson
@ 2018-11-15  0:07   ` Daniel Walker
  2018-11-15  0:37     ` Randy Dunlap
  1 sibling, 1 reply; 13+ messages in thread
From: Daniel Walker @ 2018-11-15  0:07 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Masahiro Yamada, linux-kbuild

On Wed, Nov 14, 2018 at 03:16:17PM -0800, Randy Dunlap wrote:
> Hi,
> 
> There are several "string" Kconfig symbols in init/Kconfig that do not have
> a prompt string after them.  I believe that these do what you are asking about.
> If not, please provide your example that is not working.
> 
> Or:  this one works for me:
> 
> ---
>  init/Kconfig |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> --- linux-next-20181114.orig/init/Kconfig
> +++ linux-next-20181114/init/Kconfig
> @@ -1858,6 +1858,10 @@ config CMDLINE
>  
>  endif
>  
> +config SPECIAL_STRING
> +	string
> +	default "special"
> +
>  endmenu		# General setup
>  
>  source "arch/Kconfig"
> 
> 
> and "make oldconfig" gives me a .config file that contains:
> CONFIG_SPECIAL_STRING="special"

I have this (in init/Kconfig),

config CMDLINE
        string

then inside my .config I have this,
CONFIG_CMDLINE="console=ttyS0"

if you run  "make menuconfig", and change something then save. The
CONFIG_CMDLINE is gone.

What I would want is for that option to remain untouched.


Daniel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: hidden string Kconfig ?
  2018-11-15  0:07   ` Daniel Walker
@ 2018-11-15  0:37     ` Randy Dunlap
  2018-11-15  0:47       ` Daniel Walker
  0 siblings, 1 reply; 13+ messages in thread
From: Randy Dunlap @ 2018-11-15  0:37 UTC (permalink / raw)
  To: Daniel Walker; +Cc: Masahiro Yamada, linux-kbuild

On 11/14/18 4:07 PM, Daniel Walker wrote:
> On Wed, Nov 14, 2018 at 03:16:17PM -0800, Randy Dunlap wrote:
>> Hi,
>>
>> There are several "string" Kconfig symbols in init/Kconfig that do not have
>> a prompt string after them.  I believe that these do what you are asking about.
>> If not, please provide your example that is not working.
>>
>> Or:  this one works for me:
>>
>> ---
>>  init/Kconfig |    4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> --- linux-next-20181114.orig/init/Kconfig
>> +++ linux-next-20181114/init/Kconfig
>> @@ -1858,6 +1858,10 @@ config CMDLINE
>>  
>>  endif
>>  
>> +config SPECIAL_STRING
>> +	string
>> +	default "special"
>> +
>>  endmenu		# General setup
>>  
>>  source "arch/Kconfig"
>>
>>
>> and "make oldconfig" gives me a .config file that contains:
>> CONFIG_SPECIAL_STRING="special"
> 
> I have this (in init/Kconfig),
> 
> config CMDLINE
>         string
> 
> then inside my .config I have this,
> CONFIG_CMDLINE="console=ttyS0"
> 
> if you run  "make menuconfig", and change something then save. The
> CONFIG_CMDLINE is gone.
> 
> What I would want is for that option to remain untouched.

Interesting.  I guess luckily for me I was testing with today's linux-next,
which contains the CMDLINE Kconfig symbols in init/Kconfig, including this one:

config CMDLINE
	string ""


and that does work with your "console=ttyS0" + make oldconfig or make xconfig.

But apparently the string does need to have a prompt ("").
Without that (as you listed it), the value does disappear.


-- 
~Randy

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: hidden string Kconfig ?
  2018-11-15  0:37     ` Randy Dunlap
@ 2018-11-15  0:47       ` Daniel Walker
  2018-11-15  0:48         ` Randy Dunlap
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Walker @ 2018-11-15  0:47 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Masahiro Yamada, linux-kbuild

On Wed, Nov 14, 2018 at 04:37:43PM -0800, Randy Dunlap wrote:
> On 11/14/18 4:07 PM, Daniel Walker wrote:
> > On Wed, Nov 14, 2018 at 03:16:17PM -0800, Randy Dunlap wrote:
> >> Hi,
> >>
> >> There are several "string" Kconfig symbols in init/Kconfig that do not have
> >> a prompt string after them.  I believe that these do what you are asking about.
> >> If not, please provide your example that is not working.
> >>
> >> Or:  this one works for me:
> >>
> >> ---
> >>  init/Kconfig |    4 ++++
> >>  1 file changed, 4 insertions(+)
> >>
> >> --- linux-next-20181114.orig/init/Kconfig
> >> +++ linux-next-20181114/init/Kconfig
> >> @@ -1858,6 +1858,10 @@ config CMDLINE
> >>  
> >>  endif
> >>  
> >> +config SPECIAL_STRING
> >> +	string
> >> +	default "special"
> >> +
> >>  endmenu		# General setup
> >>  
> >>  source "arch/Kconfig"
> >>
> >>
> >> and "make oldconfig" gives me a .config file that contains:
> >> CONFIG_SPECIAL_STRING="special"
> > 
> > I have this (in init/Kconfig),
> > 
> > config CMDLINE
> >         string
> > 
> > then inside my .config I have this,
> > CONFIG_CMDLINE="console=ttyS0"
> > 
> > if you run  "make menuconfig", and change something then save. The
> > CONFIG_CMDLINE is gone.
> > 
> > What I would want is for that option to remain untouched.
> 
> Interesting.  I guess luckily for me I was testing with today's linux-next,
> which contains the CMDLINE Kconfig symbols in init/Kconfig, including this one:
> 
> config CMDLINE
> 	string ""
> 
> 
> and that does work with your "console=ttyS0" + make oldconfig or make xconfig.
> 
> But apparently the string does need to have a prompt ("").
> Without that (as you listed it), the value does disappear.

Yeah, the patch your talking about is from my -next tree. I'm trying to get rid
of the prompt .. There is no description, and no one should be setting that.
It's only there so that people don't lose their old CONFIG_CMDLINE.

It seems like Kconfig should be able to handle this because you may have an
obsolete string option which you may want to retain silently in the Kconfig.

Daniel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: hidden string Kconfig ?
  2018-11-15  0:47       ` Daniel Walker
@ 2018-11-15  0:48         ` Randy Dunlap
  2018-11-15  2:50           ` Masahiro Yamada
  0 siblings, 1 reply; 13+ messages in thread
From: Randy Dunlap @ 2018-11-15  0:48 UTC (permalink / raw)
  To: Daniel Walker; +Cc: Masahiro Yamada, linux-kbuild

On 11/14/18 4:47 PM, Daniel Walker wrote:
> On Wed, Nov 14, 2018 at 04:37:43PM -0800, Randy Dunlap wrote:
>> On 11/14/18 4:07 PM, Daniel Walker wrote:
>>> On Wed, Nov 14, 2018 at 03:16:17PM -0800, Randy Dunlap wrote:
>>>> Hi,
>>>>
>>>> There are several "string" Kconfig symbols in init/Kconfig that do not have
>>>> a prompt string after them.  I believe that these do what you are asking about.
>>>> If not, please provide your example that is not working.
>>>>
>>>> Or:  this one works for me:
>>>>
>>>> ---
>>>>  init/Kconfig |    4 ++++
>>>>  1 file changed, 4 insertions(+)
>>>>
>>>> --- linux-next-20181114.orig/init/Kconfig
>>>> +++ linux-next-20181114/init/Kconfig
>>>> @@ -1858,6 +1858,10 @@ config CMDLINE
>>>>  
>>>>  endif
>>>>  
>>>> +config SPECIAL_STRING
>>>> +	string
>>>> +	default "special"
>>>> +
>>>>  endmenu		# General setup
>>>>  
>>>>  source "arch/Kconfig"
>>>>
>>>>
>>>> and "make oldconfig" gives me a .config file that contains:
>>>> CONFIG_SPECIAL_STRING="special"
>>>
>>> I have this (in init/Kconfig),
>>>
>>> config CMDLINE
>>>         string
>>>
>>> then inside my .config I have this,
>>> CONFIG_CMDLINE="console=ttyS0"
>>>
>>> if you run  "make menuconfig", and change something then save. The
>>> CONFIG_CMDLINE is gone.
>>>
>>> What I would want is for that option to remain untouched.
>>
>> Interesting.  I guess luckily for me I was testing with today's linux-next,
>> which contains the CMDLINE Kconfig symbols in init/Kconfig, including this one:
>>
>> config CMDLINE
>> 	string ""
>>
>>
>> and that does work with your "console=ttyS0" + make oldconfig or make xconfig.
>>
>> But apparently the string does need to have a prompt ("").
>> Without that (as you listed it), the value does disappear.
> 
> Yeah, the patch your talking about is from my -next tree. I'm trying to get rid
> of the prompt .. There is no description, and no one should be setting that.
> It's only there so that people don't lose their old CONFIG_CMDLINE.

Yeah, not surprised to hear that.

> It seems like Kconfig should be able to handle this because you may have an
> obsolete string option which you may want to retain silently in the Kconfig.

OK, I'll let the kconfig maintainer comment on that.

-- 
~Randy

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: hidden string Kconfig ?
  2018-11-15  0:48         ` Randy Dunlap
@ 2018-11-15  2:50           ` Masahiro Yamada
  2018-11-15 13:25             ` Daniel Walker
  0 siblings, 1 reply; 13+ messages in thread
From: Masahiro Yamada @ 2018-11-15  2:50 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: danielwa, Linux Kbuild mailing list

On Thu, Nov 15, 2018 at 9:50 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> On 11/14/18 4:47 PM, Daniel Walker wrote:
> > On Wed, Nov 14, 2018 at 04:37:43PM -0800, Randy Dunlap wrote:
> >> On 11/14/18 4:07 PM, Daniel Walker wrote:
> >>> On Wed, Nov 14, 2018 at 03:16:17PM -0800, Randy Dunlap wrote:
> >>>> Hi,
> >>>>
> >>>> There are several "string" Kconfig symbols in init/Kconfig that do not have
> >>>> a prompt string after them.  I believe that these do what you are asking about.
> >>>> If not, please provide your example that is not working.
> >>>>
> >>>> Or:  this one works for me:
> >>>>
> >>>> ---
> >>>>  init/Kconfig |    4 ++++
> >>>>  1 file changed, 4 insertions(+)
> >>>>
> >>>> --- linux-next-20181114.orig/init/Kconfig
> >>>> +++ linux-next-20181114/init/Kconfig
> >>>> @@ -1858,6 +1858,10 @@ config CMDLINE
> >>>>
> >>>>  endif
> >>>>
> >>>> +config SPECIAL_STRING
> >>>> +  string
> >>>> +  default "special"
> >>>> +
> >>>>  endmenu           # General setup
> >>>>
> >>>>  source "arch/Kconfig"
> >>>>
> >>>>
> >>>> and "make oldconfig" gives me a .config file that contains:
> >>>> CONFIG_SPECIAL_STRING="special"
> >>>
> >>> I have this (in init/Kconfig),
> >>>
> >>> config CMDLINE
> >>>         string
> >>>
> >>> then inside my .config I have this,
> >>> CONFIG_CMDLINE="console=ttyS0"
> >>>
> >>> if you run  "make menuconfig", and change something then save. The
> >>> CONFIG_CMDLINE is gone.
> >>>
> >>> What I would want is for that option to remain untouched.
> >>
> >> Interesting.  I guess luckily for me I was testing with today's linux-next,
> >> which contains the CMDLINE Kconfig symbols in init/Kconfig, including this one:
> >>
> >> config CMDLINE
> >>      string ""
> >>
> >>
> >> and that does work with your "console=ttyS0" + make oldconfig or make xconfig.
> >>
> >> But apparently the string does need to have a prompt ("").
> >> Without that (as you listed it), the value does disappear.
> >
> > Yeah, the patch your talking about is from my -next tree. I'm trying to get rid
> > of the prompt .. There is no description, and no one should be setting that.
> > It's only there so that people don't lose their old CONFIG_CMDLINE.
>
> Yeah, not surprised to hear that.
>
> > It seems like Kconfig should be able to handle this because you may have an
> > obsolete string option which you may want to retain silently in the Kconfig.
>
> OK, I'll let the kconfig maintainer comment on that.



In current Kconfig, a 'string' type symbol is written to the .config when

[1] it has a visible prompt
    https://github.com/masahir0y/linux/blob/v4.19/scripts/kconfig/symbol.c#L364

   or

[2] it has a default property
    https://github.com/masahir0y/linux/blob/v4.19/scripts/kconfig/symbol.c#L421



I am open to changing the behavior
as long as it keeps grammatical consistency, though.


As far as I understood this particular case,
CONFIG_CMDLINE will go away after the GENERIC_CMDLINE migration is done.

(At least, upstream x86 and powerpc defconfig files seem complete).



Perhaps, some prompt for migration could be useful?

config CMDLINE
        string "(LEGACY) Please make this empty and use CMDLINE_PREPEND instead"




-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: hidden string Kconfig ?
  2018-11-15  2:50           ` Masahiro Yamada
@ 2018-11-15 13:25             ` Daniel Walker
  2018-11-15 16:20               ` Ulf Magnusson
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Walker @ 2018-11-15 13:25 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Randy Dunlap, Linux Kbuild mailing list

On Thu, Nov 15, 2018 at 11:50:56AM +0900, Masahiro Yamada wrote:
> 
> 
> In current Kconfig, a 'string' type symbol is written to the .config when
> 
> [1] it has a visible prompt
>     https://github.com/masahir0y/linux/blob/v4.19/scripts/kconfig/symbol.c#L364
> 
>    or
> 
> [2] it has a default property
>     https://github.com/masahir0y/linux/blob/v4.19/scripts/kconfig/symbol.c#L421
> 
 
Ok.


> 
> I am open to changing the behavior
> as long as it keeps grammatical consistency, though.
> 
> 
> As far as I understood this particular case,
> CONFIG_CMDLINE will go away after the GENERIC_CMDLINE migration is done.
> 
> (At least, upstream x86 and powerpc defconfig files seem complete).
> 
> 
> 
> Perhaps, some prompt for migration could be useful?
> 
> config CMDLINE
>         string "(LEGACY) Please make this empty and use CMDLINE_PREPEND instead"

I think it would be confusing to leave it. The reason I wanted to have it in
there silently is so I can print a warning, or BUILD_BUG_ON (which is what I
currently do). Just so that people 1) don't lose those options, and 2) So that I
can remind or catch people when they don't notice there was a change. Russell
(ARM32 maintainer) complained in this regard.

I'll look into the Kconfig code and see if I can make something acceptable.

Daniel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: hidden string Kconfig ?
  2018-11-15 13:25             ` Daniel Walker
@ 2018-11-15 16:20               ` Ulf Magnusson
  2018-11-15 17:01                 ` Daniel Walker
  0 siblings, 1 reply; 13+ messages in thread
From: Ulf Magnusson @ 2018-11-15 16:20 UTC (permalink / raw)
  To: danielwa; +Cc: Masahiro Yamada, Randy Dunlap, Linux Kbuild mailing list

On Thu, Nov 15, 2018 at 2:25 PM Daniel Walker <danielwa@cisco.com> wrote:
>
> On Thu, Nov 15, 2018 at 11:50:56AM +0900, Masahiro Yamada wrote:
> >
> >
> > In current Kconfig, a 'string' type symbol is written to the .config when
> >
> > [1] it has a visible prompt
> >     https://github.com/masahir0y/linux/blob/v4.19/scripts/kconfig/symbol.c#L364
> >
> >    or
> >
> > [2] it has a default property
> >     https://github.com/masahir0y/linux/blob/v4.19/scripts/kconfig/symbol.c#L421
> >
>
> Ok.
>
>
> >
> > I am open to changing the behavior
> > as long as it keeps grammatical consistency, though.
> >
> >
> > As far as I understood this particular case,
> > CONFIG_CMDLINE will go away after the GENERIC_CMDLINE migration is done.
> >
> > (At least, upstream x86 and powerpc defconfig files seem complete).
> >
> >
> >
> > Perhaps, some prompt for migration could be useful?
> >
> > config CMDLINE
> >         string "(LEGACY) Please make this empty and use CMDLINE_PREPEND instead"
>
> I think it would be confusing to leave it. The reason I wanted to have it in
> there silently is so I can print a warning, or BUILD_BUG_ON (which is what I
> currently do). Just so that people 1) don't lose those options, and 2) So that I
> can remind or catch people when they don't notice there was a change. Russell
> (ARM32 maintainer) complained in this regard.
>
> I'll look into the Kconfig code and see if I can make something acceptable.
>
> Daniel

Note that it'd be inconsistent for string symbols to respect user
values (values from .config files) when they don't have a prompt. A
prompt says that the symbol can be assigned a value by the user.
Assigning a symbol a value in a .config file is the same as assigning
it a value in the menuconfig interface.

(See my previous message for why promptless symbol still end up in
.config. The assignments to promptless symbols don't influence the
symbol's value on the Kconfig side.)

I wonder if having an exception for a one-off like this is really
worth it. It might make the Kconfig semantics harder to understand.
The rule now is that symbols without prompts always derive their value
from other symbols (via defaults, in this case).

See https://docs.zephyrproject.org/latest/application/kconfig-tips.html#optional-prompts
for a way to make prompts optional. Not sure if it'd be helpful here
though.

Cheers,
Ulf

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: hidden string Kconfig ?
  2018-11-15 16:20               ` Ulf Magnusson
@ 2018-11-15 17:01                 ` Daniel Walker
  2018-11-15 18:44                   ` Ulf Magnusson
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Walker @ 2018-11-15 17:01 UTC (permalink / raw)
  To: Ulf Magnusson; +Cc: Masahiro Yamada, Randy Dunlap, Linux Kbuild mailing list

On Thu, Nov 15, 2018 at 05:20:16PM +0100, Ulf Magnusson wrote:
> On Thu, Nov 15, 2018 at 2:25 PM Daniel Walker <danielwa@cisco.com> wrote:
> >
> > On Thu, Nov 15, 2018 at 11:50:56AM +0900, Masahiro Yamada wrote:
> > >
> > >
> > > In current Kconfig, a 'string' type symbol is written to the .config when
> > >
> > > [1] it has a visible prompt
> > >     https://github.com/masahir0y/linux/blob/v4.19/scripts/kconfig/symbol.c#L364
> > >
> > >    or
> > >
> > > [2] it has a default property
> > >     https://github.com/masahir0y/linux/blob/v4.19/scripts/kconfig/symbol.c#L421
> > >
> >
> > Ok.
> >
> >
> > >
> > > I am open to changing the behavior
> > > as long as it keeps grammatical consistency, though.
> > >
> > >
> > > As far as I understood this particular case,
> > > CONFIG_CMDLINE will go away after the GENERIC_CMDLINE migration is done.
> > >
> > > (At least, upstream x86 and powerpc defconfig files seem complete).
> > >
> > >
> > >
> > > Perhaps, some prompt for migration could be useful?
> > >
> > > config CMDLINE
> > >         string "(LEGACY) Please make this empty and use CMDLINE_PREPEND instead"
> >
> > I think it would be confusing to leave it. The reason I wanted to have it in
> > there silently is so I can print a warning, or BUILD_BUG_ON (which is what I
> > currently do). Just so that people 1) don't lose those options, and 2) So that I
> > can remind or catch people when they don't notice there was a change. Russell
> > (ARM32 maintainer) complained in this regard.
> >
> > I'll look into the Kconfig code and see if I can make something acceptable.
> >
> > Daniel
> 
> Note that it'd be inconsistent for string symbols to respect user
> values (values from .config files) when they don't have a prompt. A
> prompt says that the symbol can be assigned a value by the user.
> Assigning a symbol a value in a .config file is the same as assigning
> it a value in the menuconfig interface.
 
We could do it differently, for example, if the config file has an option set,
then the Kconfig system should show a warning or error. I was thinking their
might be a way to do that already with the $(shell, ...) stuff , or $(error-if,
..) but I couldn't get those to work.

Like in my case if you have CONFIG_CMDLINE="none blank" then print a warning
letting people know that value disappeared. This is basically what I'm doing
right now, if you have that option it will trigger a BUILD_BUG_ON().

> (See my previous message for why promptless symbol still end up in
> .config. The assignments to promptless symbols don't influence the
> symbol's value on the Kconfig side.)
> 
> I wonder if having an exception for a one-off like this is really
> worth it. It might make the Kconfig semantics harder to understand.
> The rule now is that symbols without prompts always derive their value
> from other symbols (via defaults, in this case).

I would think others have this issue, when you have one version of Linux with
one Kconfig setup, then you have to migrate to a newer Kconfig setup. There
should be graceful ways to handle it.

Daniel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: hidden string Kconfig ?
  2018-11-15 17:01                 ` Daniel Walker
@ 2018-11-15 18:44                   ` Ulf Magnusson
  2018-11-27 15:20                     ` Daniel Walker
  0 siblings, 1 reply; 13+ messages in thread
From: Ulf Magnusson @ 2018-11-15 18:44 UTC (permalink / raw)
  To: danielwa; +Cc: Masahiro Yamada, Randy Dunlap, Linux Kbuild mailing list

On Thu, Nov 15, 2018 at 6:01 PM Daniel Walker <danielwa@cisco.com> wrote:
>
> On Thu, Nov 15, 2018 at 05:20:16PM +0100, Ulf Magnusson wrote:
> > On Thu, Nov 15, 2018 at 2:25 PM Daniel Walker <danielwa@cisco.com> wrote:
> > >
> > > On Thu, Nov 15, 2018 at 11:50:56AM +0900, Masahiro Yamada wrote:
> > > >
> > > >
> > > > In current Kconfig, a 'string' type symbol is written to the .config when
> > > >
> > > > [1] it has a visible prompt
> > > >     https://github.com/masahir0y/linux/blob/v4.19/scripts/kconfig/symbol.c#L364
> > > >
> > > >    or
> > > >
> > > > [2] it has a default property
> > > >     https://github.com/masahir0y/linux/blob/v4.19/scripts/kconfig/symbol.c#L421
> > > >
> > >
> > > Ok.
> > >
> > >
> > > >
> > > > I am open to changing the behavior
> > > > as long as it keeps grammatical consistency, though.
> > > >
> > > >
> > > > As far as I understood this particular case,
> > > > CONFIG_CMDLINE will go away after the GENERIC_CMDLINE migration is done.
> > > >
> > > > (At least, upstream x86 and powerpc defconfig files seem complete).
> > > >
> > > >
> > > >
> > > > Perhaps, some prompt for migration could be useful?
> > > >
> > > > config CMDLINE
> > > >         string "(LEGACY) Please make this empty and use CMDLINE_PREPEND instead"
> > >
> > > I think it would be confusing to leave it. The reason I wanted to have it in
> > > there silently is so I can print a warning, or BUILD_BUG_ON (which is what I
> > > currently do). Just so that people 1) don't lose those options, and 2) So that I
> > > can remind or catch people when they don't notice there was a change. Russell
> > > (ARM32 maintainer) complained in this regard.
> > >
> > > I'll look into the Kconfig code and see if I can make something acceptable.
> > >
> > > Daniel
> >
> > Note that it'd be inconsistent for string symbols to respect user
> > values (values from .config files) when they don't have a prompt. A
> > prompt says that the symbol can be assigned a value by the user.
> > Assigning a symbol a value in a .config file is the same as assigning
> > it a value in the menuconfig interface.
>
> We could do it differently, for example, if the config file has an option set,
> then the Kconfig system should show a warning or error. I was thinking their
> might be a way to do that already with the $(shell, ...) stuff , or $(error-if,
> ..) but I couldn't get those to work.
>
> Like in my case if you have CONFIG_CMDLINE="none blank" then print a warning
> letting people know that value disappeared. This is basically what I'm doing
> right now, if you have that option it will trigger a BUILD_BUG_ON().

Wonder if it might be good enough to put a prompt like "(Deprecated,
see help string) ..." and print a warning/error like "CONFIG_FOO will
be removed in version X, please use CONFIG_BAR instead" during the
build (if it's a problem that'd be super hard to debug).

>
> > (See my previous message for why promptless symbol still end up in
> > .config. The assignments to promptless symbols don't influence the
> > symbol's value on the Kconfig side.)
> >
> > I wonder if having an exception for a one-off like this is really
> > worth it. It might make the Kconfig semantics harder to understand.
> > The rule now is that symbols without prompts always derive their value
> > from other symbols (via defaults, in this case).
>
> I would think others have this issue, when you have one version of Linux with
> one Kconfig setup, then you have to migrate to a newer Kconfig setup. There
> should be graceful ways to handle it.

One other option I can think of is having something like 'option
deprecated/noset', and printing a warning if that symbol is assigned
to in a .config file. That's pretty easy to detect, including for
promptless symbols.

I'd go for the more manual version though. I wonder if this is
significant/common enough to warrant a Kconfig feature, and it can be
handled in other ways.

Cheers,
Ulf

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: hidden string Kconfig ?
  2018-11-15 18:44                   ` Ulf Magnusson
@ 2018-11-27 15:20                     ` Daniel Walker
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Walker @ 2018-11-27 15:20 UTC (permalink / raw)
  To: Ulf Magnusson; +Cc: Masahiro Yamada, Randy Dunlap, Linux Kbuild mailing list

On Thu, Nov 15, 2018 at 07:44:53PM +0100, Ulf Magnusson wrote:
> I'd go for the more manual version though. I wonder if this is
> significant/common enough to warrant a Kconfig feature, and it can be
> handled in other ways.


Here is something I came up with a couple weeks ago. It greps the config for an
option, then if it exists it will print something. I added coloring to allow me
to make the message red. I could formalize this more, and it might be useful for
other message people may want to print.


diff --git a/init/Kconfig b/init/Kconfig
index b59e856511e1..70fad5e142e5 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1842,6 +1842,14 @@ config CMDLINE_OVERRIDE
 	  This is used to work around broken boot loaders.  This should
 	  be set to 'N' under normal conditions.
 
+# If you have the old style CONFIG_CMDLINE inside your config you will lose these options
+# This serves as a warning to let you know that you are losing these options.
+m1 := \f\rYou appear to have the legacy option CONFIG_CMDLINE in your config.\f
+m2 := Be aware this option will be removed, and you will lose the contents\f
+m3 := unless you move to the new CONFIG_CMDLINE_PREPEND, CONFIG_CMDLINE_APPEND\f
+m4 := options.\f
+$(warning-if,$(success, grep -e "CONFIG_CMDLINE=\".\+\"" $(PWD)/$(O)/$(KCONFIG_CONFIG)), $(red, $(m1)$(m2)$(m3)$(m4)))
+
 endif
 
 endmenu		# General setup
diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include
index dad5583451af..7de7505388b7 100644
--- a/scripts/Kconfig.include
+++ b/scripts/Kconfig.include
@@ -28,3 +28,22 @@ ld-option = $(success,$(LD) -v $(1))
 
 # gcc version including patch level
 gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//')
+
+# Color sequences
+red        = ^[[31m$(1)^[[0m
+black      = ^[[30m$(1)^[[0m
+green      = ^[[32m$(1)^[[0m
+yellow     = ^[[33m$(1)^[[0m
+blue       = ^[[34m$(1)^[[0m
+magenta    = ^[[35m$(1)^[[0m
+cyan       = ^[[36m$(1)^[[0m
+white      = ^[[37m$(1)^[[0m
+default    = ^[[39m$(1)^[[0m
+
+# Text properties
+bold        = ^[[1m$(1)^[[0m
+#bold 		= ^[[1m$(1)^[[0m
+underlined 	= ^[[4m$(1)^[[0m
+blinking 	= ^[[5m$(1)^[[0m
+reset 		= ^[[0m$(1)^[[0m
+

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-11-28  2:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-14 22:32 hidden string Kconfig ? Daniel Walker
2018-11-14 23:16 ` Randy Dunlap
2018-11-14 23:56   ` Ulf Magnusson
2018-11-15  0:07   ` Daniel Walker
2018-11-15  0:37     ` Randy Dunlap
2018-11-15  0:47       ` Daniel Walker
2018-11-15  0:48         ` Randy Dunlap
2018-11-15  2:50           ` Masahiro Yamada
2018-11-15 13:25             ` Daniel Walker
2018-11-15 16:20               ` Ulf Magnusson
2018-11-15 17:01                 ` Daniel Walker
2018-11-15 18:44                   ` Ulf Magnusson
2018-11-27 15:20                     ` Daniel Walker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.