Skip to content
Snippets Groups Projects
  1. Sep 28, 2022
    • Masahiro Yamada's avatar
      Revert "kbuild: Make scripts/compile.h when sh != bash" · a6c26e38
      Masahiro Yamada authored
      This reverts commit [1] in the pre-git era.
      
      I do not know what problem happened in the script when sh != bash
      because there is no commit message.
      
      Now that this script is much simpler than it used to be, let's revert
      it, and let' see. (If this turns out to be problematic, fix the code
      with proper commit description.)
      
      [1]: https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=11acbbbb8a50f4de7dbe4bc1b5acc440dfe81810
      
      
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      a6c26e38
    • Masahiro Yamada's avatar
      scripts/mkcompile_h: move LC_ALL=C to '$LD -v' · c7b594f5
      Masahiro Yamada authored
      
      Minimize the scope of LC_ALL=C like before commit 87c94bfb ("kbuild:
      override build timestamp & version").
      
      Give LC_ALL=C to '$LD -v' to get the consistent version output, as commit
      bcbcf50f ("kbuild: fix ld-version.sh to not be affected by locale")
      mentioned the LD version is affected by locale.
      
      While I was here, I merged two sed invocations.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      c7b594f5
    • Masahiro Yamada's avatar
      kbuild: build init/built-in.a just once · 2df8220c
      Masahiro Yamada authored
      
      Kbuild builds init/built-in.a twice; first during the ordinary
      directory descending, second from scripts/link-vmlinux.sh.
      
      We do this because UTS_VERSION contains the build version and the
      timestamp. We cannot update it during the normal directory traversal
      since we do not yet know if we need to update vmlinux. UTS_VERSION is
      temporarily calculated, but omitted from the update check. Otherwise,
      vmlinux would be rebuilt every time.
      
      When Kbuild results in running link-vmlinux.sh, it increments the
      version number in the .version file and takes the timestamp at that
      time to really fix UTS_VERSION.
      
      However, updating the same file twice is a footgun. To avoid nasty
      timestamp issues, all build artifacts that depend on init/built-in.a
      are atomically generated in link-vmlinux.sh, where some of them do not
      need rebuilding.
      
      To fix this issue, this commit changes as follows:
      
      [1] Split UTS_VERSION out to include/generated/utsversion.h from
          include/generated/compile.h
      
          include/generated/utsversion.h is generated just before the
          vmlinux link. It is generated under include/generated/ because
          some decompressors (s390, x86) use UTS_VERSION.
      
      [2] Split init_uts_ns and linux_banner out to init/version-timestamp.c
          from init/version.c
      
          init_uts_ns and linux_banner contain UTS_VERSION. During the ordinary
          directory descending, they are compiled with __weak and used to
          determine if vmlinux needs relinking. Just before the vmlinux link,
          they are compiled without __weak to embed the real version and
          timestamp.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      2df8220c
  2. Mar 11, 2022
  3. Jun 17, 2021
  4. May 26, 2021
    • Masahiro Yamada's avatar
      kbuild: clean up ${quiet} checks in shell scripts · c39013ee
      Masahiro Yamada authored
      
      There were efforts to make 'make -s' really silent when it is a
      warning-free build.
      
      The conventional way was to let a shell script check ${quiet}, and if
      it is 'silent_', suppress the stdout by itself.
      
      With the previous commit, the 'cmd' takes care of it now. The 'cmd' is
      also invoked from if_changed, if_changed_dep, and if_changed_rule.
      
      You can omit ${quiet} checks in shell scripts when they are invoked
      from the 'cmd' macro.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      c39013ee
  5. Oct 20, 2020
  6. May 12, 2020
  7. Apr 08, 2020
  8. Mar 02, 2020
    • Masahiro Yamada's avatar
      kbuild: remove the owner check in mkcompile_h · f84fdf8d
      Masahiro Yamada authored
      
      This reverts a very old commit, which dates back to the pre-git era:
      
      |commit 5d1cfb5b12f72145d30ba0f53c9f238144b122b8
      |Author: Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
      |Date:   Sat Jul 27 02:53:19 2002 -0500
      |
      |    kbuild: Fix compiling/installing as different users
      |
      |    "make bzImage && sudo make install" had the problem that during
      |    the "sudo make install" the build system would notice that the information
      |    in include/linux/compile.h is not accurate (it says "compiled by <user>",
      |    but we are root), thus causing compile.h to be updated and leading to
      |    some recompiles.
      |
      |    We now only update "compile.h" if the current user is the owner of
      |    include/linux/autoconf.h, i.e. the user who did the "make *config". So the
      |    above sequence will correctly state "compiled by <user>".
      |
      |diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
      |index 6313db96172..cd956380978 100755
      |--- a/scripts/mkcompile_h
      |+++ b/scripts/mkcompile_h
      |@@ -3,6 +3,17 @@ ARCH=$2
      | SMP=$3
      | CC=$4
      |
      |+# If compile.h exists already and we don't own autoconf.h
      |+# (i.e. we're not the same user who did make *config), don't
      |+# modify compile.h
      |+# So "sudo make install" won't change the "compiled by <user>"
      |+# do "compiled by root"
      |+
      |+if [ -r $TARGET -a ! -O ../include/linux/autoconf.h ]; then
      |+  echo ' (not modified)'
      |+  exit 0
      |+fi
      |+
      | if [ -r ../.version ]; then
      |   VERSION=`cat ../.version`
      | else
      
      The 'make bzImage && sudo make install' problem no longer happens
      because commit 1648e4f8 ("x86, kbuild: make "make install" not
      depend on vmlinux") fixed the root cause.
      
      Commit 19514fc6 ("arm, kbuild: make "make install" not depend on
      vmlinux") fixed the similar issue on ARM, with detailed explanation.
      
      So, the rule is that the installation targets should never trigger
      the builds of any build artifact. By following it, this check is
      unneeded.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      f84fdf8d
  9. Dec 14, 2019
    • Masahiro Yamada's avatar
      mkcompile_h: use printf for LINUX_COMPILE_BY · c8f3dea9
      Masahiro Yamada authored
      Commit 858805b3 ("kbuild: add $(BASH) to run scripts with
      bash-extension") shed light on portability issues. Here is another one.
      
      Since commit f0772604 ("Fix handling of backlash character in
      LINUX_COMPILE_BY name"), we must escape a backslash contained in
      LINUX_COMPILE_BY. This is not working on such distros as Ubuntu.
      
      As the POSIX spec [1] says, if any of the operands contain a backslash
      ( '\' ) character, the results are implementation-defined.
      
      The actual shell of /bin/sh could be bash, dash, etc. depending on
      distros, and the behavior of builtin echo command is different among
      them.
      
      The bash builtin echo, unless -e is given, copies the arguments to
      stdout without expanding escape sequences (BSD-like behavior).
      
      The dash builtin echo, in contrast, adopts System V behavior, which
      does expand escape sequences without any option given.
      
      Even non-builtin /bin/echo behaves differently depending on the system.
      Due to these variations, echo is considered as a non-portable command.
      Using printf is the common solution to avoid the portability issue.
      
      [1] https://pubs.opengroup.org/onlinepubs/009695399/utilities/echo.html
      
      
      
      Fixes: 858805b3 ("kbuild: add $(BASH) to run scripts with bash-extension")
      Reported-by: default avatarXXing Wei <xxing.wei@unisoc.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      c8f3dea9
    • Masahiro Yamada's avatar
      mkcompile_h: git rid of UTS_TRUNCATE from LINUX_COMPILE_{BY,HOST} · e8193650
      Masahiro Yamada authored
      
      UTS_VERSION is set to struct uts_namespace, hence a too long string
      should be truncated so it fits in 64 characters.
      
      On the other hand, LINUX_COMPILE_BY/HOST are not set to uts_namespace.
      They are just used in the banners, which do not have specific length
      limitation.
      
      I dug into the git history, but I could not find the reason why
      these two strings must fit in 64 characters. Remove them.
      
      Now that UTS_VERSION is the only user of UTS_TRUNCATE, I squashed it.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      e8193650
  10. Aug 13, 2019
  11. Jan 28, 2019
  12. Nov 02, 2017
    • 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 license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  13. Oct 09, 2017
  14. Jun 19, 2017
  15. Apr 30, 2014
  16. Apr 09, 2014
  17. Apr 29, 2011
  18. Apr 18, 2011
  19. Feb 02, 2010
  20. Dec 12, 2009
  21. Oct 11, 2009
  22. Dec 03, 2008
  23. May 02, 2007
    • Sam Ravnborg's avatar
      kbuild: override build timestamp & version · 87c94bfb
      Sam Ravnborg authored and Sam Ravnborg's avatar Sam Ravnborg committed
      
      Introduce KBUILD_BUILD_VERSION to make it
      possible to override kernel build version
      during build time.
      
      Introduce KBUILD_BUILD_TIMESTAMP to make it
      possible to override kernel build timestamp
      during build time.
      
      But variables are useful mainly by distros
      that want to pass info from an SCM when
      building the kernel. Timestamp could be last
      checkin date for a file etc.
      
      The idea came from Olaf Hering <olaf@aepfle.de>
      
      Cc: Olaf Hering <olaf@aepfle.de>
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      87c94bfb
  24. Feb 14, 2007
  25. Jul 14, 2005
  26. Apr 16, 2005
    • Linus Torvalds's avatar
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds authored
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4
Loading