1. 03 3月, 2020 1 次提交
    • M
      kbuild: use KBUILD_DEFCONFIG as the fallback for DEFCONFIG_LIST · 2a86f661
      Masahiro Yamada 提交于
      Most of the Kconfig commands (except defconfig and all*config) read
      the .config file as a base set of CONFIG options.
      
      When it does not exist, the files in DEFCONFIG_LIST are searched in
      this order and loaded if found.
      
      I do not see much sense in the last two lines in DEFCONFIG_LIST.
      
      [1] ARCH_DEFCONFIG
      
      The entry for DEFCONFIG_LIST is guarded by 'depends on !UML'. So, the
      ARCH_DEFCONFIG definition in arch/x86/um/Kconfig is meaningless.
      
      arch/{sh,sparc,x86}/Kconfig define ARCH_DEFCONFIG depending on 32 or
      64 bit variant symbols. This is a little bit strange; ARCH_DEFCONFIG
      should be a fixed string because the base config file is loaded before
      the symbol evaluation stage.
      
      Using KBUILD_DEFCONFIG makes more sense because it is fixed before
      Kconfig is invoked. Fortunately, arch/{sh,sparc,x86}/Makefile define it
      in the same way, and it works as expected. Hence, replace ARCH_DEFCONFIG
      with "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)".
      
      [2] arch/$(ARCH)/defconfig
      
      This file path is no longer valid. The defconfig files are always located
      in the arch configs/ directories.
      
        $ find arch -name defconfig | sort
        arch/alpha/configs/defconfig
        arch/arm64/configs/defconfig
        arch/csky/configs/defconfig
        arch/nds32/configs/defconfig
        arch/riscv/configs/defconfig
        arch/s390/configs/defconfig
        arch/unicore32/configs/defconfig
      
      The path arch/*/configs/defconfig is already covered by
      "arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)". So, this file path is
      not necessary.
      
      I moved the default KBUILD_DEFCONFIG to the top Makefile. Otherwise,
      the 7 architectures listed above would end up with endless loop of
      syncconfig.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      2a86f661
  2. 04 2月, 2020 1 次提交
    • M
      kbuild: rename hostprogs-y/always to hostprogs/always-y · 5f2fb52f
      Masahiro Yamada 提交于
      In old days, the "host-progs" syntax was used for specifying host
      programs. It was renamed to the current "hostprogs-y" in 2004.
      
      It is typically useful in scripts/Makefile because it allows Kbuild to
      selectively compile host programs based on the kernel configuration.
      
      This commit renames like follows:
      
        always       ->  always-y
        hostprogs-y  ->  hostprogs
      
      So, scripts/Makefile will look like this:
      
        always-$(CONFIG_BUILD_BIN2C) += ...
        always-$(CONFIG_KALLSYMS)    += ...
            ...
        hostprogs := $(always-y) $(always-m)
      
      I think this makes more sense because a host program is always a host
      program, irrespective of the kernel configuration. We want to specify
      which ones to compile by CONFIG options, so always-y will be handier.
      
      The "always", "hostprogs-y", "hostprogs-m" will be kept for backward
      compatibility for a while.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      5f2fb52f
  3. 07 1月, 2020 3 次提交
    • T
      kconfig: Add yes2modconfig and mod2yesconfig targets. · 89b90609
      Tetsuo Handa 提交于
      Since kernel configs provided by syzbot are close to "make allyesconfig",
      it takes long time to rebuild. This is especially waste of time when we
      need to rebuild for many times (e.g. doing manual printk() inspection,
      bisect operations).
      
      We can save time if we can exclude modules which are irrelevant to each
      problem. But "make localmodconfig" cannot exclude modules which are built
      into vmlinux because /sbin/lsmod output is used as the source of modules.
      
      Therefore, this patch adds "make yes2modconfig" which converts from =y
      to =m if possible. After confirming that the interested problem is still
      reproducible, we can try "make localmodconfig" (and/or manually tune
      based on "Modules linked in:" line) in order to exclude modules which are
      irrelevant to the interested problem. While we are at it, this patch also
      adds "make mod2yesconfig" which converts from =m to =y in case someone
      wants to convert from =m to =y after "make localmodconfig".
      Signed-off-by: NTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      89b90609
    • M
      kconfig: use $(PERL) in Makefile · c8138a57
      Masahiro Yamada 提交于
      The top Makefile defines and exports the variable 'PERL'. Use it in
      case somebody wants to specify a particular version of perl from the
      command line.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      c8138a57
    • M
      kconfig: fix too deep indentation in Makefile · 1d135237
      Masahiro Yamada 提交于
      The indentation for if ... else ... fi is too deep. Fix it.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      1d135237
  4. 11 11月, 2019 3 次提交
  5. 04 9月, 2019 1 次提交
    • M
      kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj) · 54b8ae66
      Masahiro Yamada 提交于
      Kbuild provides per-file compiler flag addition/removal:
      
        CFLAGS_<basetarget>.o
        CFLAGS_REMOVE_<basetarget>.o
        AFLAGS_<basetarget>.o
        AFLAGS_REMOVE_<basetarget>.o
        CPPFLAGS_<basetarget>.lds
        HOSTCFLAGS_<basetarget>.o
        HOSTCXXFLAGS_<basetarget>.o
      
      The <basetarget> 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 := <some-flags>
      
      Here, the <some-flags> 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 := <some-flags>
        obj-y += dir/foo.o
        CFLAGS_dir/foo.o := <other-flags>
      
      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: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NMarc Zyngier <maz@kernel.org>
      54b8ae66
  6. 29 8月, 2019 1 次提交
  7. 17 7月, 2019 1 次提交
  8. 09 6月, 2019 2 次提交
  9. 19 5月, 2019 1 次提交
  10. 18 5月, 2019 1 次提交
  11. 13 2月, 2019 2 次提交
  12. 14 1月, 2019 1 次提交
  13. 06 1月, 2019 2 次提交
  14. 28 12月, 2018 3 次提交
  15. 01 11月, 2018 2 次提交
  16. 03 9月, 2018 1 次提交
  17. 22 8月, 2018 2 次提交
    • M
      kconfig: fix "Can't open ..." in parallel build · 98a4afbf
      Masahiro Yamada 提交于
      If you run "make menuconfig" or "make nconfig" with -j<N> option in a
      fresh source tree, you will see several "Can't open ..." messages:
      
        $ make -j8 menuconfig
          HOSTCC  scripts/basic/fixdep
          YACC    scripts/kconfig/zconf.tab.c
          LEX     scripts/kconfig/zconf.lex.c
        /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
        /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
        /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
        /bin/sh: 1: .:   HOSTCC  scripts/kconfig/lxdialog/checklist.o
        Can't open scripts/kconfig/.mconf-cfg
        /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
        /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
        /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
          HOSTCC  scripts/kconfig/lxdialog/inputbox.o
        /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
        /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
        /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
          UPD     scripts/kconfig/.mconf-cfg
        /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
          HOSTCC  scripts/kconfig/lxdialog/menubox.o
          HOSTCC  scripts/kconfig/lxdialog/textbox.o
          HOSTCC  scripts/kconfig/lxdialog/util.o
          HOSTCC  scripts/kconfig/lxdialog/yesno.o
          HOSTCC  scripts/kconfig/mconf.o
          HOSTCC  scripts/kconfig/zconf.tab.o
          HOSTLD  scripts/kconfig/mconf
      
      Correct dependencies to fix this problem.
      
      Fixes: 1c5af5cf ("kconfig: refactor ncurses package checks for building mconf and nconf")
      Cc: linux-stable <stable@vger.kernel.org> # v4.18
      Reported-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: NBorislav Petkov <bp@suse.de>
      98a4afbf
    • R
      kconfig: add build-only configurator targets · 4bf6a9af
      Randy Dunlap 提交于
      Add build-only targets for build_menuconfig, build_nconfig,
      build_xconfig, and build_gconfig.
      (targets must end in "config" to qualify in top-level Makefile)
      
      This allows these target to be built without execution (e.g., to
      look for errors or warnings) and/or to be built and checked by sparse.
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      4bf6a9af
  18. 25 7月, 2018 2 次提交
  19. 18 7月, 2018 2 次提交
  20. 05 6月, 2018 2 次提交
  21. 28 5月, 2018 4 次提交
  22. 07 4月, 2018 2 次提交
    • M
      kbuild: add %.lex.c and %.tab.[ch] to 'targets' automatically · b23d1a24
      Masahiro Yamada 提交于
      Files generated by if_changed* must be added to 'targets' to include
      *.cmd files.  Otherwise, they would be regenerated every time.
      
      The build system automatically adds objects to 'targets' where
      appropriate, such as obj-y, extra-y, etc. but does nothing for
      intermediate files.  So, each Makefile needs to add them by itself.
      
      There are some common cases where objects are generated by chained
      rules.  Lexers and parsers are compiled like follows:
      
         %.lex.o <- %.lex.c <- %.l
         %.tab.o <- %.tab.c <- %.y
      
      They are common patterns, so it is reasonable to take care of them
      in the core Makefile instead of requiring each Makefile to do so.
      
      At this moment, you cannot delete 'target += zconf.lex.c' in the
      Kconfig Makefile because zconf.lex.c is included from zconf.tab.c
      instead of being compiled separately.  It should be deleted after
      Kconfig is more refactored.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NFrank Rowand <frowand.list@gmail.com>
      b23d1a24
    • M
      kbuild: clean up *.lex.c and *.tab.[ch] patterns from top-level Makefile · 9a8dfb39
      Masahiro Yamada 提交于
      Files suffixed by .lex.c, .tab.[ch] are generated lexers, parsers,
      respectively.  Clean them up globally from the top Makefile.
      
      Some of the final host programs those lexer/parser are linked into
      are necessary for building external modules, but the intermediates
      are unneeded.  They can be cleaned away by 'make clean' instead of
      'make mrproper'.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NFrank Rowand <frowand.list@gmail.com>
      9a8dfb39