[U-Boot] [PATCH v9 0/38] Switch over to real Kbuild

Tom Rini trini at ti.com
Wed Feb 19 22:11:31 CET 2014


On Tue, Feb 04, 2014 at 05:24:07PM +0900, Masahiro Yamada wrote:

> We switched to Kbuild style makefiles at v2014.01-rc1 release.
> With that modification, we can write makefiles simpler.
> But it is NOT real Kbuild. We need more progress.
> 
> As the next step, this series imports (+ adjusts) build scripts
> from Linux Kernel under scripts/ directory.
> By applying this series, we can get more advantages:
>   - short log
>   - perfect dependency tracking
>   - preparation to the next step, Kconfig
>   - other things...
> 
>  Kbuild without Kconfig
>  ----------------------
> 
> First of all, to make things clearer, let me explain
> the difference between "Kbuild" and "Kconfig".
> They are, I think, sometimes confusing.
> 
>  Kbuild - build system used for Linux Kernel.
>     Some features of Kbuild are:
> 
>        (a) We can describe makefiles simply.
>           Just add objects to "obj-y" like this:
>           obj-$(CONFIG_FOO) += foo.o
> 
>        (b) We can describe directory descending nicely.
>           Add directories with a slash to "obj-y" like this:
>           obj-$(CONFIG_BAR) += bar/
> 
>        (c) Short log like follows:
>           CC      common/foo.o
>           CC      common/bar.o
>           LD      common/built-in.o
> 
>        (d) Perfect dependency tracking
>           I think this is the biggest advantage.
>           To be honest, the dependency tracing of U-Boot build system
>           was not reliable.
> 
>  Kconfig - A tool to manage CONFIG macros.
>           We can handle the dependency among CONFIG macros.
>           Kconfig allows us to modify CONFIG settings easily
>           by "make config".
>           GUI interface are also available by "make menuconfig"
>           All defined CONFIG macros are stored into ".config" file
> 
> I think most of U-boot developers are already familiar with above.
> (In most cases, they are Linux Kernel developers too.)
> 
> I definitely want to port both of these, but I want to do them separately: Kbuild first.
> (If we do Kbuild and Kconfig at the same time, it might be messed up.)
> 
> So, I want to do "Kbuild without Kconfig" in this series.
> The conventional tool (mkconfig + boards.cfg file)
> is used for board configuration.
> 
>  How to apply ?
>  --------------
> 
> I confirmed this series can apply on commit 0876703cf.
> 
>  How to Build ?
>  --------------
> 
> We can build the same as before.
> Do board configuraton first and then run "make".
> 
>   $ make  omap4_panda_config
>   Configuring for omap4_panda board...
>   $ make  CROSS_COMPILE=arm-linux-gnueabi-
>   GEN     include/autoconf.mk.dep
>   GEN     include/autoconf.mk
>   CC      lib/asm-offsets.s
>   GEN     include/generated/generic-asm-offsets.h
>   CC      arch/arm/cpu/armv7/omap4/asm-offsets.s
>   GEN     include/generated/asm-offsets.h
>   HOSTCC  scripts/basic/fixdep
>    ...
> 
> You will find a difference at a glance: short log.
> If you need detail log message, please add "V=1".
> (You can also use "V=2")
> 
> Please note we can no longer use
>   $ make omap4_panda CROSS_COMPILE=arm-linux-gnueabi-
> to do board configuration and "make" at the same time.
> 
> Instead, we can use Kbuild-ish way for that purpose:
>   $ make omap4_panda_config all CROSS_COMPILE=arm-linux-gnuabi-
> 
> This series keeps the other features:
> 
>   - Support out-of-tree build
>      You can use "O=<dir_name>" like this
>      $ mkdir build_dir
>      $ make omap4_panda_config all O=build_dir CROSS_COMPILE=arm-linux-gnueabi-
> 
>   - Works with parallel make option
>      Add "-j" option for this. Compiling will get faster.
> 
>   - Of cource, SPL, TPL build are supported
>     (nand_spl also works. But "nand_spl" is obsolete and we should switch to "spl".
>      Until when should we continue to maintain nand_spl?)
> 
>   - Breaks no boards (except some boards which are already broken)
>      I built all target boards to prove correctness of this series
>      at least for compile test.
> 
>  My Next Plan
>  ------------
> 
>   - Import Kconfig
>       Use "make config", "make menuconfig", "make defconfig", etc. in U-Boot.
> 
>   - More refactoring
>       Some parts of makefiles are still dirty.
>       I want to refactor more makefiles in follow-up patches.
> 
>   - Use "obj-m" for standalone program?? Loadable module??
>       I have not deceided about this yet.
> 
>  Note
>  ----
> 
>  - I marked dirty parts with "FIX ME".
> 
>    In some board-specific config.mk files.
>      # FIX ME
>      ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
>      ccflags-y := -O2
>      endif
> 
>    In the top Makefile
>      # FIX ME
>      cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
>      c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
> 
>    I will re-write them more nicely after other parts are prepared.
> 
>  Run Test
>  --------
> 
>  - Tested for MPC5121 on an ifm AC14xx board,
>      Beagle (C4) board and Wand (quad) board by Gerhard Sittig
> 
>  - Tested for Zynq ZC706 board by me
> 
> Run test report for your board is welcome!
> 
> Changes for v9:
>   - Refactor "clean" and "clobber" rule
>   - Move the build rules of include/autoconf.mk and include/autoconf.mk.dep
> 
> Changes for v8:
>   - Rebase on commit 0876703c.
>   - Fix a typo in comment in 38/38
> 
> Changes for v7:
>   - Fix a bug in spl build:
>     In v6, build failed if we try to build another SPL board
>     without doing "make clobber".
>     For example,
>       $ make omap3_beagle_config
>       $ make CROSS_COMPILE=<your_gcc_prefix>
>       $ make am335x_evm_config
>       $ make CROSS_COMPILE=<your_gcc_prefix>
>     This failed in v6. We needed either "make clobber" or "make mrproper"
>     before switching to another board.
>     Now, we can two or more boards continuously.
> 
> Changes for v6:
>   - Rebase on the current u-boot/master
>   - Linux Kernel 3.13 was released on Jan. 20, so import build scripts
>     from v3.13 to be breeding edge.
>   - Minor change in post/lib_powerpc/fpu/Makefile
>   - Include cmd_files under nand_spl/board/*/*/Makefile
> 
> Changes for v5:
>   - Fix a bug reported by Gerhard Sittig:
>         "make tools" before running "make" failed at v4.
>   - Revive "env" target so that we can build only under tools/env/.
>   - Add a new patch at the tail:
>       38/38 "tools/env: cross-compile fw_printenv without setting HOSTCC"
>   - Describe "clobber" target shortly by deleteing "*.imx" and "*.map"
>      with wildcard matching.
>   - Rebase on the current u-boot/master
> 
> Changes for v4:
>   - Add a new patch at the tail:
>       37/37 "kbuild: Do not generate .*.su files at the top directory"
>   - Change "checkstack" target to Kbuild style
>   - Move the line where U_BOOT_VERSION is defined
> 
> Changes for v3:
>   - Rebase on the current u-boot/master
>   - Add a new patch at the tail:
>       36/36 "board: sandburst: delete FORCEBUILD"
> 
> Changes for v2:
>   - At version 1, nand_spl boards got broken at 12 and fixed at 14.
>     Fix this problem
>   - At version 1, sandbox got broken at 17 and fixed at 21.
>     Fix this problem
>   - Add a new patch at the tail:
>     35/35 "Kbuild: chech clean source and generate Makefile for out-of-tree build"
>   - Rebase on v2014.01-rc2 tag
> 
> 
> Masahiro Yamada (38):
>   .gitignore: ingore files generated by Kbuild
>   Makefile.host.tmp: add a new script to refactor tools
>   tools: convert makefiles to kbuild style
>   board: samsung: refactor host programs
>   examples: Use scripts/Makefile.build
>   nand-spl: Use scripts/Makefile.build
>   Makfile: move suffix rules to Makefile.build
>   Makefile: move some variable definitions to the top Makefile
>   Makefile: move BFD_ROOT_DIR to tools/gdb/Makefile
>   kbuild: import Kbuild.include from linux v3.13 tag
>   kbuild: Use Kbuild.include
>   Makefile: move more flags to the top Makefile
>   Makefile: refactor include path settings
>   Makefile: move more stuff to top Makefile
>   Makefile: move some flags to spl/Makefile
>   Makefile: move some flags to examples makefiles
>   kbuild: change out-of-tree build
>   kbuild: add dummy obj-y to create built-in.o
>   Makefile: rename scripts/Makefile.build to scripts/Makefile.build.tmp
>   kbuild: import more build scripts from Linux v3.13 tag
>   kbuild: use Linux Kernel build scripts
>   kbuild: delete temporary build scripts
>   kbuild: move some lines to more suitable place
>   kbuild: convert some make rules to Kbuild style
>   kbuild: move include directives of board configuration files
>   kbuild: generate {spl,tpl}-autoconf.mk only when it is necessary
>   Makefile: remove a cleaning target "tidy"
>   kbuild: change the top Makefile to more Kbuild-ish structure
>   examples: move api/ and standalone/ entry to examples/Makefile
>   kbuild: refactor Makefile and spl/Makefile more
>   Makefile: Do not pass MTD_VERSION from the top Makefile
>   Makefile: refactor tools-all targets
>   kbuild: use scripts/Makefile.clean
>   kbuild: support simultaneous board configuration and "make all"
>   kbuild: check clean source and generate Makefile for out-of-tree build
>   board: sandburst: delete FORCEBUILD
>   kbuild: Do not generate .*.su files at the top directory
>   tools/env: cross-compile fw_printenv without setting HOSTCC
> 
>  .gitignore                                         |   30 +-
>  MAKEALL                                            |    8 +-
>  Makefile                                           | 1299 +++++++++++++-------
>  arch/arm/cpu/arm1136/config.mk                     |    2 +-
>  arch/arm/cpu/arm926ejs/config.mk                   |    2 +-
>  arch/arm/cpu/arm926ejs/davinci/config.mk           |    2 +-
>  arch/arm/cpu/armv7/am33xx/config.mk                |    2 +-
>  arch/arm/cpu/armv7/config.mk                       |    2 +-
>  arch/arm/cpu/armv7/omap3/config.mk                 |    2 +-
>  arch/arm/cpu/armv7/omap4/config.mk                 |    2 +-
>  arch/arm/cpu/armv7/omap5/config.mk                 |    2 +-
>  arch/arm/cpu/armv7/socfpga/config.mk               |    2 +-
>  arch/arm/cpu/armv7/tegra114/Makefile               |    3 +-
>  arch/arm/cpu/armv7/tegra30/Makefile                |    3 +-
>  arch/arm/imx-common/Makefile                       |    2 +-
>  arch/blackfin/config.mk                            |   10 +-
>  arch/blackfin/cpu/Makefile                         |   10 +-
>  arch/blackfin/lib/Makefile                         |    5 +-
>  arch/m68k/cpu/mcf5227x/Makefile                    |    2 +-
>  arch/m68k/cpu/mcf523x/Makefile                     |    2 +-
>  arch/m68k/cpu/mcf52x2/Makefile                     |    2 +-
>  arch/m68k/cpu/mcf532x/Makefile                     |    2 +-
>  arch/m68k/cpu/mcf5445x/Makefile                    |    2 +-
>  arch/m68k/cpu/mcf547x_8x/Makefile                  |    2 +-
>  arch/mips/cpu/mips32/config.mk                     |    2 +-
>  arch/mips/cpu/mips64/config.mk                     |    2 +-
>  arch/mips/cpu/xburst/config.mk                     |    2 +-
>  arch/nds32/config.mk                               |    2 +-
>  arch/nds32/cpu/n1213/Makefile                      |    3 +
>  arch/powerpc/cpu/mpc8xx/Makefile                   |    2 +-
>  arch/powerpc/lib/Makefile                          |    4 +-
>  arch/sandbox/cpu/Makefile                          |   11 +-
>  arch/sparc/config.mk                               |    3 +-
>  arch/x86/lib/Makefile                              |    2 +-
>  board/ait/cam_enc_4xx/config.mk                    |    2 +-
>  board/avionic-design/medcom-wide/Makefile          |    2 +-
>  board/avionic-design/plutux/Makefile               |    2 +-
>  board/avionic-design/tec-ng/Makefile               |    2 +-
>  board/avionic-design/tec/Makefile                  |    2 +-
>  board/bct-brettl2/config.mk                        |    7 +-
>  board/bf518f-ezbrd/config.mk                       |    7 +-
>  board/bf526-ezbrd/config.mk                        |    7 +-
>  board/bf527-ad7160-eval/config.mk                  |    7 +-
>  board/bf527-ezkit/config.mk                        |    7 +-
>  board/bf527-sdp/config.mk                          |    7 +-
>  board/bf533-ezkit/config.mk                        |    7 +-
>  board/bf533-stamp/config.mk                        |    7 +-
>  board/bf537-stamp/config.mk                        |    7 +-
>  board/bf538f-ezkit/config.mk                       |    7 +-
>  board/bf548-ezkit/config.mk                        |    7 +-
>  board/bf561-acvilon/config.mk                      |    7 +-
>  board/bf561-ezkit/config.mk                        |    7 +-
>  board/br4/config.mk                                |    7 +-
>  board/cm-bf527/config.mk                           |    7 +-
>  board/cm-bf533/config.mk                           |    7 +-
>  board/cm-bf537e/config.mk                          |    7 +-
>  board/cm-bf537u/config.mk                          |    7 +-
>  board/cm-bf548/config.mk                           |    7 +-
>  board/cm-bf561/config.mk                           |    7 +-
>  board/compal/paz00/Makefile                        |    2 +-
>  board/compulab/trimslice/Makefile                  |    2 +-
>  board/cray/L1/Makefile                             |   10 +-
>  board/freescale/common/Makefile                    |    5 +-
>  board/h2200/Makefile                               |    2 +-
>  board/ip04/config.mk                               |    7 +-
>  board/matrix_vision/mvblm7/Makefile                |    4 +-
>  board/matrix_vision/mvblx/Makefile                 |    2 +-
>  board/matrix_vision/mvsmr/Makefile                 |    2 +-
>  board/nvidia/common/Makefile                       |    2 +-
>  board/pcs440ep/config.mk                           |    2 +-
>  board/pr1/config.mk                                |    7 +-
>  board/samsung/origen/Makefile                      |   23 +-
>  .../origen/tools/{mkv310_image.c => mkorigenspl.c} |    0
>  board/samsung/smdkv310/Makefile                    |   16 +-
>  .../tools/{mkv310_image.c => mksmdkv310spl.c}      |    0
>  board/sandburst/karef/Makefile                     |    6 +-
>  board/sandburst/metrobox/Makefile                  |    6 +-
>  board/spear/common/Makefile                        |    5 +-
>  board/spear/x600/Makefile                          |    5 +-
>  board/st-ericsson/snowball/Makefile                |    2 +-
>  board/st-ericsson/u8500/Makefile                   |    2 +-
>  board/tcm-bf518/config.mk                          |    7 +-
>  board/tcm-bf537/config.mk                          |    7 +-
>  common/Makefile                                    |   11 +-
>  config.mk                                          |  333 +----
>  disk/Makefile                                      |    2 +-
>  doc/DocBook/Makefile                               |   73 +-
>  drivers/bios_emulator/Makefile                     |    5 +-
>  drivers/hwmon/Makefile                             |    2 +-
>  drivers/net/npe/Makefile                           |    4 +-
>  drivers/rtc/Makefile                               |    2 +-
>  drivers/usb/musb-new/Makefile                      |    7 +-
>  dts/Makefile                                       |   20 +-
>  examples/Makefile                                  |    9 +
>  examples/api/Makefile                              |   44 +-
>  examples/standalone/Makefile                       |   74 +-
>  fs/ubifs/Makefile                                  |    2 +-
>  fs/yaffs2/Makefile                                 |    9 +-
>  lib/Makefile                                       |    2 +-
>  lib/lzma/Makefile                                  |    2 +-
>  mkconfig                                           |    2 +-
>  nand_spl/board/amcc/acadia/Makefile                |   45 +-
>  nand_spl/board/amcc/bamboo/Makefile                |   45 +-
>  nand_spl/board/amcc/canyonlands/Makefile           |   45 +-
>  nand_spl/board/amcc/kilauea/Makefile               |   43 +-
>  nand_spl/board/amcc/sequoia/Makefile               |   47 +-
>  nand_spl/board/freescale/mpc8315erdb/Makefile      |   47 +-
>  nand_spl/board/freescale/mpc8536ds/Makefile        |   59 +-
>  nand_spl/board/freescale/mpc8569mds/Makefile       |   59 +-
>  nand_spl/board/freescale/mpc8572ds/Makefile        |   59 +-
>  nand_spl/board/freescale/p1023rds/Makefile         |   60 +-
>  nand_spl/board/freescale/p1_p2_rdb/Makefile        |   59 +-
>  nand_spl/board/sheldon/simpc8313/Makefile          |   48 +-
>  net/Makefile                                       |    2 +-
>  post/lib_powerpc/fpu/Makefile                      |   29 +-
>  rules.mk                                           |   51 -
>  scripts/Kbuild.include                             |  284 +++++
>  scripts/Makefile                                   |    2 +
>  scripts/Makefile.build                             |  520 +++++++-
>  scripts/Makefile.clean                             |  108 ++
>  scripts/Makefile.host                              |  170 +++
>  scripts/Makefile.lib                               |  375 ++++++
>  scripts/basic/.gitignore                           |    1 +
>  scripts/basic/Makefile                             |   15 +
>  scripts/basic/fixdep.c                             |  462 +++++++
>  scripts/mkmakefile                                 |   59 +
>  spl/Makefile                                       |  197 +--
>  tools/.gitignore                                   |    3 +-
>  tools/Makefile                                     |  373 ++----
>  tools/crc32.c                                      |    1 +
>  tools/easylogo/Makefile                            |   12 +-
>  tools/env/.gitignore                               |    2 +
>  tools/env/Makefile                                 |   39 +-
>  tools/env/README                                   |    5 +-
>  tools/env/crc32.c                                  |    1 +
>  tools/env/ctype.c                                  |    1 +
>  tools/env/env_attr.c                               |    1 +
>  tools/env/env_flags.c                              |    1 +
>  tools/env/linux_string.c                           |    1 +
>  tools/env_embedded.c                               |    1 +
>  tools/fdt.c                                        |    1 +
>  tools/fdt_ro.c                                     |    1 +
>  tools/fdt_rw.c                                     |    1 +
>  tools/fdt_strerror.c                               |    1 +
>  tools/fdt_wip.c                                    |    1 +
>  tools/gdb/Makefile                                 |   64 +-
>  tools/image-fit.c                                  |    1 +
>  tools/image-sig.c                                  |    1 +
>  tools/image.c                                      |    1 +
>  tools/kernel-doc/Makefile                          |   21 +-
>  tools/md5.c                                        |    1 +
>  tools/rsa-sign.c                                   |    1 +
>  tools/sha1.c                                       |    1 +
>  153 files changed, 3682 insertions(+), 2058 deletions(-)
>  rename board/samsung/origen/tools/{mkv310_image.c => mkorigenspl.c} (100%)
>  rename board/samsung/smdkv310/tools/{mkv310_image.c => mksmdkv310spl.c} (100%)
>  create mode 100644 examples/Makefile
>  delete mode 100644 rules.mk
>  create mode 100644 scripts/Kbuild.include
>  create mode 100644 scripts/Makefile
>  create mode 100644 scripts/Makefile.clean
>  create mode 100644 scripts/Makefile.host
>  create mode 100644 scripts/Makefile.lib
>  create mode 100644 scripts/basic/.gitignore
>  create mode 100644 scripts/basic/Makefile
>  create mode 100644 scripts/basic/fixdep.c
>  create mode 100644 scripts/mkmakefile
>  create mode 100644 tools/crc32.c
>  create mode 100644 tools/env/.gitignore
>  create mode 100644 tools/env/crc32.c
>  create mode 100644 tools/env/ctype.c
>  create mode 100644 tools/env/env_attr.c
>  create mode 100644 tools/env/env_flags.c
>  create mode 100644 tools/env/linux_string.c
>  create mode 100644 tools/env_embedded.c
>  create mode 100644 tools/fdt.c
>  create mode 100644 tools/fdt_ro.c
>  create mode 100644 tools/fdt_rw.c
>  create mode 100644 tools/fdt_strerror.c
>  create mode 100644 tools/fdt_wip.c
>  create mode 100644 tools/image-fit.c
>  create mode 100644 tools/image-sig.c
>  create mode 100644 tools/image.c
>  create mode 100644 tools/md5.c
>  create mode 100644 tools/rsa-sign.c
>  create mode 100644 tools/sha1.c

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140219/e159b498/attachment.pgp>


More information about the U-Boot mailing list