1. 11 5月, 2019 2 次提交
    • M
      kconfig: do not write .config if the content is the same · 67424f61
      Masahiro Yamada 提交于
      Kconfig updates the .config when it exits even if its content is
      exactly the same as before. Since its timestamp becomes newer than
      that of other build artifacts, additional processing is invoked,
      which is annoying.
      
      - syncconfig is invoked to update include/config/auto.conf, etc.
      
      - kernel/configs.o is recompiled if CONFIG_IKCONFIG is enabled,
        then vmlinux is relinked as well.
      
      If the .config is not changed at all, we do not have to even
      touch it. Just bail out showing "No change to .config".
      
        $ make allmodconfig
        scripts/kconfig/conf  --allmodconfig Kconfig
        #
        # configuration written to .config
        #
        $ make allmodconfig
        scripts/kconfig/conf  --allmodconfig Kconfig
        #
        # No change to .config
        #
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      67424f61
    • M
      kconfig: do not accept a directory for configuration output · ceb7f329
      Masahiro Yamada 提交于
      Currently, conf_write() can be called with a directory name instead
      of a file name. As far as I see, this can happen for menuconfig,
      nconfig, gconfig.
      
      If it is given with a directory path, conf_write() kindly appends
      getenv("KCONFIG_CONFIG"), but this ends up with hacky dir/basename
      handling, and screwed up in corner-cases like "what if KCONFIG_CONFIG
      is an absolute path?" as discussed before:
      
        https://patchwork.kernel.org/patch/9910037/
      
      Since conf_write() is already messed up, I'd say "do not do it".
      Please pass a file path all the time. If a directory path is specified
      for the configuration output, conf_write() will simply error out.
      
      Now that the tmp file is created in the same directory as the .config,
      the previously reported "what if KCONFIG_CONFIG points to a different
      file system?" has been solved.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Nicolas Porcel <nicolasporcel06@gmail.com>
      ceb7f329
  2. 28 12月, 2018 2 次提交
  3. 08 12月, 2018 4 次提交
    • M
      kconfig: remove S_OTHER symbol type and correct dependency tracking · 2aabbed6
      Masahiro Yamada 提交于
      The S_OTHER type could be set only when conf_read_simple() is reading
      include/config/auto.conf file.
      
      For example, CONFIG_FOO=y exists in include/config/auto.conf but it is
      missing from the currently parsed Kconfig files, sym_lookup() allocates
      a new symbol, and sets its type to S_OTHER.
      
      Strangely, it will be set to S_STRING by conf_set_sym_val() a few lines
      below while it is obviously bool or tristate type. On the other hand,
      when CONFIG_BAR="bar" is being dropped from include/config/auto.conf,
      its type remains S_OTHER. Because for_all_symbols() omits S_OTHER
      symbols, conf_touch_deps() misses to touch include/config/bar.h
      
      This behavior has been a pretty mystery for me, and digging the git
      histroy did not help. At least, touching depfiles is broken for string
      type symbols.
      
      I removed S_OTHER entirely, and reimplemented it more simply.
      
      If CONFIG_FOO was visible in the previous syncconfig, but is missing
      now, what we want to do is quite simple; just call conf_touch_dep()
      to touch include/config/foo.h instead of allocating a new symbol data.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      2aabbed6
    • M
      kconfig: split out code touching a file to conf_touch_dep() · 1508fec8
      Masahiro Yamada 提交于
      conf_touch_deps() iterates over symbols, touching corresponding
      include/config/*.h files as needed.
      
      Split the part that touches a single file into a new helper so it can
      be reused.
      
      The new helper, conf_touch_dep(), takes a symbol name as a parameter,
      and touches the corresponding include/config/*.h file.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      1508fec8
    • M
      kconfig: rename conf_split_config() to conf_touch_deps() · 0849d212
      Masahiro Yamada 提交于
      According to commit 2e3646e5 ("kconfig: integrate split config
      into silentoldconfig"), this function was named after split-include
      tool, which used to exist in old versions of Linux.
      
      Setting aside the historical reason, rename it into a more intuitive
      name. This function touches timestamp files under include/config/
      in order to interact with the fixdep tool.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      0849d212
    • M
      kconfig: remove unneeded setsym label in conf_read_simple() · 75889e9b
      Masahiro Yamada 提交于
      The two 'goto setsym' statements are reachable only when sym == NULL.
      
      The code below the 'setsym:' label does nothing when sym == NULL
      since there is just one if-block guarded by 'if (sym && ...)'.
      
      Hence, 'goto setsym' can be replaced with 'continue'.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      75889e9b
  4. 25 7月, 2018 5 次提交
    • M
      kconfig: allow all config targets to write auto.conf if missing · 00c864f8
      Masahiro Yamada 提交于
      Currently, only syncconfig creates or updates include/config/auto.conf
      and some other files.  Other config targets create or update only the
      .config file.
      
      When you configure and build the kernel from a pristine source tree,
      any config target is followed by syncconfig in the build stage since
      include/config/auto.conf is missing.
      
      We are moving compiler tests from Makefile to Kconfig.  It means that
      parsing Kconfig files will be more costly since Kconfig invokes the
      compiler commands internally.  Thus, we want to avoid invoking Kconfig
      twice (one for *config to create the .config, and one for syncconfig
      to synchronize the auto.conf).  If auto.conf does not exist, we can
      generate all configuration files in the first configuration stage,
      which will save the syncconfig in the build stage.
      
      Please note this should be done only when auto.conf is missing.  If
      *config blindly did this, time stamp files under include/config/ would
      be unnecessarily touched, triggering unneeded rebuild of objects.
      
      I assume a scenario like this:
      
       1. You have a source tree that has already been built
          with CONFIG_FOO disabled
      
       2. Run "make menuconfig" to enable CONFIG_FOO
      
       3. CONFIG_FOO turns out to be unnecessary.
          Run "make menuconfig" again to disable CONFIG_FOO
      
       4. Run "make"
      
      In this case, include/config/foo.h should not be touched since there
      is no change in CONFIG_FOO.  The sync process should be delayed until
      the user really attempts to build the kernel.
      
      This commit has another motivation; I want to suppress the 'No such
      file or directory' warning from the 'include' directive.
      
      The top-level Makefile includes auto.conf with '-include' directive,
      like this:
      
        ifeq ($(dot-config),1)
        -include include/config/auto.conf
        endif
      
      This looks strange because auto.conf is mandatory when dot-config is 1.
      I guess only the reason of using '-include' is to suppress the warning
      'include/config/auto.conf: No such file or directory' when building
      from a clean tree.  However, this has a side-effect; Make considers
      the files included by '-include' are optional.  Hence, Make continues
      to build even if it fails to generate include/config/auto.conf.  I will
      change this in the next commit, but the warning message is annoying.
      (At least, kbuild test robot reports it as a regression.)
      
      With this commit, Kconfig will generate all configuration files together
      with the .config and I guess it is a solution good enough to suppress
      the warning.
      
      Note:
      GNU Make 4.2 or later does not display the warning from the 'include'
      directive if include files are successfully generated.  See GNU Make
      commit 87a5f98d248f ("[SV 102] Don't show unnecessary include file
      errors.")  However, older GNU Make versions are still widely used.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      00c864f8
    • M
      kconfig: create directories needed for syncconfig by itself · 79123b13
      Masahiro Yamada 提交于
      'make syncconfig' creates some files such as include/config/auto.conf,
      include/generate/autoconf.h, etc. but the necessary directory creation
      relies on scripts/kconfig/Makefile.
      
      To make Kconfig self-contained, create directories as needed in
      conf_write_autoconf().
      
      This change allows scripts/kconfig/Makefile cleanups; syncconfig can
      be merged into simple-targets.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      79123b13
    • M
      kconfig: split out useful helpers in confdata.c · 0608182a
      Masahiro Yamada 提交于
      Split out helpers:
       is_present() - check if the given path exists
       is_dir() - check if the given path exists and it is a directory
       make_parent_dir() - create the parent directories of the given path
      
      These helpers will be reused in later commits.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      0608182a
    • M
      kconfig: rename file_write_dep and move it to confdata.c · a2ff4040
      Masahiro Yamada 提交于
      file_write_dep() is called only from conf_write_autoconf().
      Move it from util.c to confdata.c to make it static.
      Also, rename it to conf_write_dep() since it should belong to
      the group of conf_write* functions.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      a2ff4040
    • M
      kconfig: handle format string before calling conf_message_callback() · 5accd7f3
      Masahiro Yamada 提交于
      As you see in mconf.c and nconf.c, conf_message_callback() hooks are
      likely to end up with the boilerplate of vsnprintf().  Process the
      string format before calling conf_message_callback() so that it
      receives a simple string.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NDirk Gouders <dirk@gouders.net>
      5accd7f3
  5. 18 7月, 2018 1 次提交
  6. 05 6月, 2018 1 次提交
    • N
      kconfig: Avoid format overflow warning from GCC 8.1 · 2ae89c7a
      Nathan Chancellor 提交于
      In file included from scripts/kconfig/zconf.tab.c:2485:
      scripts/kconfig/confdata.c: In function ‘conf_write’:
      scripts/kconfig/confdata.c:773:22: warning: ‘%s’ directive writing likely 7 or more bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
        sprintf(newname, "%s%s", dirname, basename);
                            ^~
      scripts/kconfig/confdata.c:773:19: note: assuming directive output of 7 bytes
        sprintf(newname, "%s%s", dirname, basename);
                         ^~~~~~
      scripts/kconfig/confdata.c:773:2: note: ‘sprintf’ output 1 or more bytes (assuming 4104) into a destination of size 4097
        sprintf(newname, "%s%s", dirname, basename);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      scripts/kconfig/confdata.c:776:23: warning: ‘.tmpconfig.’ directive writing 11 bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
         sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
                             ^~~~~~~~~~~
      scripts/kconfig/confdata.c:776:3: note: ‘sprintf’ output between 13 and 4119 bytes into a destination of size 4097
         sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Increase the size of tmpname and newname to make GCC happy.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      2ae89c7a
  7. 29 5月, 2018 1 次提交
    • M
      kconfig: reference environment variables directly and remove 'option env=' · 104daea1
      Masahiro Yamada 提交于
      To get access to environment variables, Kconfig needs to define a
      symbol using "option env=" syntax.  It is tedious to add a symbol entry
      for each environment variable given that we need to define much more
      such as 'CC', 'AS', 'srctree' etc. to evaluate the compiler capability
      in Kconfig.
      
      Adding '$' for symbol references is grammatically inconsistent.
      Looking at the code, the symbols prefixed with 'S' are expanded by:
       - conf_expand_value()
         This is used to expand 'arch/$ARCH/defconfig' and 'defconfig_list'
       - sym_expand_string_value()
         This is used to expand strings in 'source' and 'mainmenu'
      
      All of them are fixed values independent of user configuration.  So,
      they can be changed into the direct expansion instead of symbols.
      
      This change makes the code much cleaner.  The bounce symbols 'SRCARCH',
      'ARCH', 'SUBARCH', 'KERNELVERSION' are gone.
      
      sym_init() hard-coding 'UNAME_RELEASE' is also gone.  'UNAME_RELEASE'
      should be replaced with an environment variable.
      
      ARCH_DEFCONFIG is a normal symbol, so it should be simply referenced
      without '$' prefix.
      
      The new syntax is addicted by Make.  The variable reference needs
      parentheses, like $(FOO), but you can omit them for single-letter
      variables, like $F.  Yet, in Makefiles, people tend to use the
      parenthetical form for consistency / clarification.
      
      At this moment, only the environment variable is supported, but I will
      extend the concept of 'variable' later on.
      
      The variables are expanded in the lexer so we can simplify the token
      handling on the parser side.
      
      For example, the following code works.
      
      [Example code]
      
        config MY_TOOLCHAIN_LIST
                string
                default "My tools: CC=$(CC), AS=$(AS), CPP=$(CPP)"
      
      [Result]
      
        $ make -s alldefconfig && tail -n 1 .config
        CONFIG_MY_TOOLCHAIN_LIST="My tools: CC=gcc, AS=as, CPP=gcc -E"
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      104daea1
  8. 28 5月, 2018 1 次提交
  9. 01 3月, 2018 1 次提交
  10. 10 2月, 2018 1 次提交
  11. 21 1月, 2018 2 次提交
  12. 10 5月, 2016 1 次提交
  13. 01 2月, 2016 1 次提交
    • A
      unbreak allmodconfig KCONFIG_ALLCONFIG=... · 6b87b70c
      Al Viro 提交于
      	Prior to 3.13 make allmodconfig KCONFIG_ALLCONFIG=/dev/null used
      to be equivalent to make allmodconfig; these days it hardwires MODULES to n.
      In fact, any KCONFIG_ALLCONFIG that doesn't set MODULES explicitly is
      treated as if it set it to n.
      
      	Regression had been introduced by commit cfa98f ("kconfig: do not
      override symbols already set"); what happens is that conf_read_simple()
      does sym_calc_value(modules_sym) on exit, which leaves SYMBOL_VALID set and
      has conf_set_all_new_symbols() skip modules_sym.
      
      	It's pretty easy to fix - simply move that call of sym_calc_value()
      into the callers, except for the ones in KCONFIG_ALLCONFIG handling.
      Objections?
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Fixes: cfa98f2e ("kconfig: do not override symbols already set")
      Signed-off-by: NMichal Marek <mmarek@suse.com>
      6b87b70c
  14. 19 8月, 2015 1 次提交
  15. 25 2月, 2015 1 次提交
  16. 27 1月, 2015 1 次提交
  17. 08 4月, 2014 1 次提交
  18. 16 8月, 2013 1 次提交
    • Y
      kconfig: silence warning when parsing auto.conf when a symbol has changed type · 04b19b77
      Yann E. MORIN 提交于
      When a symbol changes type from tristate to bool, and was previously set to
      'm', a subsequent silentoldconfig would warn about inconsistency, such as:
      
          include/config/auto.conf:3014:warning: symbol value 'm' invalid for
          HOTPLUG_PCI_PCIE
      
      Seen by Linus with the merge in aa8032b6 (sequence to reproduce by Michal):
          git checkout 1fe0135b
          make mrproper
          make allmodconfig
          make silentoldconfig
          git checkout aa8032b6
          make allmodconfig
          make silentoldconfig
      
      Since HOTPLUG_PCI_PCIE changed from tristate to bool in aa8032b6, it was
      previously set to 'm' in auto.conf by the first allmodconfig+silentoldconfig,
      but then was set to 'y' by the second allmodconfig. Then the second
      silentoldconfig prints the warning.
      
      The warning in this case is a spurious warning, which happens at the time
      kconfig tries to detect symbols that have changed, to touch the empty
      header files in include/config used for dependency-tracking by make.
      
      Silence the warning when we read the old auto.conf file, since it is
      perfectly legit that a symbol changed type since the previous call.
      
      Thread in:
          http://marc.info/?l=linux-pci&m=137569198904000&w=2Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      04b19b77
  19. 26 6月, 2013 1 次提交
  20. 25 6月, 2013 2 次提交
    • Y
      kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG · 8357b485
      Yann E. MORIN 提交于
      Currently, randconfig does randomise choice entries, unless KCONFIG_ALLCONFIG
      is specified.
      
      For example, given those two files (Thomas' test-case):
      
          ---8<--- Config.test.in
          config OPTIONA
              bool "Option A"
      
          choice
              prompt "This is a choice"
      
          config CHOICE_OPTIONA
              bool "Choice Option A"
      
          config CHOICE_OPTIONB
              bool "Choice Option B"
      
          endchoice
      
          config OPTIONB
              bool "Option B"
          ---8<--- Config.test.in
      
          ---8<--- config.defaults
          CONFIG_OPTIONA=y
          ---8<--- config.defaults
      
      And running:
          ./scripts/kconfig/conf --randconfig Config.test.in
      
      does properly randomise the two choice symbols (and the two booleans).
      
      However, running:
          KCONFIG_ALLCONFIG=config.defaults \
          ./scripts/kconfig/conf --randconfig Config.test.in
      
      does *not* reandomise the two choice entries, and only CHOICE_OPTIONA
      will ever be selected. (OPTIONA will always be set (expected), and
      OPTIONB will be be properly randomised (expected).)
      
      This patch defers setting that a choice has a value until a symbol for
      that choice is indeed set, so that choices are properly randomised when
      KCONFIG_ALLCONFIG is set, but not if a symbol for that choice is set.
      Reported-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Sedat Dilek <sedat.dilek@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      
      ---
      Changes v3 -> v4
        - fix previous issue where some choices would not be set, which would
          cause silentoldconfig to ask for them and was then breaking this
          workflow (as reported by Arnd and Sedat):
              KCONFIG_ALLCONFIG=foo.defconfig make randconfig
              make silentoldconfig </dev/nullo
          which I have tested (3h28min!) with:
              touch defconfig
              for(( i=0; i<10000; i++ )); do
                  KCONFIG_ALLCONFIG=$(pwd)/defconfig make randconfig >/dev/null 2>&1
                  make silentoldconfig </dev/null >/dev/null 2>&1 || break
              done
          which did not break at all.
        - change done in v3 (below) is already fixed by a previous patch
      
      Changes v2 -> v3
        - ensure only one symbol is set in a choice
      
      Changes v1 -> v2:
        - further postpone setting that a choice has a value until
          one is indeed set
        - do not print symbols that are part of an invisible choice
      8357b485
    • Y
      kconfig: loop as long as we changed some symbols in randconfig · 3b9a19e0
      Yann E. MORIN 提交于
      Because of choice-in-a-choice constructs, it can happen that not all
      symbols are assigned a value during randconfig, leading in rare cases
      to this situation:
      
          ---8<--- choice-in-choice.in
          choice
              bool "A/B/C"
          config A
              bool "A"
      
          config B
              bool "B"
          if B
          choice
              bool "E/F"
          config E
              bool "E"
          config F
              bool "F"
          endchoice
          endif # B
      
          config C
              bool "C"
          endchoice
          ---8<---
      
          $ ./scripts/kconfig/conf --randconfig choice-in-choice.in
          [--SNIP--]
          $ ./scripts/kconfig/conf --silentoldconfig choice-in-choice.in </dev/null
          [--SNIP--]
          A/B/C
            1. A (A)
          > 2. B (B)
            3. C (C)
          choice[1-3]: 2
            E/F
            > 1. E (E) (NEW)
              2. F (F) (NEW)
            choice[1-2]: aborted!
      
          Console input/output is redirected. Run 'make oldconfig' to update
          configuration.
      
      Fix this by looping in randconfig for as long as some symbol gets assigned
      a value.
      
      Note: this was spotted with the USB EHCI Debug Device Gadget (USB_G_DBGP),
      which uses this choice-in-a-choice construct, and exhibits this problem.
      The example above is just a stripped-down minimalist test-case.
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      3b9a19e0
  21. 19 6月, 2013 1 次提交
    • Y
      kconfig/conf: fix randconfig setting multiple symbols in a choice · e6abf12a
      Yann E. MORIN 提交于
      Currently, randconfig may set more than one symbol in a given choice.
      Given this config file:
          config A
              bool "A"
          if A
          choice
              bool "B/C/D"
          config B
              bool "B"
          config C
              bool "C"
          config D
              bool "D"
          endchoice
          endif # A
      
      Then randconfig generates such .config files (case where A is not set is not
      shown below for brevity), and where only the right-most .config is valid:
        CONFIG_A=y                  CONFIG_A=y                  CONFIG_A=y
        CONFIG_B=y                  CONFIG_B=y                  CONFIG_B=y
        CONFIG_C=y                  # CONFIG_C is not set       # CONFIG_C is not set
        # CONFIG_D is not set       CONFIG_D=y                  # CONFIG_D is not set
      
      That is, in a randomised choice, the first symbol is always selected,
      and at most one other symbol may be selected.
      
      This is due to symbol randomised in a choice not being properly flagged
      as having a value.
      
      Fix that by flagging those symbols adequately: have a user-defined value,
      and be not valid (to force recalculation of the symbol).
      
      Note: if the choice is not conditional, then the randomisation is properly
      done.
      Reported-by: NMatthieu CASTET <matthieu.castet@parrot.com>
      Signed-off-by: NMatthieu CASTET <matthieu.castet@parrot.com>
      [yann.morin.1998@free.fr: independently re-done the same patch as Matthieu,
                                as pointed out by Sedat]
      Cc: Arnaud Lacombe <lacombar@gmail.com>
      Cc: Sedat Dilek <sedat.dilek@gmail.com>
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      e6abf12a
  22. 16 6月, 2013 1 次提交
    • A
      kconfig: Fix defconfig when one choice menu selects options that another choice menu depends on · fbe98bb9
      Arve Hjønnevåg 提交于
      The defconfig and Kconfig combination below, which is based on 3.10-rc4
      Kconfigs, resulted in several options getting set to "m" instead of "y".
      
      defconfig.choice:
      ---8<---
      CONFIG_MODULES=y
      CONFIG_USB_ZERO=y
      ---8<---
      
      Kconfig.choice:
      ---8<---
      menuconfig MODULES
      	bool "Enable loadable module support"
      
      config CONFIGFS_FS
      	tristate "Userspace-driven configuration filesystem"
      
      config OCFS2_FS
              tristate "OCFS2 file system support"
              depends on CONFIGFS_FS
              select CRC32
      
      config USB_LIBCOMPOSITE
      	tristate
      	select CONFIGFS_FS
      
      choice
      	tristate "USB Gadget Drivers"
      	default USB_ETH
      
      config USB_ZERO
      	tristate "Gadget Zero (DEVELOPMENT)"
      	select USB_LIBCOMPOSITE
      
      config USB_ETH
      	tristate "Ethernet Gadget (with CDC Ethernet support)"
      	select USB_LIBCOMPOSITE
      
      endchoice
      
      config CRC32
              tristate "CRC32/CRC32c functions"
              default y
      
      choice
              prompt "CRC32 implementation"
              depends on CRC32
              default CRC32_SLICEBY8
      
      config CRC32_SLICEBY8
              bool "Slice by 8 bytes"
      
      endchoice
      ---8<---
      
      $ scripts/kconfig/conf --defconfig=defconfig.choice Kconfig.choice
      
      would result in:
      
      .config:
      ---8<---
      CONFIG_MODULES=y
      CONFIG_CONFIGFS_FS=m
      CONFIG_USB_LIBCOMPOSITE=m
      CONFIG_USB_ZERO=m
      CONFIG_CRC32=y
      CONFIG_CRC32_SLICEBY8=y
      ---8<---
      
      when the expected result would be:
      
      .config:
      ---8<---
      CONFIG_MODULES=y
      CONFIG_CONFIGFS_FS=y
      CONFIG_USB_LIBCOMPOSITE=y
      CONFIG_USB_ZERO=y
      CONFIG_CRC32=y
      CONFIG_CRC32_SLICEBY8=y
      ---8<---
      Signed-off-by: NArve Hjønnevåg <arve@android.com>
      [yann.morin.1998@free.fr: add the resulting .config to commit log,
                                remove unneeded USB_GADGET from the defconfig]
      Tested-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      Reviewed-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      Signed-off-by: NYann E. MORIN <yann.morin.1998@free.fr>
      fbe98bb9
  23. 27 4月, 2013 1 次提交
  24. 25 4月, 2013 4 次提交
    • Y
      kconfig: implement KCONFIG_PROBABILITY for randconfig · e43956e6
      Yann E. MORIN 提交于
      Currently the odds to set each symbol is (rounded):
          booleans:   y: 50%          n: 50%
          tristates:  y: 33%  m: 33%  n: 33%
      
      Introduce a KCONFIG_PROBABILITY environment variable to tweak the
      probabilities (in percentage), as such:
          KCONFIG_PROBABILITY     y:n split           y:m:n split
          -----------------------------------------------------------------
      [1] unset or empty          50  : 50            33  : 33  : 34
      [2] N                        N  : 100-N         N/2 : N/2 : 100-N
          N:M                     N+M : 100-(N+M)      N  :  M  : 100-(N+M)
          N:M:L                    N  : 100-N          M  :  L  : 100-(M+L)
      
      [1] The current behaviour is kept as default, for backward compatibility
      [2] The solution initially implemented by Peter for Buildroot, see:
          http://git.buildroot.org/buildroot/commit/?id=3435c1afb5Signed-off-by: NPeter Korsgaard <jacmet@uclibc.org>
      [yann.morin.1998@free.fr: add to Documentation/]
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      e43956e6
    • Y
      kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG · 422c809f
      Yann E. MORIN 提交于
      Currently, randconfig does randomise choice entries, unless KCONFIG_ALLCONFIG
      is specified.
      
      For example, given those two files (Thomas' test-case):
      
          ---8<--- Config.test.in
          config OPTIONA
              bool "Option A"
      
          choice
              prompt "This is a choice"
      
          config CHOICE_OPTIONA
              bool "Choice Option A"
      
          config CHOICE_OPTIONB
              bool "Choice Option B"
      
          endchoice
      
          config OPTIONB
              bool "Option B"
          ---8<--- Config.test.in
      
          ---8<--- config.defaults
          CONFIG_OPTIONA=y
          ---8<--- config.defaults
      
      And running:
          ./scripts/kconfig/conf --randconfig Config.test.in
      
      does properly randomise the two choice symbols (and the two booleans).
      
      However, running:
          KCONFIG_ALLCONFIG=config.defaults \
          ./scripts/kconfig/conf --randconfig Config.test.in
      
      does *not* reandomise the two choice entries, and only CHOICE_OPTIONA
      will ever be selected. (OPTIONA will always be set (expected), and
      OPTIONB will be be properly randomised (expected).)
      
      This patch defers setting that a choice has a value until a symbol for
      that choice is indeed set, so that choices are properly randomised when
      KCONFIG_ALLCONFIG is set, but not if a symbol for that choice is set.
      
      Also, as a side-efect, this patch fixes the following case:
      
          ---8<---
          choice
          config OPTION_A
              bool "Option A"
          config OPTION_B
              bool "Option B"
          config OPTION_C
              bool "Option C"
          endchoice
          ---8<---
      
      which could previously generate such .config files:
      
          ---8<---                            ---8<---
          CONFIG_OPTION_A=y                   CONFIG_OPTION_A=y
          CONFIG_OPTION_B=y                   # CONFIG_OPTION_B is not set
          # CONFIG_OPTION_C is not set        CONFIG_OPTION_C=y
          ---8<---                            ---8<---
      
      Ie., the first entry in a choice is always set, plus zero or one of
      the other options may be set.
      
      This patch ensures that only one option may be set for a choice.
      Reported-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Arnaud Lacombe <lacombar@gmail.com>
      
      ---
      Changes v2 -> v3
        - ensure only one symbol is set in a choice
      
      Changes v1 -> v2:
        - further postpone setting that a choice has a value until
          one is indeed set
        - do not print symbols that are part of an invisible choice
      422c809f
    • Y
      kconfig: do not override symbols already set · cfa98f2e
      Yann E. MORIN 提交于
      For randconfig, if a list of required symbols is specified with
      KCONFIG_ALLCONFIG, such symbols do not "have a value" as per
      sym_has_value(), but have the "valid" flag set.
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      cfa98f2e
    • Y
      kconfig: fix randconfig tristate detection · 61fa0e17
      Yann E. MORIN 提交于
      Because the modules' symbole (CONFIG_MODULES) may not yet be set when
      we check a symbol's tristate capabilty, we'll always find that tristate
      symbols are booleans, even if we randomly decided that to enable modules:
      sym_get_type(sym) always return boolean for tristates when modules_sym
      has not been previously set to 'y' *and* its value calculated *and* its
      visibility calculated, both of which only occur after we randomly assign
      values to symbols.
      
      Fix that by looking at the raw type of symbols. Tristate set to 'm' will
      be promoted to 'y' when their values will be later calculated.
      Signed-off-by: N"Yann E. MORIN" <yann.morin.1998@free.fr>
      61fa0e17
  25. 14 7月, 2012 1 次提交
  26. 13 4月, 2012 1 次提交