Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Mar 29, 2020
    • Masahiro Yamada's avatar
      kbuild: remove AS variable · aa824e0c
      Masahiro Yamada authored
      As commit 5ef87263
      
       ("kbuild: get rid of misleading $(AS) from
      documents") noted, we rarely use $(AS) directly in the kernel build.
      
      Now that the only/last user of $(AS) in drivers/net/wan/Makefile was
      converted to $(CC), $(AS) is no longer used in the build process.
      
      You can still pass in AS=clang, which is just a switch to turn on
      the LLVM integrated assembler.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Tested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      aa824e0c
    • Masahiro Yamada's avatar
      kbuild: add comment about grouped target · f463c351
      Masahiro Yamada authored
      
      GNU Make commit 8c888d95f618 ("[SV 8297] Implement "grouped targets"
      for explicit rules.") added the '&:' syntax.
      
      I think '&:' is a perfect fit here, but we cannot use it any time
      soon. Just add a TODO comment.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      f463c351
    • Masahiro Yamada's avatar
      kbuild: add -Wall to KBUILD_HOSTCXXFLAGS · 735aab1e
      Masahiro Yamada authored
      
      Add -Wall to catch more warnings for C++ host programs.
      
      When I submitted the previous version, the 0-day bot reported
      -Wc++11-compat warnings for old GCC:
      
        HOSTCXX -fPIC scripts/gcc-plugins/latent_entropy_plugin.o
      In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/tm.h:28:0,
                       from scripts/gcc-plugins/gcc-common.h:15,
                       from scripts/gcc-plugins/latent_entropy_plugin.c:78:
      /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/config/elfos.h:102:21: warning: C++11 requires a space between string literal and macro [-Wc++11-compat]
          fprintf ((FILE), "%s"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\
                           ^
      /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/config/elfos.h:170:24: warning: C++11 requires a space between string literal and macro [-Wc++11-compat]
             fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",  \
                              ^
      In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/tm.h:42:0,
                       from scripts/gcc-plugins/gcc-common.h:15,
                       from scripts/gcc-plugins/latent_entropy_plugin.c:78:
      /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/defaults.h:126:24: warning: C++11 requires a space between string literal and macro [-Wc++11-compat]
             fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",  \
                              ^
      
      The source of the warnings is in the plugin headers, so we have no
      control of it. I just suppressed them by adding -Wno-c++11-compat to
      scripts/gcc-plugins/Makefile.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      735aab1e
  2. Mar 24, 2020
  3. Mar 19, 2020
  4. Mar 12, 2020
    • Masahiro Yamada's avatar
      kbuild: allow to run dt_binding_check without kernel configuration · 9dffecc1
      Masahiro Yamada authored
      
      The dt_binding_check target is located outside of the
      'ifneq ($(dtstree),) ... endif' block.
      
      So, you can run 'make dt_binding_check' on any architecture.
      This makes a perfect sense because the dt-schema is arch-agnostic.
      
      The only one problem I see is that scripts/dtc/dtc is not always built.
      For example, ARCH=x86 defconfig does not define CONFIG_DTC. Kbuild
      descends into scripts/dtc/ with doing nothing. Then, it fails to build
      *.example.dt.yaml files.
      
      Let's build scripts/dtc/dtc forcibly when running dt_binding_check.
      
      The dt-schema does not depend on any CONFIG option either, so you
      should be able to run dt_binding_check without the .config file.
      
      Going forward, you can directly run 'make dt_binding_check' in a
      pristine source tree.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      9dffecc1
    • Masahiro Yamada's avatar
      kbuild: allow to run dt_binding_check and dtbs_check in a single command · e10c4321
      Masahiro Yamada authored
      Since commit 93512dad
      
       ("dt-bindings: Improve validation build error
      handling"), 'make dtbs_check' does not validate the schema fully.
      
      If you want to check everything, you need to run two commands separately.
      
        $ make ARCH=arm dt_binding_check
        $ make ARCH=arm dtbs_check
      
      They are exclusive each other, so you cannot do like this:
      
        $ make ARCH=arm dt_binding_check dtbs_check
      
      In this case, dt-doc-validate and dt-extract-example are skipped
      because CHECK_DTBS is set.
      
      Let's make it possible to run these two targets in a single command.
      It will be useful for schema writers.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      e10c4321
    • Masahiro Yamada's avatar
      kbuild: avoid concurrency issue in parallel building dtbs and dtbs_check · b5154bf6
      Masahiro Yamada authored
      
      'make dtbs_check' checks the shecma in addition to building *.dtb files,
      in other words, 'make dtbs_check' is a super-set of 'make dtbs'.
      So, you do not have to do 'make dtbs dtbs_check', but I want to keep
      the build system as robust as possible in any use.
      
      Currently, 'dtbs' and 'dtbs_check' are independent of each other.
      In parallel building, two threads descend into arch/*/boot/dts/,
      one for dtbs and the other for dtbs_check, then end up with building
      the same DTB simultaneously.
      
      This commit fixes the concurrency issue. Otherwise, I see build errors
      like follows:
      
      $ make ARCH=arm64 defconfig
      $ make -j16 ARCH=arm64 DT_SCHEMA_FILES=Documentation/devicetree/bindings/arm/psci.yaml dtbs dtbs_check
        <snip>
        DTC     arch/arm64/boot/dts/qcom/sdm845-cheza-r2.dtb
        DTC     arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtb
        DTC     arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb
        DTC     arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb
        DTC     arch/arm64/boot/dts/freescale/imx8mn-evk.dtb
        DTC     arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb
        DTC     arch/arm64/boot/dts/zte/zx296718-pcbox.dtb
        DTC     arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dt.yaml
        DTC     arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dtb
        DTC     arch/arm64/boot/dts/xilinx/zynqmp-zc1254-revA.dtb
        DTC     arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dtb
        DTC     arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet-inx.dtb
        DTC     arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb
        CHECK   arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dt.yaml
      fixdep: error opening file: arch/arm64/boot/dts/allwinner/.sun50i-h6-orangepi-lite2.dtb.d: No such file or directory
      make[2]: *** [scripts/Makefile.lib:296: arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb] Error 2
      make[2]: *** Deleting file 'arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb'
      make[2]: *** Waiting for unfinished jobs....
        DTC     arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet-kd.dtb
        DTC     arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p231.dtb
        DTC     arch/arm64/boot/dts/xilinx/zynqmp-zc1275-revA.dtb
        DTC     arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dtb
      fixdep: parse error; no targets found
      make[2]: *** [scripts/Makefile.lib:296: arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb] Error 1
      make[2]: *** Deleting file 'arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb'
      make[1]: *** [scripts/Makefile.build:505: arch/arm64/boot/dts/allwinner] Error 2
      make[1]: *** Waiting for unfinished jobs....
        DTC     arch/arm64/boot/dts/renesas/r8a77951-salvator-xs.dtb
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      b5154bf6
  5. Mar 03, 2020
    • Quentin Perret's avatar
      kbuild: generate autoksyms.h early · 88694cff
      Quentin Perret authored
      
      When doing a cold build, autoksyms.h starts empty, and is updated late
      in the build process to have visibility over the symbols used by in-tree
      drivers. But since the symbol whitelist is known upfront, it can be used
      to pre-populate autoksyms.h and maximize the amount of code that can be
      compiled to its final state in a single pass, hence reducing build time.
      
      Do this by using gen_autoksyms.sh to initialize autoksyms.h instead of
      creating an empty file.
      
      Acked-by: default avatarNicolas Pitre <nico@fluxnic.net>
      Tested-by: default avatarMatthias Maennich <maennich@google.com>
      Reviewed-by: default avatarMatthias Maennich <maennich@google.com>
      Signed-off-by: default avatarQuentin Perret <qperret@google.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      88694cff
    • Masahiro Yamada's avatar
      kbuild: use KBUILD_DEFCONFIG as the fallback for DEFCONFIG_LIST · 2a86f661
      Masahiro Yamada authored
      
      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: default avatarMasahiro Yamada <masahiroy@kernel.org>
      2a86f661
  6. Mar 02, 2020
  7. Mar 01, 2020
  8. Feb 26, 2020
  9. Feb 23, 2020
  10. Feb 16, 2020
  11. Feb 09, 2020
  12. Feb 05, 2020
  13. Jan 26, 2020
  14. Jan 19, 2020
  15. Jan 15, 2020
  16. Jan 12, 2020
  17. Jan 06, 2020
    • Masahiro Yamada's avatar
      kbuild: create modules.builtin without Makefile.modbuiltin or tristate.conf · 8b41fc44
      Masahiro Yamada authored
      Commit bc081dd6
      
       ("kbuild: generate modules.builtin") added
      infrastructure to generate modules.builtin, the list of all
      builtin modules.
      
      Basically, it works like this:
      
        - Kconfig generates include/config/tristate.conf, the list of
          tristate CONFIG options with a value in a capital letter.
      
        - scripts/Makefile.modbuiltin makes Kbuild descend into
          directories to collect the information of builtin modules.
      
      I am not a big fan of it because Kbuild ends up with traversing
      the source tree twice.
      
      I am not sure how perfectly it should work, but this approach cannot
      avoid false positives; even if the relevant CONFIG option is tristate,
      some Makefiles forces obj-m to obj-y.
      
      Some examples are:
      
        arch/powerpc/platforms/powermac/Makefile:
          obj-$(CONFIG_NVRAM:m=y)         += nvram.o
      
        net/ipv6/Makefile:
          obj-$(subst m,y,$(CONFIG_IPV6)) += inet6_hashtables.o
      
        net/netlabel/Makefile:
          obj-$(subst m,y,$(CONFIG_IPV6)) += netlabel_calipso.o
      
      Nobody has complained about (or noticed) it, so it is probably fine to
      have false positives in modules.builtin.
      
      This commit simplifies the implementation. Let's exploit the fact
      that every module has MODULE_LICENSE(). (modpost shows a warning if
      MODULE_LICENSE is missing. If so, 0-day bot would already have blocked
      such a module.)
      
      I added MODULE_FILE to <linux/module.h>. When the code is being compiled
      as builtin, it will be filled with the file path of the module, and
      collected into modules.builtin.info. Then, scripts/link-vmlinux.sh
      extracts the list of builtin modules out of it.
      
      This new approach fixes the false-positives above, but adds another
      type of false-positives; non-modular code may have MODULE_LICENSE()
      by mistake. This is not a big deal, it is just the code is always
      orphan. We can clean it up if we like. You can see cleanup examples by:
      
        $ git log --grep='make.* explicitly non-modular'
      
      To sum up, this commits deletes lots of code, but still produces almost
      equivalent results. Please note it does not increase the vmlinux size at
      all. As you can see in include/asm-generic/vmlinux.lds.h, the .modinfo
      section is discarded in the link stage.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      8b41fc44
  18. Jan 05, 2020
  19. Dec 29, 2019
  20. Dec 22, 2019
  21. Dec 15, 2019
  22. Dec 14, 2019
  23. Dec 08, 2019
  24. Nov 24, 2019
  25. Nov 23, 2019
  26. Nov 17, 2019
  27. Nov 14, 2019
  28. Nov 11, 2019