1. 15 3月, 2021 1 次提交
    • M
      kbuild: prefix $(srctree)/ to some included Makefiles · 3204a7fb
      Masahiro Yamada 提交于
      VPATH is used in Kbuild to make pattern rules search for prerequisites
      in both $(objtree) and $(srctree). Some of *.c, *.S files are not real
      sources, but generated by tools such as flex, bison, perl.
      
      In contrast, I doubt the benefit of --include-dir=$(abs_srctree) because
      it is always clear which Makefiles are real sources, and which are not.
      
      So, my hope is to add $(srctree)/ prefix to all check-in Makefiles,
      then remove --include-dir=$(abs_srctree) flag in the future.
      
      I am touching only some Kbuild core parts for now. Treewide fixes will
      be needed to achieve this goal.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      3204a7fb
  2. 15 1月, 2021 2 次提交
  3. 02 8月, 2020 1 次提交
  4. 06 6月, 2020 9 次提交
  5. 03 6月, 2020 3 次提交
    • M
      modpost: pass -N option only for modules modpost · 4e5ab74c
      Masahiro Yamada 提交于
      The built-in only code is not required to have MODULE_IMPORT_NS() to
      use symbols. So, the namespace is not checked for vmlinux(.o).
      
      Do not pass the meaningless -N option to the first pass of modpost.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      4e5ab74c
    • M
      modpost: move -T option close to the modpost command · 89d61176
      Masahiro Yamada 提交于
      The '-T -' option reads the file list from stdin.
      
      It is clearer to put it close to the piped command.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      89d61176
    • M
      modpost: fix -i (--ignore-errors) MAKEFLAGS detection · 91e6ee58
      Masahiro Yamada 提交于
      $(filter -i,$(MAKEFLAGS)) works only in limited use-cases.
      
      The representation of $(MAKEFLAGS) depends on various factors:
        - GNU Make version (version 3.8x or version 4.x)
        - The presence of other flags like -j
      
      In my experiments, $(MAKEFLAGS) is expanded as follows:
      
        * GNU Make 3.8x:
      
          * without -j option:
            --no-print-directory -Rri
      
          * with -j option:
            --no-print-directory -Rr --jobserver-fds=3,4 -j -i
      
        * GNU Make 4.x:
      
          * without -j option:
            irR --no-print-directory
      
          * with -j option:
            irR -j --jobserver-fds=3,4 --no-print-directory
      
      For GNU Make 4.x, the flags are grouped as 'irR', which does not work.
      
      For the single thread build with GNU Make 3.8x, the flags are grouped
      as '-Rri', which does not work either.
      
      To make it work for all cases, do likewise as commit 6f0fa58e
      ("kbuild: simplify silent build (-s) detection").
      
      BTW, since commit ff9b45c5 ("kbuild: modpost: read modules.order
      instead of $(MODVERDIR)/*.mod"), you also need to pass -k option to
      build final *.ko files. 'make -i -k' ignores compile errors in modules,
      and build as many remaining *.ko as possible.
      
      Please note this feature is kind of dangerous if other modules depend
      on the broken module because the generated modules will lack the correct
      module dependency or CRC. Honestly, I am not a big fan of it, but I am
      keeping this feature.
      
      Fixes: eed380f3 ("modpost: Optionally ignore secondary errors seen if a single module build fails")
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      91e6ee58
  6. 29 5月, 2020 1 次提交
    • M
      kbuild: disallow multi-word in M= or KBUILD_EXTMOD · e9e81b63
      Masahiro Yamada 提交于
      $(firstword ...) in scripts/Makefile.modpost was added by commit
      3f3fd3c0 ("[PATCH] kbuild: allow multi-word $M in Makefile.modpost")
      to build multiple external module directories.
      
      It was a solution to resolve symbol dependencies when an external
      module depends on another external module.
      
      Commit 0d96fb20 ("kbuild: Add new Kbuild variable
      KBUILD_EXTRA_SYMBOLS") introduced another solution by passing symbol
      info via KBUILD_EXTRA_SYMBOLS, then broke the multi-word M= support.
      
        include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \
                     $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile)
      
      ... does not work if KBUILD_EXTMOD contains multiple words.
      
      This feature has been broken for more than a decade. Remove the
      bitrotten code, and stop parsing if M or KBUILD_EXTMOD contains
      multiple words.
      
      As Documentation/kbuild/modules.rst explains, if your module depends
      on another one, there are two solutions:
        - add a common top-level Kbuild file
        - use KBUILD_EXTRA_SYMBOLS
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      e9e81b63
  7. 13 3月, 2020 1 次提交
  8. 16 1月, 2020 1 次提交
  9. 11 11月, 2019 6 次提交
  10. 10 9月, 2019 1 次提交
  11. 22 8月, 2019 1 次提交
  12. 21 8月, 2019 1 次提交
  13. 14 8月, 2019 2 次提交
  14. 10 8月, 2019 1 次提交
  15. 31 7月, 2019 4 次提交
  16. 18 7月, 2019 2 次提交
    • M
      kbuild: create *.mod with full directory path and remove MODVERDIR · b7dca6dd
      Masahiro Yamada 提交于
      While descending directories, Kbuild produces objects for modules,
      but do not link final *.ko files; it is done in the modpost.
      
      To keep track of modules, Kbuild creates a *.mod file in $(MODVERDIR)
      for every module it is building. Some post-processing steps read the
      necessary information from *.mod files. This avoids descending into
      directories again. This mechanism was introduced in 2003 or so.
      
      Later, commit 551559e1 ("kbuild: implement modules.order") added
      modules.order. So, we can simply read it out to know all the modules
      with directory paths. This is easier than parsing the first line of
      *.mod files.
      
      $(MODVERDIR) has a flat directory structure, that is, *.mod files
      are named only with base names. This is based on the assumption that
      the module name is unique across the tree. This assumption is really
      fragile.
      
      Stephen Rothwell reported a race condition caused by a module name
      conflict:
      
        https://lkml.org/lkml/2019/5/13/991
      
      In parallel building, two different threads could write to the same
      $(MODVERDIR)/*.mod simultaneously.
      
      Non-unique module names are the source of all kind of troubles, hence
      commit 3a48a919 ("kbuild: check uniqueness of module names")
      introduced a new checker script.
      
      However, it is still fragile in the build system point of view because
      this race happens before scripts/modules-check.sh is invoked. If it
      happens again, the modpost will emit unclear error messages.
      
      To fix this issue completely, create *.mod with full directory path
      so that two threads never attempt to write to the same file.
      
      $(MODVERDIR) is no longer needed.
      
      Since modules with directory paths are listed in modules.order, Kbuild
      is still able to find *.mod files without additional descending.
      
      I also killed cmd_secanalysis; scripts/mod/sumversion.c computes MD4 hash
      for modules with MODULE_VERSION(). When CONFIG_DEBUG_SECTION_MISMATCH=y,
      it occurs not only in the modpost stage, but also during directory
      descending, where sumversion.c may parse stale *.mod files. It would emit
      'No such file or directory' warning when an object consisting a module is
      renamed, or when a single-obj module is turned into a multi-obj module or
      vice versa.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NNicolas Pitre <nico@fluxnic.net>
      b7dca6dd
    • M
      kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod · ff9b45c5
      Masahiro Yamada 提交于
      Towards the goal of removing MODVERDIR, read out modules.order to get
      the list of modules to be processed. This is simpler than parsing *.mod
      files in $(MODVERDIR).
      
      For external modules, $(KBUILD_EXTMOD)/modules.order should be read.
      
      I removed the single target %.ko from the top Makefile. To make sure
      modpost works correctly, vmlinux and the other modules must be built.
      You cannot build a particular .ko file alone.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      ff9b45c5
  17. 11 4月, 2019 1 次提交
    • W
      modpost: make KBUILD_MODPOST_WARN also configurable for external modules · 83da1bed
      Wiebe, Wladislav (Nokia - DE/Ulm) 提交于
      Commit ea837f1c ("kbuild: make modpost processing configurable")
      was intended to give KBUILD_MODPOST_WARN flexibility to be configurable.
      Right now KBUILD_MODPOST_WARN gets just ignored when KBUILD_EXTMOD is
      set which happens per default when building modules out of the tree.
      
      This change gives the opportunity to define module build behaving also
      in case of out of tree builds and default will become exit on error.
      Errors which can be detected by the build should be trapped out of the box
      there, unless somebody wants to notice broken stuff later at runtime.
      
      As this patch changes the default behaving from warning to error,
      users can consider to fix it for external module builds by:
      - providing module symbol table via KBUILD_EXTRA_SYMBOLS for
        modules which are dependent
      - OR getting old behaving back by passing KBUILD_MODPOST_WARN to the build
      Signed-off-by: NWladislav Wiebe <wladislav.wiebe@nokia.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      83da1bed
  18. 14 3月, 2019 1 次提交
  19. 28 1月, 2019 1 次提交
    • M
      kbuild: add real-prereqs shorthand for $(filter-out FORCE,$^) · afa974b7
      Masahiro Yamada 提交于
      In Kbuild, if_changed and friends must have FORCE as a prerequisite.
      
      Hence, $(filter-out FORCE,$^) or $(filter-out $(PHONY),$^) is a common
      idiom to get the names of all the prerequisites except phony targets.
      
      Add real-prereqs as a shorthand.
      
      Note:
      We cannot replace $(filter %.o,$^) in cmd_link_multi-m because $^ may
      include auto-generated dependencies from the .*.cmd file when a single
      object module is changed into a multi object module. Refer to commit
      69ea912f ("kbuild: remove unneeded link_multi_deps"). I added some
      comment to avoid accidental breakage.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NRob Herring <robh@kernel.org>
      afa974b7