Skip to content
Snippets Groups Projects
  1. Feb 01, 2021
  2. Jan 10, 2021
  3. Dec 21, 2020
  4. Oct 14, 2020
  5. Sep 03, 2020
  6. Aug 09, 2020
    • Masahiro Yamada's avatar
      kbuild: introduce hostprogs-always-y and userprogs-always-y · faabed29
      Masahiro Yamada authored
      
      To build host programs, you need to add the program names to 'hostprogs'
      to use the necessary build rule, but it is not enough to build them
      because there is no dependency.
      
      There are two types of host programs: built as the prerequisite of
      another (e.g. gen_crc32table in lib/Makefile), or always built when
      Kbuild visits the Makefile (e.g. genksyms in scripts/genksyms/Makefile).
      
      The latter is typical in Makefiles under scripts/, which contains host
      programs globally used during the kernel build. To build them, you need
      to add them to both 'hostprogs' and 'always-y'.
      
      This commit adds hostprogs-always-y as a shorthand.
      
      The same applies to user programs. net/bpfilter/Makefile builds
      bpfilter_umh on demand, hence always-y is unneeded. In contrast,
      programs under samples/ are added to both 'userprogs' and 'always-y'
      so they are always built when Kbuild visits the Makefiles.
      
      userprogs-always-y works as a shorthand.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: default avatarMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
      faabed29
    • Masahiro Yamada's avatar
      kbuild: introduce ccflags-remove-y and asflags-remove-y · 15d5761a
      Masahiro Yamada authored
      
      CFLAGS_REMOVE_<file>.o filters out flags when compiling a particular
      object, but there is no convenient way to do that for every object in
      a directory.
      
      Add ccflags-remove-y and asflags-remove-y to make it easily.
      
      Use ccflags-remove-y to clean up some Makefiles.
      
      The add/remove order works as follows:
      
       [1] KBUILD_CFLAGS specifies compiler flags used globally
      
       [2] ccflags-y adds compiler flags for all objects in the
           current Makefile
      
       [3] ccflags-remove-y removes compiler flags for all objects in the
           current Makefile (New feature)
      
       [4] CFLAGS_<file> adds compiler flags per file.
      
       [5] CFLAGS_REMOVE_<file> removes compiler flags per file.
      
      Having [3] before [4] allows us to remove flags from most (but not all)
      objects in the current Makefile.
      
      For example, kernel/trace/Makefile removes $(CC_FLAGS_FTRACE)
      from all objects in the directory, then adds it back to
      trace_selftest_dynamic.o and CFLAGS_trace_kprobe_selftest.o
      
      The same applies to lib/livepatch/Makefile.
      
      Please note ccflags-remove-y has no effect to the sub-directories.
      In contrast, the previous notation got rid of compiler flags also from
      all the sub-directories.
      
      The following are not affected because they have no sub-directories:
      
        arch/arm/boot/compressed/
        arch/powerpc/xmon/
        arch/sh/
        kernel/trace/
      
      However, lib/ has several sub-directories.
      
      To keep the behavior, I added ccflags-remove-y to all Makefiles
      in subdirectories of lib/, except the following:
      
        lib/vdso/Makefile        - Kbuild does not descend into this Makefile
        lib/raid/test/Makefile   - This is not used for the kernel build
      
      I think commit 2464a609 ("ftrace: do not trace library functions")
      excluded too much. In the next commit, I will remove ccflags-remove-y
      from the sub-directories of lib/.
      
      Suggested-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
      Acked-by: Brendan Higgins <brendanhiggins@google.com> (KUnit)
      Tested-by: default avatarAnders Roxell <anders.roxell@linaro.org>
      15d5761a
  7. Jun 06, 2020
  8. May 17, 2020
  9. Apr 23, 2020
  10. Mar 13, 2020
  11. Feb 27, 2020
  12. Feb 26, 2020
    • Masahiro Yamada's avatar
      kbuild: remove wrong documentation about mandatory-y · eccbde4f
      Masahiro Yamada authored
      
      This sentence does not make sense in the section about mandatory-y.
      
      This seems to be a copy-paste mistake of commit fcc8487d ("uapi:
      export all headers under uapi directories").
      
      The correct description would be "The convention is to list one
      mandatory-y per line ...".
      
      I just removed it instead of fixing it. If such information is needed,
      it could be commented in include/asm-generic/Kbuild and
      include/uapi/asm-generic/Kbuild.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      eccbde4f
  13. Feb 03, 2020
    • Masahiro Yamada's avatar
      kbuild: rename hostprogs-y/always to hostprogs/always-y · 5f2fb52f
      Masahiro Yamada authored
      
      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: default avatarMasahiro Yamada <masahiroy@kernel.org>
      5f2fb52f
    • Masahiro Yamada's avatar
      kbuild: fix the document to use extra-y for vmlinux.lds · faa7bdd7
      Masahiro Yamada authored
      
      The difference between "always" and "extra-y" is that the targets
      listed in $(always) are always built, whereas the ones in $(extra-y)
      are built only when KBUILD_BUILTIN is set.
      
      So, "make modules" does not build the targets in $(extra-y).
      
      vmlinux.lds is only needed for linking vmlinux. So, adding it to extra-y
      is more correct. In fact, arch/x86/kernel/Makefile does this.
      
      Fix the example code.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      faa7bdd7
  14. Dec 21, 2019
    • Masahiro Yamada's avatar
      kbuild: clarify the difference between obj-y and obj-m w.r.t. descending · 28f94a44
      Masahiro Yamada authored
      
      Kbuild descends into a directory by either 'y' or 'm', but there is an
      important difference.
      
      Kbuild combines the built-in objects into built-in.a in each directory.
      The built-in.a in the directory visited by obj-y is merged into the
      built-in.a in the parent directory. This merge happens recursively
      when Kbuild is ascending back towards the top directory, then built-in
      objects are linked into vmlinux eventually. This works properly only
      when the Makefile specifying obj-y is reachable by the chain of obj-y.
      
      On the other hand, Kbuild does not take built-in.a from the directory
      visited by obj-m. This it, all the objects in that directory are
      supposed to be modular. If Kbuild descends into a directory by obj-m,
      but the Makefile in the sub-directory specifies obj-y, those objects
      are just left orphan.
      
      The current statement "Kbuild only uses this information to decide that
      it needs to visit the directory" is misleading. Clarify the difference.
      
      Reported-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarJohan Hovold <johan@kernel.org>
      28f94a44
  15. Nov 14, 2019
    • Masahiro Yamada's avatar
      kbuild: remove header compile test · fcbb8461
      Masahiro Yamada authored
      There are both positive and negative options about this feature.
      At first, I thought it was a good idea, but actually Linus stated a
      negative opinion (https://lkml.org/lkml/2019/9/29/227
      
      ). I admit it
      is ugly and annoying.
      
      The baseline I'd like to keep is the compile-test of uapi headers.
      (Otherwise, kernel developers have no way to ensure the correctness
      of the exported headers.)
      
      I will maintain a small build rule in usr/include/Makefile.
      Remove the other header test functionality.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      fcbb8461
  16. Oct 01, 2019
  17. Sep 04, 2019
  18. Aug 29, 2019
  19. Aug 28, 2019
    • Masahiro Yamada's avatar
      docs: kbuild: remove cc-ldoption from document again · d20558d1
      Masahiro Yamada authored
      
      Commit 055efab3 ("kbuild: drop support for cc-ldoption") correctly
      removed the cc-ldoption from Documentation/kbuild/makefiles.txt, but
      commit cd238eff ("docs: kbuild: convert docs to ReST and rename
      to *.rst") revived it. I guess it was a rebase mistake.
      
      Remove it again.
      
      Fixes: cd238eff ("docs: kbuild: convert docs to ReST and rename to *.rst")
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      d20558d1
    • Masahiro Yamada's avatar
      docs: kbuild: fix invalid ReST syntax · 4fef9dec
      Masahiro Yamada authored
      I see the following warnings when I open this document with a ReST
      viewer, retext:
      
      /home/masahiro/ref/linux/Documentation/kbuild/makefiles.rst:1142: (WARNING/2) Inline emphasis start-string without end-string.
      /home/masahiro/ref/linux/Documentation/kbuild/makefiles.rst:1152: (WARNING/2) Inline emphasis start-string without end-string.
      /home/masahiro/ref/linux/Documentation/kbuild/makefiles.rst:1154: (WARNING/2) Inline emphasis start-string without end-string.
      
      These hunks were added by commit e846f0dc ("kbuild: add support
      for ensuring headers are self-contained") and commit 1e21cbfa
      ("kbuild: support header-test-pattern-y"), respectively. They were
      written not for ReST but for the plain text, and merged via the
      kbuild tree.
      
      In the same development cycle, this document was converted to ReST
      by commit cd238eff ("docs: kbuild: convert docs to ReST and rename
      to *.rst"), and merged via the doc sub-system.
      
      Merging them together into Linus' tree resulted in the current situation.
      
      To fix the syntax, surround the asterisks with back-quotes, and
      use :: for the code sample.
      
      Fixes: 39ceda5c ("Merge tag 'kbuild-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild"
      
      )
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      4fef9dec
  20. Aug 21, 2019
  21. Jul 17, 2019
  22. Jul 15, 2019
  23. Jun 14, 2019
    • Mauro Carvalho Chehab's avatar
      docs: kbuild: convert docs to ReST and rename to *.rst · cd238eff
      Mauro Carvalho Chehab authored
      
      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: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      cd238eff
  24. May 20, 2019
  25. Mar 17, 2019
  26. Mar 04, 2019
    • Masahiro Yamada's avatar
      kbuild: remove cc-version macro · d3a918c6
      Masahiro Yamada authored
      
      There is no more direct user of this macro; it is only used by
      cc-ifversion.
      
      Calling this macro is not efficient since it invokes the compiler to
      get the compiler version. CONFIG_GCC_VERSION is already calculated in
      the Kconfig stage, so Makefile can reuse it.
      
      Here is a note about the slight difference between cc-version and
      CONFIG_GCC_VERSION:
      
      When using Clang, cc-version is evaluated to '0402' because Clang
      defines __GNUC__ and __GNUC__MINOR__, and looks like GCC 4.2 in the
      version point of view. On the other hand, CONFIG_GCC_VERSION=0
      when $(CC) is clang.
      
      There are currently two users of cc-ifversion:
        arch/mips/loongson64/Platform
        arch/powerpc/Makefile
      
      They are not affected by this change.
      
      The format of cc-version is <major><minor>, while CONFIG_GCC_VERSION
      <major><minor><patch>. I adjusted cc-ifversion for the difference of
      the number of digits.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      d3a918c6
  27. Jan 28, 2019
  28. Jan 06, 2019
  29. Nov 01, 2018
Loading