Skip to content
Snippets Groups Projects
  1. Sep 03, 2023
  2. Sep 01, 2023
  3. Aug 29, 2023
  4. Aug 27, 2023
  5. Aug 22, 2023
  6. Aug 20, 2023
  7. Aug 14, 2023
  8. Aug 13, 2023
  9. Aug 09, 2023
  10. Aug 07, 2023
  11. Aug 06, 2023
  12. Jul 30, 2023
  13. Jul 24, 2023
    • Masahiro Yamada's avatar
      kbuild: rpm-pkg: rename binkernel.spec to kernel.spec · 975667d0
      Masahiro Yamada authored
      
      Now kernel.spec and binkernel.spec have the exactly same contents.
      
      Use kernel.spec for binrpm-pkg as well.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      975667d0
    • Masahiro Yamada's avatar
      kbuild: add a phony target to run a command with Kbuild env vars · 76a48b8f
      Masahiro Yamada authored
      
      There are some cases where we want to run a command with the same
      environment variables as Kbuild uses. For example, 'make coccicheck'
      invokes scripts/coccicheck from the top Makefile so that the script can
      reference to ${LINUXINCLUDE}, ${KBUILD_EXTMOD}, etc. The top Makefile
      defines several phony targets that run a script.
      
      We do it also for an internally used script, which results in a somewhat
      complex call graph.
      
      One example:
      
       debian/rules binary-arch
         -> make intdeb-pkg
            -> scripts/package/builddeb
      
      It is also tedious to add a dedicated target like 'intdeb-pkg' for each
      use case.
      
      Add a generic target 'run-command' to run an arbitrary command in an
      environment with all Kbuild variables set.
      
      The usage is:
      
        $ make run-command KBUILD_RUN_COMMAND=<command>
      
      The concept is similar to:
      
        $ dpkg-architecture -c <command>
      
      This executes <command> in an environment which has all DEB_* variables
      defined.
      
      Convert the existing 'make intdeb-pkg'.
      
      Another possible usage is to interrogate a Make variable.
      
        $ make run-command KBUILD_RUN_COMMAND='echo $(KBUILD_CFLAGS)'
      
      might be useful to see KBUILD_CFLAGS set by the top Makefile.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      76a48b8f
    • Borislav Petkov (AMD)'s avatar
      kbuild: Enable -Wenum-conversion by default · c40e60f0
      Borislav Petkov (AMD) authored
      This diagnostic checks whether there is a type mismatch when
      converting enums (assign an enum of type A to an enum of type B, for
      example) and it caught a legit issue recently. The reason it didn't show
      is because that warning is enabled only with -Wextra with GCC. Clang,
      however, enables it by default.
      
      GCC folks were considering enabling it by default but it was too noisy
      back then:
      
        https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78736
      
      
      
      Now that due to clang all those warnings have been fixed, enable it with
      GCC too.
      
      allmodconfig tests done with: x86, arm{,64}, powerpc{,64}, riscv
      crossbuilds.
      
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      c40e60f0
  14. Jul 23, 2023
  15. Jul 16, 2023
  16. Jul 09, 2023
  17. Jun 27, 2023
    • Masahiro Yamada's avatar
      kbuild: revive "Entering directory" for Make >= 4.4.1 · 5fc10e76
      Masahiro Yamada authored
      
      With commit 9da0763b ("kbuild: Use relative path when building in
      a subdir of the source tree"), compiler messages in out-of-tree builds
      include relative paths, which are relative to the build directory, not
      the directory where make was started.
      
      To help IDEs/editors find the source files, Kbuild lets GNU Make print
      "Entering directory ..." when it changes the working directory. It has
      been working fine for a long time, but David reported it is broken with
      the latest GNU Make.
      
      The behavior was changed by GNU Make commit 8f9e7722ff0f ("[SV 63537]
      Fix setting -w in makefiles"). Previously, setting --no-print-directory
      to MAKEFLAGS only affected child makes, but it is now interpreted in
      the current make as soon as it is set.
      
      [test code]
      
        $ cat /tmp/Makefile
        ifneq ($(SUBMAKE),1)
        MAKEFLAGS += --no-print-directory
        all: ; $(MAKE) SUBMAKE=1
        else
        all: ; :
        endif
      
      [before 8f9e7722ff0f]
      
        $ make -C /tmp
        make: Entering directory '/tmp'
        make SUBMAKE=1
        :
        make: Leaving directory '/tmp'
      
      [after 8f9e7722ff0f]
      
        $ make -C /tmp
        make SUBMAKE=1
        :
      
      Previously, the effect of --no-print-directory was delayed until Kbuild
      started the directory descending, but it is no longer true with GNU Make
      4.4.1.
      
      This commit adds one more recursion to cater to GNU Make >= 4.4.1.
      
      When Kbuild needs to change the working directory, __submake will be
      executed twice.
      
        __submake without --no-print-directory  --> show "Entering directory ..."
        __submake with    --no-print-directory  --> parse the rest of Makefile
      
      We end up with one more recursion than needed for GNU Make < 4.4.1, but
      I do not want to complicate the version check.
      
      Reported-by: default avatarDavid Howells <dhowells@redhat.com>
      Closes: https://lore.kernel.org/all/2427604.1686237298@warthog.procyon.org.uk/
      
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Tested-by: default avatarNicolas Schier <n.schier@avm.de>
      5fc10e76
    • Masahiro Yamada's avatar
      kbuild: set correct abs_srctree and abs_objtree for package builds · 5fa94ceb
      Masahiro Yamada authored
      
      When you run 'make rpm-pkg', the rpmbuild tool builds the kernel in
      rpmbuild/BUILD, but $(abs_srctree) and $(abs_objtree) point to the
      directory path where make was started, not the kernel is actually
      being built. The same applies to 'make snap-pkg'. Fix it.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      5fa94ceb
  18. Jun 26, 2023
  19. Jun 25, 2023
  20. Jun 24, 2023
  21. Jun 22, 2023
    • Masahiro Yamada's avatar
      kbuild: implement CONFIG_TRIM_UNUSED_KSYMS without recursion · 5e9e95cc
      Masahiro Yamada authored
      When CONFIG_TRIM_UNUSED_KSYMS is enabled, Kbuild recursively traverses
      the directory tree to determine which EXPORT_SYMBOL to trim. If an
      EXPORT_SYMBOL turns out to be unused by anyone, Kbuild begins the
      second traverse, where some source files are recompiled with their
      EXPORT_SYMBOL() tuned into a no-op.
      
      Linus stated negative opinions about this slowness in commits:
      
       - 5cf0fd59 ("Kbuild: disable TRIM_UNUSED_KSYMS option")
       - a555bdd0 ("Kbuild: enable TRIM_UNUSED_KSYMS again, with some guarding")
      
      We can do this better now. The final data structures of EXPORT_SYMBOL
      are generated by the modpost stage, so modpost can selectively emit
      KSYMTAB entries that are really used by modules.
      
      Commit f73edc89 ("kbuild: unify two modpost invocations") is another
      ground-work to do this in a one-pass algorithm. With the list of modules,
      modpost sets sym->used if it is used by a module. modpost emits KSYMTAB
      only for symbols with sym->used==true.
      
      BTW, Nicolas explained why the trimming was implemented with recursion:
      
        https://lore.kernel.org/all/2o2rpn97-79nq-p7s2-nq5-8p83391473r@syhkavp.arg/
      
      
      
      Actually, we never achieved that level of optimization where the chain
      reaction of trimming comes into play because:
      
       - CONFIG_LTO_CLANG cannot remove any unused symbols
       - CONFIG_LD_DEAD_CODE_DATA_ELIMINATION is enabled only for vmlinux,
         but not modules
      
      If deeper trimming is required, we need to revisit this, but I guess
      that is unlikely to happen.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      5e9e95cc
  22. Jun 18, 2023
  23. Jun 11, 2023
  24. Jun 04, 2023
  25. May 28, 2023
  26. May 22, 2023
  27. May 21, 2023
  28. May 14, 2023
  29. May 07, 2023
  30. Apr 23, 2023
  31. Apr 17, 2023
Loading