24 Feb, 2020

1 commit

  • [ Upstream commit c8fb7d7e48d11520ad24808cfce7afb7b9c9f798 ]

    Running randconfig on arm64 using KCONFIG_SEED=0x40C5E904 (e.g. on v5.5)
    produces the .config with CONFIG_EFI=y and CONFIG_CPU_BIG_ENDIAN=y,
    which does not meet the !CONFIG_CPU_BIG_ENDIAN dependency.

    This is because the user choice for CONFIG_CPU_LITTLE_ENDIAN vs
    CONFIG_CPU_BIG_ENDIAN is set by randomize_choice_values() after the
    value of CONFIG_EFI is calculated.

    When this happens, the has_changed flag should be set.

    Currently, it takes the result from the last iteration. It should
    accumulate all the results of the loop.

    Fixes: 3b9a19e08960 ("kconfig: loop as long as we changed some symbols in randconfig")
    Reported-by: Vincenzo Frascino
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin

    Masahiro Yamada
     

12 Jan, 2020

1 commit

  • [ Upstream commit 272a72103012862e3a24ea06635253ead0b6e808 ]

    NULL expressions are taken to always be true, as implemented by the
    expr_is_yes() macro and by several other functions in expr.c. As such,
    they ought to be valid inputs to expr_eq(), which compares two
    expressions.

    Signed-off-by: Thomas Hebb
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin

    Thomas Hebb
     

04 Sep, 2019

2 commits

  • The merge_config.sh script verifies that all the config options have
    their expected value in the resulting file and prints any issues as
    warnings. These checks aren't intended to be treated as errors given
    the current implementation. However, since "set -e" was added, if the
    grep command to look for a config option does not find it the script
    will then abort prematurely.

    Handle the case where the grep exit status is non-zero by setting
    ACTUAL_VAL to an empty string to restore previous functionality.

    Fixes: cdfca821571d ("merge_config.sh: Check error codes from make")
    Signed-off-by: Guillaume Tucker
    Acked-by: Jon Hunter
    Tested-by: Jon Hunter
    Signed-off-by: Masahiro Yamada

    Guillaume Tucker
     
  • Kbuild provides per-file compiler flag addition/removal:

    CFLAGS_.o
    CFLAGS_REMOVE_.o
    AFLAGS_.o
    AFLAGS_REMOVE_.o
    CPPFLAGS_.lds
    HOSTCFLAGS_.o
    HOSTCXXFLAGS_.o

    The is the filename of the target with its directory and
    suffix stripped.

    This syntax comes into a trouble when two files with the same basename
    appear in one Makefile, for example:

    obj-y += foo.o
    obj-y += dir/foo.o
    CFLAGS_foo.o :=

    Here, the applies to both foo.o and dir/foo.o

    The real world problem is:

    scripts/kconfig/util.c
    scripts/kconfig/lxdialog/util.c

    Both files are compiled into scripts/kconfig/mconf, but only the
    latter should be given with the ncurses flags.

    It is more sensible to use the relative path to the Makefile, like this:

    obj-y += foo.o
    CFLAGS_foo.o :=
    obj-y += dir/foo.o
    CFLAGS_dir/foo.o :=

    At first, I attempted to replace $(basetarget) with $*. The $* variable
    is replaced with the stem ('%') part in a pattern rule. This works with
    most of cases, but does not for explicit rules.

    For example, arch/ia64/lib/Makefile reuses rule_as_o_S in its own
    explicit rules, so $* will be empty, resulting in ignoring the per-file
    AFLAGS.

    I introduced a new variable, target-stem, which can be used also from
    explicit rules.

    Signed-off-by: Masahiro Yamada
    Acked-by: Marc Zyngier

    Masahiro Yamada
     

29 Aug, 2019

1 commit


22 Aug, 2019

1 commit

  • When we execute make after merging the configurations we ignore any
    errors it produces causing whatever is running merge_config.sh to be
    unaware of any failures. This issue was noticed by Guillaume Tucker
    while looking at problems with testing of clang only builds in KernelCI
    which caused Kbuild to be unable to find a working host compiler.

    This implementation was suggested by Yamada-san.

    Suggested-by: Masahiro Yamada
    Reported-by: Guillaume Tucker
    Signed-off-by: Mark Brown
    Signed-off-by: Masahiro Yamada

    Mark Brown
     

04 Aug, 2019

1 commit

  • Prior to this commit, starting nconfig, xconfig or gconfig, and saving
    the .config file more than once caused data loss, where a .config file
    that contained only comments would be written to disk starting from the
    second save operation.

    This bug manifests itself because the SYMBOL_WRITTEN flag is never
    cleared after the first call to conf_write, and subsequent calls to
    conf_write then skip all of the configuration symbols due to the
    SYMBOL_WRITTEN flag being set.

    This commit resolves this issue by clearing the SYMBOL_WRITTEN flag
    from all symbols before conf_write returns.

    Fixes: 8e2442a5f86e ("kconfig: fix missing choice values in auto.conf")
    Cc: linux-stable # 4.19+
    Signed-off-by: M. Vefa Bicakci
    Signed-off-by: Masahiro Yamada

    M. Vefa Bicakci
     

17 Jul, 2019

2 commits

  • Since commit 00c864f8903d ("kconfig: allow all config targets to write
    auto.conf if missing"), Kconfig creates include/config/auto.conf in the
    defconfig stage when it is missing.

    Joonas Kylmälä reported incorrect auto.conf generation under some
    circumstances.

    To reproduce it, apply the following diff:

    | --- a/arch/arm/configs/imx_v6_v7_defconfig
    | +++ b/arch/arm/configs/imx_v6_v7_defconfig
    | @@ -345,14 +345,7 @@ CONFIG_USB_CONFIGFS_F_MIDI=y
    | CONFIG_USB_CONFIGFS_F_HID=y
    | CONFIG_USB_CONFIGFS_F_UVC=y
    | CONFIG_USB_CONFIGFS_F_PRINTER=y
    | -CONFIG_USB_ZERO=m
    | -CONFIG_USB_AUDIO=m
    | -CONFIG_USB_ETH=m
    | -CONFIG_USB_G_NCM=m
    | -CONFIG_USB_GADGETFS=m
    | -CONFIG_USB_FUNCTIONFS=m
    | -CONFIG_USB_MASS_STORAGE=m
    | -CONFIG_USB_G_SERIAL=m
    | +CONFIG_USB_FUNCTIONFS=y
    | CONFIG_MMC=y
    | CONFIG_MMC_SDHCI=y
    | CONFIG_MMC_SDHCI_PLTFM=y

    And then, run:

    $ make ARCH=arm mrproper imx_v6_v7_defconfig

    You will see CONFIG_USB_FUNCTIONFS=y is correctly contained in the
    .config, but not in the auto.conf.

    Please note drivers/usb/gadget/legacy/Kconfig is included from a choice
    block in drivers/usb/gadget/Kconfig. So USB_FUNCTIONFS is a choice value.

    This is probably a similar situation described in commit beaaddb62540
    ("kconfig: tests: test defconfig when two choices interact").

    When sym_calc_choice() is called, the choice symbol forgets the
    SYMBOL_DEF_USER unless all of its choice values are explicitly set by
    the user.

    The choice symbol is given just one chance to recall it because
    set_all_choice_values() is called if SYMBOL_NEED_SET_CHOICE_VALUES
    is set.

    When sym_calc_choice() is called again, the choice symbol forgets it
    forever, since SYMBOL_NEED_SET_CHOICE_VALUES is a one-time aid.
    Hence, we cannot call sym_clear_all_valid() again and again.

    It is crazy to repeat set and unset of internal flags. However, we
    cannot simply get rid of "sym->flags &= flags | ~SYMBOL_DEF_USER;"
    Doing so would re-introduce the problem solved by commit 5d09598d488f
    ("kconfig: fix new choices being skipped upon config update").

    To work around the issue, conf_write_autoconf() stopped calling
    sym_clear_all_valid().

    conf_write() must be changed accordingly. Currently, it clears
    SYMBOL_WRITE after the symbol is written into the .config file. This
    is needed to prevent it from writing the same symbol multiple times in
    case the symbol is declared in two or more locations. I added the new
    flag SYMBOL_WRITTEN, to track the symbols that have been written.

    Anyway, this is a cheesy workaround in order to suppress the issue
    as far as defconfig is concerned.

    Handling of choices is totally broken. sym_clear_all_valid() is called
    every time a user touches a symbol from the GUI interface. To reproduce
    it, just add a new symbol drivers/usb/gadget/legacy/Kconfig, then touch
    around unrelated symbols from menuconfig. USB_FUNCTIONFS will disappear
    from the .config file.

    I added the Fixes tag since it is more fatal than before. But, this
    has been broken since long long time before, and still it is.
    We should take a closer look to fix this correctly somehow.

    Fixes: 00c864f8903d ("kconfig: allow all config targets to write auto.conf if missing")
    Cc: linux-stable # 4.19+
    Reported-by: Joonas Kylmälä
    Signed-off-by: Masahiro Yamada
    Tested-by: Joonas Kylmälä

    Masahiro Yamada
     
  • 'make olddefconfig' is non-interactive, so we can drop 'yes'.
    The behavior is equivalent.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

13 Jul, 2019

1 commit

  • Pull Kconfig updates from Masahiro Yamada:

    - always require argument for --defconfig and remove the hard-coded
    arch/$(ARCH)/defconfig path

    - make arch/$(SRCARCH)/configs/defconfig the new default of defconfig

    - some code cleanups

    * tag 'kconfig-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    kconfig: remove meaningless if-conditional in conf_read()
    kconfig: Fix spelling of sym_is_changable
    unicore32: rename unicore32_defconfig to defconfig
    kconfig: make arch/*/configs/defconfig the default of KBUILD_DEFCONFIG
    kconfig: add static qualifier to expand_string()
    kconfig: require the argument of --defconfig
    kconfig: remove always false ifeq ($(KBUILD_DEFCONFIG,) conditional

    Linus Torvalds
     

11 Jul, 2019

1 commit

  • sym_is_choice(sym) has already been checked by previous if-block:

    if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE))
    continue;

    Hence, the following code is redundant, and the comment is misleading:

    if (!sym_is_choice(sym))
    continue;
    /* fall through */

    It always takes 'continue', never falls though.

    Clean up the dead code.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

06 Jul, 2019

1 commit


15 Jun, 2019

1 commit

  • The kbuild documentation clearly shows that the documents
    there are written at different times: some use markdown,
    some use their own peculiar logic to split sections.

    Convert everything to ReST without affecting too much
    the author's style and avoiding adding uneeded markups.

    The conversion is actually:
    - add blank lines and identation in order to identify paragraphs;
    - fix tables markups;
    - add some lists markups;
    - mark literal blocks;
    - adjust title markups.

    At its new index.rst, let's add a :orphan: while this is not linked to
    the main index.rst file, in order to avoid build warnings.

    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Jonathan Corbet

    Mauro Carvalho Chehab
     

09 Jun, 2019

4 commits

  • Until recently, if KBUILD_DEFCONFIG was not set by the arch Makefile,
    the default path arch/*/defconfig was used.

    The last users of the default are gone by the following commits:

    - Commit f3e20ad67b4c ("s390: move arch/s390/defconfig to
    arch/s390/configs/defconfig")

    - Commit 986a13769c4b ("alpha: move arch/alpha/defconfig to
    arch/alpha/configs/defconfig")

    Let's set arch/*/configs/defconfig as a new default. This saves
    KBUILD_DEFCONFIG for some architectures.

    Signed-off-by: Masahiro Yamada
    Acked-by: Catalin Marinas

    Masahiro Yamada
     
  • Now expand_string() is only used in preprocess.c

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Currently, the argument for --defconfig is optional. If the argument
    is not passed, the hard-coded default arch/$(ARCH)/defconfig is used.

    It no longer happens in Linux since the last users of the default are
    gone by the following commits:

    - Commit f3e20ad67b4c ("s390: move arch/s390/defconfig to
    arch/s390/configs/defconfig")

    - Commit 986a13769c4b ("alpha: move arch/alpha/defconfig to
    arch/alpha/configs/defconfig")

    I want to kill the Linux-specific directory path embedded in the
    Kconfig binary.

    The --savedefconfig (reverse operation of --defconfig) requires an
    argument, so it should not hurt to do likewise for --defconfig.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • With the following two commits applied, all the arch Makefiles
    define KBUILD_DEFCONFIG.

    - Commit f3e20ad67b4c ("s390: move arch/s390/defconfig to
    arch/s390/configs/defconfig")

    - Commit 986a13769c4b ("alpha: move arch/alpha/defconfig to
    arch/alpha/configs/defconfig")

    The first conditional in the defconfig rule is always false.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

05 Jun, 2019

1 commit

  • Adding SPDX license identifier is pretty safe; however, here is one
    exception.

    Since commit ec8f24b7faaf ("treewide: Add SPDX license identifier -
    Makefile/Kconfig"), "make testconfig" would not pass.

    When Kconfig detects a circular file inclusion, it displays error
    messages with a file name and a line number prefixed to each line.

    The unit test checks if Kconfig emits the error messages correctly
    (this also checks the line number correctness).

    Now that the test input has the SPDX license identifier at the very top,
    the line numbers in the expected stderr should be incremented by 1.

    Fixes: ec8f24b7faaf ("treewide: Add SPDX license identifier - Makefile/Kconfig")
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

21 May, 2019

1 commit


19 May, 2019

1 commit


18 May, 2019

2 commits

  • Currently menu blocks start with a pretty header but end with nothing in
    the generated config. So next config options stick together with the
    options from the menu block.

    Let's terminate menu blocks in the generated config with a comment and
    a newline if needed. Example:

    ...
    CONFIG_BPF_STREAM_PARSER=y
    CONFIG_NET_FLOW_LIMIT=y

    #
    # Network testing
    #
    CONFIG_NET_PKTGEN=y
    CONFIG_NET_DROP_MONITOR=y
    # end of Network testing
    # end of Networking options

    CONFIG_HAMRADIO=y
    ...

    Signed-off-by: Alexander Popov
    Reviewed-by: Kees Cook
    Signed-off-by: Masahiro Yamada

    Alexander Popov
     
  • Currently, the Kbuild core manipulates header search paths in a crazy
    way [1].

    To fix this mess, I want all Makefiles to add explicit $(srctree)/ to
    the search paths in the srctree. Some Makefiles are already written in
    that way, but not all. The goal of this work is to make the notation
    consistent, and finally get rid of the gross hacks.

    Having whitespaces after -I does not matter since commit 48f6e3cf5bc6
    ("kbuild: do not drop -I without parameter").

    [1]: https://patchwork.kernel.org/patch/9632347/

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

14 May, 2019

3 commits


11 May, 2019

3 commits

  • With menuconfig / nconfig, users can input any file path from the
    "Save" menu, but it fails if the parent directory does not exist.

    Why not create the parent directory automatically. I think this is
    a user-friendly behavior.

    I changed the error messages in menuconfig / nconfig.

    "Nonexistent directory" is no longer the most likely reason of the
    failure. Perhaps, the user specified the existing directory, or
    attempted to write to the location without write permission.

    Signed-off-by: Masahiro Yamada

    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: Linus Torvalds
    Signed-off-by: Masahiro Yamada
    Reviewed-by: Greg Kroah-Hartman

    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: Masahiro Yamada
    Cc: Nicolas Porcel

    Masahiro Yamada
     

09 May, 2019

1 commit


09 Apr, 2019

1 commit


29 Mar, 2019

1 commit

  • Backspace is not working on some terminal emulators which do not send the
    key code defined by terminfo. Terminals either send '^H' (8) or '^?' (127).
    But currently only '^?' is handled. Let's also handle '^H' for those
    terminals.

    Signed-off-by: Changbin Du
    Signed-off-by: Masahiro Yamada

    Changbin Du
     

17 Mar, 2019

1 commit


14 Mar, 2019

1 commit


12 Mar, 2019

1 commit

  • The 'Save As' menu of xconfig is not working; it always saves the
    kernel configuration into the default file irrespective of the file
    chosen in the dialog box.

    The 'Save' menu always writes into the default file, but it would
    make more sense to write into the file previously chosen by 'Load'
    or 'Save As'.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

27 Feb, 2019

1 commit


13 Feb, 2019

2 commits


14 Jan, 2019

1 commit


06 Jan, 2019

2 commits