1. 25 Jan, 2016 1 commit
    • Tom Rini's avatar
      kbuild: Add clang detection · 29c4d281
      Tom Rini authored
      Adapted from:
      
      >From 5631d9c429857194bd55d7bcd8fa5bdd1a9899a3 Mon Sep 17 00:00:00 2001
      From: Michal Marek <mmarek@suse.com>
      Date: Wed, 19 Aug 2015 17:36:41 +0200
      Subject: [PATCH 1/1] kbuild: Fix clang detection
      
      We cannot detect clang before including the arch Makefile, because that
      can set the default cross compiler. We also cannot detect clang after
      including the arch Makefile, because powerpc wants to know about clang.
      Solve this by using an deferred variable. This costs us a few shell
      invocations, but this is only a constant number.
      Reported-by: default avatarBehan Webster <behanw@converseincode.com>
      Reported-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
      
      in the Linux kernel.
      
      This will allow us to make better decisions about when to run tests
      later on for gcc features.
      Signed-off-by: default avatarTom Rini <trini@konsulko.com>
      29c4d281
  2. 18 Aug, 2015 1 commit
    • Masahiro Yamada's avatar
      kbuild: add a makefile macro useful with per-image config options · 04a5c406
      Masahiro Yamada authored
      Commit e02ee254 ("kconfig: switch to single .config
      configuration") made the configuration itself pretty simple,
      instead, we lost the way to systematically enable/disable config
      options for each image independently.
      
      Our current strategy is, put entries into Makefile.spl for options
      we need separate enabling, or once enable the options globally in
      Kconfig and then undef them in Makefile.uncmd_spl if we do not want
      to compile the features for SPL at all.  Things are getting really
      messy.  Besides, "ifdef CONFIG_SPL_BUILD" are sprinkled everywhere
      in makefiles.
      
      This commit adds a variable to help describe makefile simpler.
      
      $(SPL_) evaluates to "SPL_" during the SPL build, while to an empty
      string during building U-boot proper.
      
      So, you can write
      
        obj-$(CONFIG_$(SPL_)FOO) += foo.o
      
      instead of
      
        ifdef CONFIG_SPL_BUILD
        obj-$(CONFIG_SPL_FOO) += foo.o
        else
        obj-$(CONFIG_FOO) += foo.o
        endif
      
      If CONFIG_SPL_FOO does not exist in Kconfig, it is equivalent to
      
        ifndef CONFIG_SPL_BUILD
        obj-$(CONFIG_SPL_FOO) += foo.o
        endif
      
      This is the pattern we often see in our current makefiles.
      
      To take advantage of this macro, we should prefix SPL_ for the SPL
      version of the option when we need independent control between
      U-boot and SPL.  With this naming scheme, I hope our makefiles will
      be much simplified.
      
      It means we want to rename existing config options as follows
      in the long run:
      
        CONFIG_SPL_SERIAL_SUPPORT     -> CONFIG_SPL_SERIAL
        CONFIG_SPL_I2C_SUPPORT        -> CONFIG_SPL_I2C
        CONFIG_SPL_GPIO_SUPPORT       -> CONFIG_SPL_GPIO
        CONFIG_SPL_SPI_SUPPORT        -> CONFIG_SPL_SPI
        CONFIG_SPL_DISABLE_OF_CONTROL -> CONFIG_SPL_OF_CONTROL
                                            (inverting the logic)
      
      Then drivers/Makefile would be re-worked as follows:
      
        obj-$(CONFIG_$(SPL_)SERIAL)  += serial/
        obj-$(CONFIG_$(SPL_)I2C)     += i2c/
        obj-$(CONFIG_$(SPL_)GPIO)    += gpio/
        obj-$(CONFIG_$(SPL_)SPI)     += spi/
           ...
      
      Eventually, SPL-specialized entries in Makefile.spl would go away.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarTom Rini <trini@konsulko.com>
      Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
      04a5c406
  3. 27 Jul, 2015 1 commit
    • Masahiro Yamada's avatar
      kbuild: sync with Linux 4.1 · 98bd0e0d
      Masahiro Yamada authored
      Update some build scripts to match Linux 4.1.  Commit-based syncing
      was done so as not to break U-Boot specific changes.
      The previous big sync was from Linux 3.18-rc1 by commit 176d0982
      (kbuild: sync misc scripts with Linux 3.18-rc1).
      
      The commits imported from Linux (some with adjustments) are:
      
      [1] commit 9fb5e5372208973984a23ee6f5f025c05d364633
          Author: Robert Richter <rrichter@cavium.com>
          dts, kbuild: Factor out dtbs install rules to Makefile.dtbinst
      
      [2] commit 371fdc77af44f4cb32475fd499e1d912ccc30890
          Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
          kbuild: collect shorthands into scripts/Kbuild.include
      
      [3] commit a29b82326ed4eb5567b03c85b52c6891578d5a03
          Author: Michal Marek <mmarek@suse.cz>
          kbuild: Remove duplicate $(cmd) definition in Makefile.clean
      
      [4] commit 1846dfbde3e8a53f3673dcb1c1b79fd9b3f8d40d
          Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
          kbuild: remove redundant -rR flag of hdr-inst
      
      [5] commit 34948e0bbf98640fc1821751b01d2f0cd17d84d5
          Author: Michal Marek <mmarek@suse.cz>
          kbuild: Drop support for clean-rule
      
      [6] commit a16c5f99a28c9945165c46da27fff8e6f26f8736
          Author: Michal Marek <mmarek@suse.cz>
          kbuild: Fix removal of the debian/ directory
      
      [7] commit d0d38cd9e853db11e0242b3df4c9c3c4a663fbb4
          Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
          kbuild: use mixed-targets when two or more config targets are given
      
      [8] commit dd33c03b18b3f2db791eb6a17c37d2de66e4de18
          Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
          kbuild: fix cc-ifversion macro
      
      [9] commit 665d92e38f65d70796aad2b8e49e42e80815d4a4
          Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
          kbuild: do not add $(call ...) to invoke cc-version or cc-fullversion
      
      [10] commit 6dcb4e5edf39e3b65a75ca76f087b2fdbee8a808
          Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
          kbuild: allow cc-ifversion to have the argument for false condition
      
      [11] commit c0a80c0c27e5e65b180a25e6c4c2f7ef9e386cd3
          Author: Heiko Carstens <heiko.carstens@de.ibm.com>
          ftrace: allow architectures to specify ftrace compile options
      
      [12] commit 0b24becc810dc3be6e3f94103a866f214c282394
          Author: Andrey Ryabinin <a.ryabinin@samsung.com>
          kasan: add kernel address sanitizer infrastructure
      
      [13] commit 4218affdf57f938c04e3a916a9685ee27079f377
          Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
          kbuild: remove warning about "make depend"
      
      [14] commit 77479b38e2f58890eb221a0418357502a5b41cd6
          Author: Nathan Rossi <nathan.rossi@xilinx.com>
          kbuild: Create directory for target DTB
      Signed-off-by: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
      Signed-off-by: default avatarRobert Richter <rrichter@cavium.com>
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarAndrey Ryabinin <a.ryabinin@samsung.com>
      Signed-off-by: default avatarNathan Rossi <nathan.rossi@xilinx.com>
      Signed-off-by: default avatarMichal Simek <michal.simek@xilinx.com>
      Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      98bd0e0d
  4. 07 Nov, 2014 1 commit
  5. 09 Sep, 2014 1 commit
  6. 18 Apr, 2014 1 commit
    • Masahiro Yamada's avatar
      kbuild: sync with Linux Kernel v3.15-rc1 · 598e2d33
      Masahiro Yamada authored
      This commit imports Kbuild-related updates
      from v3.14 to v3.15-rc1.
      
       - commit 3d3d6b8474204b6819688c9800774d52d370a538
          kbuild: LLVMLinux: Adapt warnings for compilation with clang
       - commit 61163efae02040f66a95c8ed17f4407951ba58fa
          kbuild: LLVMLinux: Add Kbuild support for building kernel with Clang
       - commit 79192ca8ebd9a25c583aa46024a250fef1e7766f
          scripts: objdiff: detect object code changes between two commits
       - commit 1c9e70a55b088d97a59241744fe459409d0c3582
          kbuild: create a build directory automatically for out-of-tree build
       - commit a03fcb50e816a69acffb13b5e56db75063aeba8a
          kbuild: remove redundant '.*.cmd' pattern from make distclean
       - commit 13338935f1574a2dcd1c891461b0dcc42f8cff42
          kbuild: move "quote" to Kbuild.include to be consistent
       - commit bfdfaeae500a3b194b73b01e92a8034791a58b7f
          kbuild: specify build_docproc as a phony target
       - commit f4d4ffc03efc864645b990e1d579bbe1b8e358a4
          kbuild: dtbs_install: new make target
       - commit 1e64ff42ea3d8d2fc8aa71f9717b3c1cb6c2f893
          Kbuild, lto: Disable LTO for asm-offsets.c
       - commit ccbef1674a1579842c7dbdf554efca85d2cd245a
          Kbuild, lto: add ld-version and ld-ifversion macros
       - commit ae63b2d7bdd9bd66b88843be0daf8e37d8f0b574
          scripts/tags.sh: Ignore *.mod.c
       - commit e36aaea28972c57a32a3ba5365e61633739719b9
          kbuild: Fix silent builds with make-4
      Signed-off-by: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
      598e2d33
  7. 19 Feb, 2014 6 commits
    • Masahiro Yamada's avatar
      kbuild: Do not generate .*.su files at the top directory · 9a368d0f
      Masahiro Yamada authored
      Without this workaround, you will see a lot of ".*.su" files
      at the top directory after building with a compiler
      which supports "-fstack-usage" option.
      Signed-off-by: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
      9a368d0f
    • Masahiro Yamada's avatar
      kbuild: use Linux Kernel build scripts · 6825a95b
      Masahiro Yamada authored
      Now we are ready to switch over to real Kbuild.
      
      This commit disables temporary scripts:
        scripts/{Makefile.build.tmp, Makefile.host.tmp}
      and enables real Kbuild scripts:
        scripts/{Makefile.build,Makefile.host,Makefile.lib}.
      
      This switch is triggered by the line in scripts/Kbuild.include
        -build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj
        +build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
      
      We need to adjust some build scripts for U-Boot.
      But smaller amount of modification is preferable.
      
      Additionally, we need to fix compiler flags which are
      locally added or removed.
      
      In Kbuild, it is not allowed to change CFLAGS locally.
      Instead, ccflags-y, asflags-y, cppflags-y,
      CFLAGS_$(basetarget).o, CFLAGS_REMOVE_$(basetarget).o
      are prepared for that purpose.
      Signed-off-by: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
      Tested-by: default avatarGerhard Sittig <gsi@denx.de>
      6825a95b
    • Masahiro Yamada's avatar
      Makefile: rename scripts/Makefile.build to scripts/Makefile.build.tmp · ec626f11
      Masahiro Yamada authored
      Some build scripts including scripts/Makefile.build
      will be imported from Linux Kernel in the next commit.
      We need to adjust them for U-Boot in the following commits.
      
      To make it easier for reviewers to track the modification,
      this commit renames scripts/Makefile.build to
      scripts/Makefile.build.tmp beforehand.
      Signed-off-by: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
      ec626f11
    • Masahiro Yamada's avatar
      kbuild: change out-of-tree build · 9e414032
      Masahiro Yamada authored
      This commit changes the working directory
      where the build process occurs.
      
      Before this commit, build process occurred under the source
      tree for both in-tree and out-of-tree build.
      
      That's why we needed to add $(obj) prefix to all generated
      files in makefiles like follows:
        $(obj)u-boot.bin:  $(obj)u-boot
      
      Here, $(obj) is empty for in-tree build, whereas it points
      to the output directory for out-of-tree build.
      
      And our old build system changes the current working directory
      with "make -C <sub-dir>" syntax when descending into the
      sub-directories.
      
      On the other hand, Kbuild uses a different idea
      to handle out-of-tree build and directory descending.
      
      The build process of Kbuild always occurs under the output tree.
      When "O=dir/to/store/output/files" is given, the build system
      changes the current working directory to that directory and
      restarts the make.
      
      Kbuild uses "make -f $(srctree)/scripts/Makefile.build obj=<sub-dir>"
      syntax for descending into sub-directories.
      (We can write it like "make $(obj)=<sub-dir>" with a shorthand.)
      This means the current working directory is always the top
      of the output directory.
      Signed-off-by: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
      Tested-by: default avatarGerhard Sittig <gsi@denx.de>
      9e414032
    • Masahiro Yamada's avatar
      kbuild: Use Kbuild.include · bf4b3de1
      Masahiro Yamada authored
      This commit adjusts some files to use Kbuild.include.
      
       - Use cc-option defined in Kbuild.include
          (Delete cc-option in config.mk)
       - Use cc-version defined in
          (Delete cc-version in config.mk)
       - Move binutils-version and dtc-version to Kbuild.include
           by analogy to cc-version
      
      This commit also adds srctree (same as SRCTREE)
      to use Kbuild scripts.
      Signed-off-by: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
      bf4b3de1
    • Masahiro Yamada's avatar