1. 29 8月, 2019 7 次提交
  2. 25 8月, 2019 3 次提交
  3. 22 8月, 2019 1 次提交
  4. 21 8月, 2019 6 次提交
    • M
      kbuild: rebuild modules when module linker scripts are updated · 10df0638
      Masahiro Yamada 提交于
      Currently, the timestamp of module linker scripts are not checked.
      Add them to the dependency of modules so they are correctly rebuilt.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      10df0638
    • M
      kbuild: make single targets work more correctly · 394053f4
      Masahiro Yamada 提交于
      Currently, the single target build directly descends into the directory
      of the target. For example,
      
        $ make foo/bar/baz.o
      
      ... directly descends into foo/bar/.
      
      On the other hand, the normal build usually descends one directory at
      a time, i.e. descends into foo/, and then foo/bar/.
      
      This difference causes some problems.
      
      [1] miss subdir-asflags-y, subdir-ccflags-y in upper Makefiles
      
          The options in subdir-{as,cc}flags-y take effect in the current
          and its sub-directories. In other words, they are inherited
          downward. In the example above, the single target will miss
          subdir-{as,cc}flags-y if they are defined in foo/Makefile.
      
      [2] could be built in a different directory
      
          As Documentation/kbuild/modules.rst section 4.3 says, Kbuild can
          handle files that are spread over several sub-directories.
      
          The build rule of foo/bar/baz.o may not necessarily be specified in
          foo/bar/Makefile. It might be specifies in foo/Makefile as follows:
      
          [foo/Makefile]
          obj-y := bar/baz.o
      
          This often happens when a module is so big that its source files
          are divided into sub-directories.
      
          In this case, there is no Makefile in the foo/bar/ directory, yet
          the single target descends into foo/bar/, then fails due to the
          missing Makefile. You can still do 'make foo/bar/' for partial
          building, but cannot do 'make foo/bar/baz.s'. I believe the single
          target '%.s' is a useful feature for inspecting the compiler output.
      
          Some modules work around this issue by putting an empty Makefile
          in every sub-directory.
      
      This commit fixes those problems by making the single target build
      descend in the same way as the normal build does.
      
      Another change is the single target build will observe the CONFIG
      options. Previously, it allowed users to build the foo.o even when
      the corresponding CONFIG_FOO is disabled:
      
         obj-$(CONFIG_FOO) += foo.o
      
      In the new behavior, the single target build will just fail and show
      "No rule to make target ..." (or "Nothing to be done for ..." if the
      stale object already exists, but cannot be updated).
      
      The disadvantage of this commit is the build speed. Now that the
      single target build visits every directory and parses lots of
      Makefiles, it is slower than before. (But, I hope it will not be
      too slow.)
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      394053f4
    • M
      kbuild: unify clean-dirs rule for in-kernel and external module · 76cd306d
      Masahiro Yamada 提交于
      Factor out the duplicated code for in-kernel and external module
      cleaning.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      76cd306d
    • M
      kbuild: unify vmlinux-dirs and module-dirs rules · c99f3918
      Masahiro Yamada 提交于
      The in-kernel build and external module build have similar code
      for descending into sub-directories.
      
      Factor out the code into the common place.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      c99f3918
    • M
      kbuild: unset variables in top Makefile instead of setting 0 · 2042b548
      Masahiro Yamada 提交于
      There is no need to set 0 to variables such as config-targets,
      mixed-targets, etc.
      
      Unset instead of setting 0 in order to use 'ifdef' to test them.
      
      I also renamed:
      
        config-targets  ->  config-build
        mixed-targets   ->  mixed-build
        dot-config      ->  need-config
      
      to clarify what we are doing.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      2042b548
    • M
      kbuild: do not descend to ./Kbuild when cleaning · 125d059b
      Masahiro Yamada 提交于
      'make clean' descends into ./Kbuild, but does not clean anything
      since everything is added to no-clean-files.
      
      There is no need to descend to ./Kbuild in the first place.
      We can drop the no-clean-files assignment.
      
      With this, there is no more user of no-clean-files. I will keep it
      for a while to see whether a new user will appear.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      125d059b
  5. 15 8月, 2019 2 次提交
  6. 12 8月, 2019 1 次提交
  7. 11 8月, 2019 1 次提交
  8. 10 8月, 2019 2 次提交
    • M
      kbuild: show hint if subdir-y/m is used to visit module Makefile · c07d8d47
      Masahiro Yamada 提交于
      Since commit ff9b45c5 ("kbuild: modpost: read modules.order instead
      of $(MODVERDIR)/*.mod"), a module is no longer built in the following
      pattern:
      
        [Makefile]
        subdir-y := some-module
      
        [some-module/Makefile]
        obj-m := some-module.o
      
      You cannot write Makefile this way in upstream because modules.order is
      not correctly generated. subdir-y is used to descend to a sub-directory
      that builds tools, device trees, etc.
      
      For external modules, the modules order does not matter. So, the
      Makefile above was known to work.
      
      I believe the Makefile should be re-written as follows:
      
        [Makefile]
        obj-m := some-module/
      
        [some-module/Makefile]
        obj-m := some-module.o
      
      However, people will have no idea if their Makefile suddenly stops
      working. In fact, I received questions from multiple people.
      
      Show a warning for a while if obj-m is specified in a Makefile visited
      by subdir-y or subdir-m.
      
      I touched the %/ rule to avoid false-positive warnings for the single
      target.
      
      Cc: Jan Kiszka <jan.kiszka@siemens.com>
      Cc: Tom Stonecypher <thomas.edwardx.stonecypher@intel.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: NJan Kiszka <jan.kiszka@siemens.com>
      c07d8d47
    • M
      kbuild: revive single target %.ko · 47801c97
      Masahiro Yamada 提交于
      I removed the single target %.ko in commit ff9b45c5 ("kbuild:
      modpost: read modules.order instead of $(MODVERDIR)/*.mod") because
      the modpost stage does not work reliably. For instance, the module
      dependency, modversion, etc. do not work if we lack symbol information
      from the other modules.
      
      Yet, some people still want to build only one module in their interest,
      and it may be still useful if it is used within those limitations.
      
      Fixes: ff9b45c5 ("kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod")
      Reported-by: NDon Brace <don.brace@microsemi.com>
      Reported-by: NArend Van Spriel <arend.vanspriel@broadcom.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      47801c97
  9. 08 8月, 2019 1 次提交
  10. 05 8月, 2019 1 次提交
  11. 31 7月, 2019 1 次提交
  12. 29 7月, 2019 1 次提交
  13. 26 7月, 2019 1 次提交
    • G
      Makefile: Globally enable fall-through warning · a035d552
      Gustavo A. R. Silva 提交于
      Now that all the fall-through warnings have been addressed in the
      kernel, enable the fall-through warning globally.
      
      Also, update the deprecated.rst file to include implicit fall-through
      as 'deprecated' so people can be pointed to a single location for
      justification.
      
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Marek <michal.lkml@markovi.net>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: linux-kbuild@vger.kernel.org
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      a035d552
  14. 22 7月, 2019 1 次提交
  15. 20 7月, 2019 1 次提交
  16. 18 7月, 2019 3 次提交
    • M
      kbuild: remove 'prepare1' target · 30527cef
      Masahiro Yamada 提交于
      Now that there is no rule for 'prepare1', it can go away.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      30527cef
    • 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. 17 7月, 2019 4 次提交
    • M
      kbuild: get rid of kernel/ prefix from in-tree modules.{order,builtin} · 1bd9a468
      Masahiro Yamada 提交于
      Removing the 'kernel/' prefix will make our life easier because we can
      simply do 'cat modules.order' to get all built modules with full paths.
      
      Currently, we parse the first line of '*.mod' files in $(MODVERDIR).
      Since we have duplicated functionality here, I plan to remove MODVERDIR
      entirely.
      
      In fact, modules.order is generated also for external modules in a
      broken format. It adds the 'kernel/' prefix to the absolute path of
      the module, like this:
      
        kernel//path/to/your/external/module/foo.ko
      
      This is fine for now since modules.order is not used for external
      modules. However, I want to sanitize the format everywhere towards
      the goal of removing MODVERDIR.
      
      We cannot change the format of installed module.{order,builtin}.
      So, 'make modules_install' will add the 'kernel/' prefix while copying
      them to $(MODLIB)/.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      1bd9a468
    • M
      kbuild: do not create empty modules.order in the prepare stage · 7e131918
      Masahiro Yamada 提交于
      Currently, $(objtree)/modules.order is touched in two places.
      
      In the 'prepare0' rule, scripts/Makefile.build creates an empty
      modules.order while processing 'obj=.'
      
      In the 'modules' rule, the top-level Makefile overwrites it with
      the correct list of modules.
      
      While this might be a good side-effect that modules.order is made
      empty every time (probably this is not intended functionality),
      I personally do not like this behavior.
      
      Create modules.order only when it is sensible to do so.
      
      This avoids creating the following pointless files:
      
        scripts/basic/modules.order
        scripts/dtc/modules.order
        scripts/gcc-plugins/modules.order
        scripts/genksyms/modules.order
        scripts/mod/modules.order
        scripts/modules.order
        scripts/selinux/genheaders/modules.order
        scripts/selinux/mdp/modules.order
        scripts/selinux/modules.order
      
      Going forward, $(objtree)/modules.order lists the modules that
      was built in the last successful build.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      7e131918
    • M
      kbuild: remove tag files by distclean instead of mrproper · 46457133
      Masahiro Yamada 提交于
      It takes somewhat long time to generate these tag files.
      Keep such precious files until we run 'make distclean'.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      46457133
    • M
      kbuild: add --hash-style= and --build-id unconditionally · 89ff7131
      Masahiro Yamada 提交于
      As commit 1e022137 ("mips: vdso: drop unnecessary cc-ldoption")
      explained, these flags are supported by the minimal required version
      of binutils. They are supported by ld.lld too.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: NNathan Chancellor <natechancellor@gmail.com>
      Tested-by: NNathan Chancellor <natechancellor@gmail.com>
      89ff7131
  18. 10 7月, 2019 3 次提交
    • G
      kbuild: Inform user to pass ARCH= for make mrproper · 3a475b21
      Geert Uytterhoeven 提交于
      When cross-compiling an out-of-tree build with an unclean source tree
      directory, the build fails with:
      
        /path/to/kernel/source/tree is not clean, please run 'make mrproper'
        in the '/path/to/kernel/source/tree' directory.
      
      However, doing so does not fix the problem, as "make mrproper" now
      requires passing the target architecture to the make command, else it
      won't remove $(srctree)/arch/$(SRCARCH)/include/generated.
      "git ls-files -o" doesn't give a clue, as it doesn't list (empty)
      directories, only files.
      
      Improve usability by including the ARCH= option in the error output.
      
      Fixes: a788b2ed ("kbuild: check arch/$(SRCARCH)/include/generated before out-of-tree build")
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      3a475b21
    • M
      kbuild: add a flag to force absolute path for srctree · 95fd3f87
      Masahiro Yamada 提交于
      In old days, Kbuild always used an absolute path for $(srctree).
      
      Since commit 890676c6 ("kbuild: Use relative path when building in
      the source tree"), $(srctree) is '.' when O= was not passed from the
      command line.
      
      Yet, using absolute paths is useful in some cases even without O=, for
      instance, to create a cscope file with absolute path tags.
      
      'O=.' was known to work as a workaround to force Kbuild to use absolute
      paths even when you are building in the source tree.
      
      Since commit 25b146c5 ("kbuild: allow Kbuild to start from any
      directory"), Kbuild is too clever to be tricked. Even if you pass 'O=.'
      Kbuild notices you are building in the source tree, then use '.' for
      $(srctree).
      
      So, 'make O=. cscope' is no help to create absolute path tags.
      
      We cannot force one or the other according to commit e93bc1a0
      ("Revert "kbuild: specify absolute paths for cscope""). Both of
      relative path and absolute path have pros and cons.
      
      This commit adds a new flag KBUILD_ABS_SRCTREE to allow users to
      choose the absolute path for $(srctree).
      
      'make KBUILD_ABS_SRCTREE=1 cscope' will work as a replacement of
      'make O=. cscope'.
      Reported-by: NPawan Gupta <pawan.kumar.gupta@linux.intel.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      95fd3f87
    • M
      kbuild: replace KBUILD_SRCTREE with boolean building_out_of_srctree · 051f278e
      Masahiro Yamada 提交于
      Commit 25b146c5 ("kbuild: allow Kbuild to start from any directory")
      deprecated KBUILD_SRCTREE.
      
      It is only used in tools/testing/selftest/ to distinguish out-of-tree
      build. Replace it with a new boolean flag, building_out_of_srctree.
      
      I also replaced the conditional ($(srctree),.) because the next commit
      will allow an absolute path to be used for $(srctree) even when building
      in the source tree.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      051f278e