1. 11 Nov, 2019 3 commits
    • Masahiro Yamada's avatar
      kbuild: do not read $(KBUILD_EXTMOD)/Module.symvers · 39808e45
      Masahiro Yamada authored
      Since commit 040fcc81 ("kbuild: improved modversioning support for
      external modules"), the external module build reads Module.symvers in
      the directory of the module itself, then dumps symbols back into it.
      It accumulates stale symbols in the file when you build an external
      module incrementally.
      
      The idea behind it was, as the commit log explained, you can copy
      Modules.symvers from one module to another when you need to pass symbol
      information between two modules. However, the manual copy of the file
      sounds questionable to me, and containing stale symbols is a downside.
      
      Some time later, commit 0d96fb20
      
       ("kbuild: Add new Kbuild variable
      KBUILD_EXTRA_SYMBOLS") introduced a saner approach.
      
      So, this commit removes the former one. Going forward, the external
      module build dumps symbols into Module.symvers to be carried via
      KBUILD_EXTRA_SYMBOLS, but never reads it automatically.
      
      With the -I option removed, there is no one to set the external_module
      flag unless KBUILD_EXTRA_SYMBOLS is passed. Now the -i option does it
      instead.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      39808e45
    • Masahiro Yamada's avatar
      modpost: do not parse vmlinux for external module builds · 1747269a
      Masahiro Yamada authored
      
      When building external modules, $(objtree)/Module.symvers is scanned
      for symbol information of vmlinux and in-tree modules.
      
      Additionally, vmlinux is parsed if it exists in $(objtree)/.
      This is totally redundant since all the necessary information is
      contained in $(objtree)/Module.symvers.
      
      Do not parse vmlinux at all for external module builds. This makes
      sense because vmlinux is deleted by 'make clean'.
      
      'make clean' leaves all the build artifacts for building external
      modules. vmlinux is unneeded for that.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      1747269a
    • Masahiro Yamada's avatar
      kbuild: update comments in scripts/Makefile.modpost · fab546e6
      Masahiro Yamada authored
      The comment line "When building external modules ..." explains
      the same thing as "Include the module's Makefile ..." a few lines
      below.
      
      The comment "they may be used when building the .mod.c file" is no
      longer true; .mod.c file is compiled in scripts/Makefile.modfinal
      since commit 9b9a3f20
      
       ("kbuild: split final module linking out
      into Makefile.modfinal"). I still keep the code in case $(obj) or
      $(src) is used in the external module Makefile.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      fab546e6
  2. 10 Sep, 2019 1 commit
  3. 21 Aug, 2019 2 commits
  4. 13 Aug, 2019 2 commits
  5. 09 Aug, 2019 1 commit
  6. 31 Jul, 2019 4 commits
  7. 17 Jul, 2019 2 commits
    • Masahiro Yamada's avatar
      kbuild: create *.mod with full directory path and remove MODVERDIR · b7dca6dd
      Masahiro Yamada authored
      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
      
      I...
      b7dca6dd
    • Masahiro Yamada's avatar
      kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod · ff9b45c5
      Masahiro Yamada authored
      
      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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      ff9b45c5
  8. 11 Apr, 2019 1 commit
    • Wiebe, Wladislav (Nokia - DE/Ulm)'s avatar
      modpost: make KBUILD_MODPOST_WARN also configurable for external modules · 83da1bed
      Wiebe, Wladislav (Nokia - DE/Ulm) authored
      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: default avatarWladislav Wiebe <wladislav.wiebe@nokia.com>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      83da1bed
  9. 13 Mar, 2019 1 commit
  10. 28 Jan, 2019 1 commit
    • Masahiro Yamada's avatar
      kbuild: add real-prereqs shorthand for $(filter-out FORCE,$^) · afa974b7
      Masahiro Yamada authored
      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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      afa974b7
  11. 23 Aug, 2018 1 commit
  12. 06 Jul, 2018 1 commit
  13. 16 Nov, 2017 1 commit
  14. 02 Nov, 2017 1 commit
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard...
      b2441318
  15. 07 Oct, 2017 1 commit
  16. 09 Sep, 2016 1 commit
  17. 06 Oct, 2015 1 commit
  18. 23 Sep, 2013 1 commit
    • Guenter Roeck's avatar
      modpost: Optionally ignore secondary errors seen if a single module build fails · eed380f3
      Guenter Roeck authored
      Commit ea4054a2 (modpost: handle huge numbers of modules) added
      support for building a large number of modules.
      
      Unfortunately, the commit changed the semantics of the makefile: Instead of
      passing only existing object files to modpost, make now passes all expected
      object files. If make was started with option -i, this results in a modpost
      error if a single file failed to build.
      
      Example with the current btrfs build falure on m68k:
      
      fs/btrfs/btrfs.o: No such file or directory
      make[1]: [__modpost] Error 1 (ignored)
      
      This error is followed by lots of errors such as:
      
      m68k-linux-gcc: error: arch/m68k/emu/nfcon.mod.c: No such file or directory
      m68k-linux-gcc: fatal error: no input files
      compilation terminated.
      make[1]: [arch/m68k/emu/nfcon.mod.o] Error 1 (ignored)
      
      This doesn't matter much for normal builds, but it is annoying for builds
      started with "make -i" due to the large number of secondary errors.
      Those errors unnececessari...
      eed380f3
  19. 05 Apr, 2013 1 commit
    • Rusty Russell's avatar
      modpost: handle huge numbers of modules. · ea4054a2
      Rusty Russell authored
      
      strace shows:
      72102 execve("/bin/sh", ["/bin/sh", "-c", "echo '  scripts/mod/modpost -m -a
      -o /cc/wfg/sound-compiletest/Module.symvers      -s'; scripts/
      mod/modpost -m -a -o /cc/wfg/sound-compiletest/Module.symvers      -s vmlinux
      arch/x86/crypto/ablk_helper.o arch/x86/crypto/aes-i586.o arch
      /x86/crypto/aesni-intel.o arch/x86/crypto/crc32-pclmul.o
      ...
      drivers/ata/sata_promise.o "...], [/* 119 vars */] <unfinished ...>
      71827 wait4(-1,  <unfinished ...>
      72102 <... execve resumed> )            = -1 E2BIG (Argument list too long)
      
      So we re-run the shell command which produces the list and feed it into modpost -T -.
      Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      ea4054a2
  20. 24 Jan, 2013 1 commit
  21. 19 Oct, 2012 1 commit
  22. 10 Oct, 2012 1 commit
    • David Howells's avatar
      MODSIGN: Sign modules during the build process · 80d65e58
      David Howells authored
      If CONFIG_MODULE_SIG is set, then this patch will cause all modules files to
      to have signatures added.  The following steps will occur:
      
       (1) The module will be linked to foo.ko.unsigned instead of foo.ko
      
       (2) The module will be stripped using both "strip -x -g" and "eu-strip" to
           ensure minimal size for inclusion in an initramfs.
      
       (3) The signature will be generated on the stripped module.
      
       (4) The signature will be appended to the module, along with some information
           about the signature and a magic string that indicates the presence of the
           signature.
      
      Step (3) requires private and public keys to be available.  By default these
      are expected to be found in files:
      
      	signing_key.priv
      	signing_key.x509
      
      in the base directory of the build.  The first is the private key in PEM form
      and the second is the X.509 certificate in DER form as can be generated from
      openssl:
      
      	openssl req \
      		-new -x509 -outform PEM -out signing_key.x509 \
      		-keyout signing...
      80d65e58
  23. 31 Aug, 2012 1 commit
    • 이건호's avatar
      scripts/Makefile.modpost: error in finding modules from .mod files. · ef591a55
      이건호 authored
      
      This error may happen when the user's id or path includes .ko string.
      For example, user's id is xxx.ko and building test.ko module,
      the test.mod file lists ko name and all object files.
         /home/xxx.ko/kernel_dev/device/drivers/test.ko
         /home/xxx.ko/kernel_dev/device/drivers/test_main.o
      /home/xxx.ko/kernel_dev/device/drivers/test_io.o ...
      Current Makefile.modpost and Makefile.modinst find and list up not
      only test.ko but also other object files.
      because all of object file's path includes .ko string.
      This is a patch to fix it.
      Signed-off-by: default avatarGunho Lee <gunho.lee@lge.com>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
      ef591a55
  24. 25 May, 2011 1 commit
  25. 31 Mar, 2011 1 commit
  26. 03 Aug, 2010 2 commits
    • Uwe Kleine-König's avatar
      4696e295
    • Sam Ravnborg's avatar
      kbuild: allow assignment to {A,C,LD}FLAGS_MODULE on the command line · 6588169d
      Sam Ravnborg authored
      
      It is now possible to assign options to AS, CC and LD
      on the command line - which is only used when building modules.
      
      {A,C,LD}FLAGS_MODULE was all used both in the top-level Makefile
      in the arch makefiles, thus users had no way to specify
      additional options to AS, CC, LD when building modules
      without overriding the original value.
      
      Introduce a new set of variables KBUILD_{A,C,LD}FLAGS_MODULE
      that is used by arch specific files and free up
      {A,C,LD}FLAGS_MODULE so they can be assigned on
      the command line.
      
      All arch Makefiles that used the old variables has been updated.
      
      Note: Previously we had a MODFLAGS variable for both
      AS and CC. But in favour of consistency this was dropped.
      So in some cases arch Makefile has one assignmnet replaced by
      two assignmnets.
      
      Note2: MODFLAGS was not documented and is dropped
      without any notice. I do not expect much/any breakage
      from this.
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Cc: Denys Vlasenko <...
      6588169d
  27. 18 Sep, 2009 1 commit
  28. 29 Oct, 2008 1 commit
  29. 22 Jul, 2008 1 commit
    • Mathieu Desnoyers's avatar
      markers: fix duplicate modpost entry · d35cb360
      Mathieu Desnoyers authored
      When a kernel was rebuilt, the previous Module.markers was not cleared.
      It caused markers with different format strings to appear as duplicates
      when a markers was changed.  This problem is present since
      scripts/mod/modpost.c started to generate Module.markers, commit
      b2e3e658
      
      
      
      It therefore applies to 2.6.25, 2.6.26 and linux-next.
      
      I merely merged the patches from Roland, Wenji and Takashi here.
      
      Credits to
      Roland McGrath <roland@redhat.com>
      Wenji Huang <wenji.huang@oracle.com>
      and
      Takashi Nishiie <t-nishiie@np.css.fujitsu.com>
      
      for providing the individual fixes.
      
      - Changelog :
        - Integrated Takashi's Makefile modification to clear Module.markers upon
          make clean.
      Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Wenji Huang <wenji.huang@oracle.com>
      Cc: Takashi Nishiie <t-nishiie@np.css.fujitsu.com>
      Cc: <stable@kernel.org>		[2.6.25.x, 2.6.26.x]
      Signed-off-by: Andrew Morton <a...
      d35cb360
  30. 31 May, 2008 1 commit
    • Sam Ravnborg's avatar
      kbuild: fix $(src) assignmnet with external modules · 96d97f26
      Sam Ravnborg authored
      When we introduced support for KBUILD_EXTRA_SYMBOLS
      we started to include the externam module's kbuild
      file when doing the final modpost step.
      
      As external modules often do:
      ccflags-y := -I$(src)
      
      We had problems because $(src) was unassinged and
      gcc then used the next parameter for -I resulting in
      strange build failures.
      
      Fix is to assign $(src) and $(obj) when building
      external modules.
      
      This fixes: http://bugzilla.kernel.org/show_bug.cgi?id=10798
      
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Cc: Tvrtko <tvrtko.ursulin@sophos.com>
      Cc: Andrea Arcangeli <andrea@qumranet.com>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      96d97f26
  31. 26 Apr, 2008 1 commit