1. 01 3月, 2018 1 次提交
  2. 10 2月, 2018 2 次提交
  3. 09 2月, 2018 6 次提交
    • M
      kconfig: send error messages to stderr · 9e3e10c7
      Masahiro Yamada 提交于
      These messages should be directed to stderr.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NUlf Magnusson <ulfalizer@gmail.com>
      9e3e10c7
    • M
      kconfig: echo stdin to stdout if either is redirected · f3ff6fb5
      Masahiro Yamada 提交于
      If stdio is not tty, conf_askvalue() puts additional new line to
      prevent prompts from being concatenated into a single line.  This
      care is missing in conf_choice(), so a 'choice' prompt and the next
      prompt are shown in the same line.
      
      Move the code into xfgets() to cater to all cases.  To improve this
      more, let's echo stdin to stdout.  This clarifies what keys were
      input from stdio and the stdout looks like as if it were from tty.
      
      I removed the isatty(2) check since stderr is unrelated here.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NUlf Magnusson <ulfalizer@gmail.com>
      f3ff6fb5
    • M
      kconfig: remove check_stdin() · d2a04648
      Masahiro Yamada 提交于
      Except silentoldconfig, valid_stdin is 1, so check_stdin() is no-op.
      
      oldconfig and silentoldconfig work almost in the same way except that
      the latter generates additional files under include/.  Both ask users
      for input for new symbols.
      
      I do not know why only silentoldconfig requires stdio be tty.
      
        $ rm -f .config; touch .config
        $ yes "" | make oldconfig > stdout
        $ rm -f .config; touch .config
        $ yes "" | make silentoldconfig > stdout
        make[1]: *** [silentoldconfig] Error 1
        make: *** [silentoldconfig] Error 2
        $ tail -n 4 stdout
        Console input/output is redirected. Run 'make oldconfig' to update configuration.
      
        scripts/kconfig/Makefile:40: recipe for target 'silentoldconfig' failed
        Makefile:507: recipe for target 'silentoldconfig' failed
      
      Redirection is useful, for example, for testing where we want to give
      particular key inputs from a test file, then check the result.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NUlf Magnusson <ulfalizer@gmail.com>
      d2a04648
    • M
      kconfig: remove 'config*' pattern from .gitignnore · cd58a91d
      Masahiro Yamada 提交于
      I could not figure out why this pattern should be ignored.
      Checking commit 1e65174a ("Add some basic .gitignore files")
      did not help.
      
      Let's remove this pattern, then see if it is really needed.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NUlf Magnusson <ulfalizer@gmail.com>
      cd58a91d
    • M
      kconfig: show '?' prompt even if no help text is available · 4f208f39
      Masahiro Yamada 提交于
      'make config', 'make oldconfig', etc. always receive '?' as a valid
      input and show useful information even if no help text is available.
      
      ------------------------>8------------------------
      foo (FOO) [N/y] (NEW) ?
      
      There is no help available for this option.
      Symbol: FOO [=n]
      Type  : bool
      Prompt: foo
        Defined at Kconfig:1
      ------------------------>8------------------------
      
      However, '?' is not shown in the prompt if its help text is missing.
      Let's show '?' all the time so that the prompt and the behavior match.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NUlf Magnusson <ulfalizer@gmail.com>
      4f208f39
    • M
      kconfig: do not write choice values when their dependency becomes n · cb67ab2c
      Masahiro Yamada 提交于
      "# CONFIG_... is not set" for choice values are wrongly written into
      the .config file if they are once visible, then become invisible later.
      
        Test case
        ---------
      
      ---------------------------(Kconfig)----------------------------
      config A
      	bool "A"
      
      choice
      	prompt "Choice ?"
      	depends on A
      
      config CHOICE_B
      	bool "Choice B"
      
      config CHOICE_C
      	bool "Choice C"
      
      endchoice
      ----------------------------------------------------------------
      
      ---------------------------(.config)----------------------------
      CONFIG_A=y
      ----------------------------------------------------------------
      
      With the Kconfig and .config above,
      
        $ make config
        scripts/kconfig/conf  --oldaskconfig Kconfig
        *
        * Linux Kernel Configuration
        *
        A (A) [Y/n] n
        #
        # configuration written to .config
        #
        $ cat .config
        #
        # Automatically generated file; DO NOT EDIT.
        # Linux Kernel Configuration
        #
        # CONFIG_A is not set
        # CONFIG_CHOICE_B is not set
        # CONFIG_CHOICE_C is not set
      
      Here,
      
        # CONFIG_CHOICE_B is not set
        # CONFIG_CHOICE_C is not set
      
      should not be written into the .config file because their dependency
      "depends on A" is unmet.
      
      Currently, there is no code that clears SYMBOL_WRITE of choice values.
      
      Clear SYMBOL_WRITE for all symbols in sym_calc_value(), then set it
      again after calculating visibility.  To simplify the logic, set the
      flag if they have non-n visibility, regardless of types, and regardless
      of whether they are choice values or not.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NUlf Magnusson <ulfalizer@gmail.com>
      cb67ab2c
  4. 02 2月, 2018 1 次提交
  5. 28 1月, 2018 1 次提交
  6. 25 1月, 2018 2 次提交
    • P
      kconfig: make "Selected by:" and "Implied by:" readable · 1ccb2714
      Petr Vorel 提交于
      Reverse dependency expressions can get rather unwieldy, especially if
      a symbol is selected by more than a handful of other symbols. I.e. it's
      possible to have near endless expressions like:
         A && B && !C || D || F && (G || H) || [...]
      
      Chop these expressions into actually readable chunks:
         - A && B && !C
         - D
         - F && (G || H)
         - [...]
      
      I.e. transform the top level OR tokens into newlines and prepend each
      line with a minus. This makes the "Selected by:" and "Implied by:" blurb
      much easier to read. This is done only if there is more than one top
      level OR. "Depends on:" and "Range :" were deliberately left as they are.
      
      Based on idea from Paul Bolle.
      Suggested-by: NPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: NPetr Vorel <petr.vorel@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      1ccb2714
    • M
      kconfig: announce removal of oldnoconfig if used · 312ee687
      Masahiro Yamada 提交于
      The 'oldnoconfig' is really confusing due to its counter-intuitive name.
      It was renamed by commit fb16d891 ("kconfig: replace 'oldnoconfig'
      with 'olddefconfig', and keep the old name as an alias").
      
      The 'oldnoconfig' has been kept as an alias for enough period of time,
      and finally I am planning to remove it.  I will give people a little
      more time for migration.  Meanwhile, the following message will be
      displayed if oldnoconfig is used.
      
          WARNING: "oldnoconfig" target will be removed after Linux 4.19
                    Please use "olddefconfig" instead, which is an alias.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NUlf Magnusson <ulfalizer@gmail.com>
      312ee687
  7. 22 1月, 2018 3 次提交
  8. 21 1月, 2018 15 次提交
  9. 11 1月, 2018 2 次提交
    • U
      kconfig: Don't leak 'option' arguments during parsing · bc28fe1d
      Ulf Magnusson 提交于
      The following strings would leak before this change:
      
      	- option env="LEAKED"
      	- option defconfig_list="LEAKED"
      
      These come in the form of T_WORD tokens and are always allocated on the
      heap in zconf.l. Free them.
      
      Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:
      
      	LEAK SUMMARY:
      	   definitely lost: 344,616 bytes in 14,355 blocks
      	   ...
      
      Summary after the fix:
      
      	LEAK SUMMARY:
      	   definitely lost: 344,568 bytes in 14,352 blocks
      	   ...
      Signed-off-by: NUlf Magnusson <ulfalizer@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      bc28fe1d
    • U
      kconfig: Don't leak 'source' filenames during parsing · 24161a67
      Ulf Magnusson 提交于
      The 'source_stmt' nonterminal takes a 'prompt', which consists of either
      a T_WORD or a T_WORD_QUOTE, both of which are always allocated on the
      heap in zconf.l and need to have their associated strings freed. Free
      them.
      
      The existing code already makes sure to always copy the string, but add
      a warning to sym_expand_string_value() to make it clear that the string
      must be copied, just in case.
      
      Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:
      
      	LEAK SUMMARY:
      	   definitely lost: 387,504 bytes in 15,545 blocks
      	   ...
      
      Summary after the fix:
      
      	LEAK SUMMARY:
      	   definitely lost: 344,616 bytes in 14,355 blocks
      	   ...
      Signed-off-by: NUlf Magnusson <ulfalizer@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      24161a67
  10. 10 1月, 2018 1 次提交
    • U
      kconfig: Don't leak symbol names during parsing · 26e47a3c
      Ulf Magnusson 提交于
      Prior to this fix, zconf.y did not free symbol names from zconf.l in
      these contexts:
      
      	- After T_CONFIG ('config LEAKED')
      	- After T_MENUCONFIG ('menuconfig LEAKED')
      	- After T_SELECT ('select LEAKED')
      	- After T_IMPLY ('imply LEAKED')
      	- After T_DEFAULT in a choice ('default LEAKED')
      
      All of these come in the form of T_WORD tokens, which always have their
      associated string allocated on the heap in zconf.l and need to be freed.
      
      Fix by introducing a new nonterminal 'nonconst_symbol' which takes a
      T_WORD, fetches the symbol, and then frees the T_WORD string. The
      already existing 'symbol' nonterminal works the same way but also
      accepts T_WORD_QUOTE, corresponding to a constant symbol. T_WORD_QUOTE
      should not be accepted in any of the contexts above, so the 'symbol'
      nonterminal can't be reused here.
      
      Fetching the symbol in 'nonconst_symbol' also removes a bunch of
      sym_lookup() calls from actions.
      
      Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:
      
      	LEAK SUMMARY:
      	   definitely lost: 711,571 bytes in 37,756 blocks
      	   ...
      
      Summary after the fix:
      
      	LEAK SUMMARY:
      	   definitely lost: 387,504 bytes in 15,545 blocks
                 ...
      Signed-off-by: NUlf Magnusson <ulfalizer@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      26e47a3c
  11. 06 1月, 2018 1 次提交
    • N
      kconfig: fix relational operators for bool and tristate symbols · 9059a349
      Nicolas Pitre 提交于
      Since commit 31847b67 ("kconfig: allow use of relations other than
      (in)equality") it is possible to use relational operators in Kconfig
      statements. However, those operators give unexpected results when
      applied to bool/tristate values:
      
      	(n < y) = y (correct)
      	(m < y) = y (correct)
      	(n < m) = n (wrong)
      
      This happens because relational operators process bool and tristate
      symbols as strings and m sorts before n. It makes little sense to do a
      lexicographical compare on bool and tristate values though.
      
      Documentation/kbuild/kconfig-language.txt states that expression can have
      a value of 'n', 'm' or 'y' (or 0, 1, 2 respectively for calculations).
      Let's make it so for relational comparisons with bool/tristate
      expressions as well and document them. If at least one symbol is an
      actual string then the lexicographical compare works just as before.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      Acked-by: NRandy Dunlap <rdunlap@infradead.org>
      Tested-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      9059a349
  12. 16 12月, 2017 2 次提交
    • M
      kconfig: generate lexer and parser during build instead of shipping · 29c83306
      Masahiro Yamada 提交于
      zconf.lex.c is generated by flex, zconf.tab.c by bison.  Instead of
      running flex and bison during the kernel building, we conventionally
      version-control those artifacts with _shipped suffix.
      
      It is tedious to manually regenerate them every time we change the
      real sources, zconf.l and zconf.y.
      
      Remove the _shipped files and switch over to build-time generation
      of the intermediate C files.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      29c83306
    • M
      kconfig: display recursive dependency resolution hint just once · e3b03bf2
      Masahiro Yamada 提交于
      Commit 1c199f28 ("kbuild: document recursive dependency limitation
      / resolution") probably intended to show a hint along with "recursive
      dependency detected!" error, but it missed to add {...} guard, and the
      hint is displayed in every loop of the dep_stack traverse, annoyingly.
      
      This error was detected by GCC's -Wmisleading-indentation when switching
      to build-time generation of lexer/parser.
      
      scripts/kconfig/symbol.c: In function ‘sym_check_print_recursive’:
      scripts/kconfig/symbol.c:1150:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
         if (stack->sym == last_sym)
         ^~
      scripts/kconfig/symbol.c:1153:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
          fprintf(stderr, "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n");
          ^~~~~~~
      
      I could simply add {...} to surround the three fprintf(), but I rather
      chose to move the hint after the loop to make the whole message readable.
      
      Fixes: 1c199f28 ("kbuild: document recursive dependency limitation / resolution"
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NLuis R. Rodriguez <mcgrof@kernel.org>
      e3b03bf2
  13. 15 12月, 2017 3 次提交
    • U
      kconfig: Clean up modules handling and fix crash · f77850d3
      Ulf Magnusson 提交于
      Kconfig currently doesn't handle 'm' appearing in a Kconfig file before
      the modules symbol is defined (the symbol with 'option modules'). The
      problem is the following code, which runs during parsing:
      
      	/* change 'm' into 'm' && MODULES */
      	if (e->left.sym == &symbol_mod)
      		return expr_alloc_and(e, expr_alloc_symbol(modules_sym));
      
      If the modules symbol has not yet been defined, modules_sym is NULL,
      giving an invalid expression.
      
      Here is a test file where both BEFORE_1 and BEFORE_2 trigger a segfault.
      If the modules symbol is removed, all symbols trigger segfaults.
      
      	config BEFORE_1
      		def_tristate y if m
      
      	if m
      	config BEFORE_2
      		def_tristate y
      	endif
      
      	config MODULES
      		def_bool y
      		option modules
      
      	config AFTER_1
      		def_tristate y if m
      
      	if m
      	config AFTER_2
      		def_tristate y
      	endif
      
      Fix the issue by rewriting 'm' in menu_finalize() instead. This function
      runs after parsing and is the proper place to do it. The following
      existing code in conf_parse() in zconf.y ensures that the modules symbol
      exists at that point:
      
      	if (!modules_sym)
      		modules_sym = sym_find( "n" );
      
      	...
      
      	menu_finalize(&rootmenu);
      
      The following tests were done to ensure no functional changes for
      configurations that don't reference 'm' before the modules symbol:
      
      	- zconfdump(stdout) was run with ARCH=x86 and ARCH=arm before
      	  and after the change and verified to produce identical output.
      	  This function prints all symbols, choices, and menus together
      	  with their properties and their dependency expressions. A
      	  rewritten 'm' appears as 'm && MODULES'.
      
      	  A small annoyance is that the assert(len != 0) in xfwrite()
      	  needs to be disabled in order to use zconfdump(), because it
      	  chokes on e.g. 'default ""'.
      
      	- The Kconfiglib test suite was run to indirectly verify that
      	  alldefconfig, allyesconfig, allnoconfig, and all defconfigs in
      	  the kernel still generate the same final .config.
      
      	- Valgrind was used to check for memory errors and (new) memory
      	  leaks.
      Signed-off-by: NUlf Magnusson <ulfalizer@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      f77850d3
    • U
      kconfig: Clarify expression rewriting · fa8cedae
      Ulf Magnusson 提交于
      menu_finalize() is one of the more opaque parts of Kconfig, and I need
      to make some changes to it to fix an issue related to modules. Add some
      comments related to expression rewriting and dependency propagation as a
      review aid. They will also help other people trying to understand the
      code.
      Signed-off-by: NUlf Magnusson <ulfalizer@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      fa8cedae
    • U
      kconfig: Rename menu_check_dep() to rewrite_m() · 9a826842
      Ulf Magnusson 提交于
      More directly describes the only thing it does.
      Signed-off-by: NUlf Magnusson <ulfalizer@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      9a826842