]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
kbuild: add "cross_tools" target to build tools for the target
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Mon, 3 Mar 2014 02:06:19 +0000 (11:06 +0900)
committerTom Rini <trini@ti.com>
Tue, 4 Mar 2014 17:15:31 +0000 (12:15 -0500)
Programs in tools/ directory are usually built for the host.
But some of them (mkimage, dumpimge, gen_eth_addr, etc.) are
useful on the target OS too.

Actually, prior to Kbuild, U-Boot could build tools for
the target like follows:

  $ make <target_board>_config
  $ export CROSS_COMPILE=<cross_gcc_prefix>
  $ make HOSTCC=${CROSS_COMPILE}gcc HOSTSTRIP=${CROSS_COMPILE}strip tools

In Kbuild, we can no longer replace HOSTCC at the command line.

In order to get back that feature, this commit adds "cross-tools" target.

Usage:

  Build tools for the host
  $ make CROSS_COMPILE=<cross_gcc_prefix> tools

  Build tools for the target
  $ make CROSS_COMPILE=<cross_gcc_prefix> cross_tools

Besides, "make cross_tools" strip tools programs because we
generally expect smaller storages on embedded systems.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reported-by: Heiko Schocher <hs@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Tom Rini <trini@ti.com>
Tested-by: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>
Makefile
tools/Makefile

index e165bea20e25da97743df2f6ee598f6afedebfbf..36de8d41eb7bd5ae1e080f32ac23af4bd92469f1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1155,6 +1155,9 @@ env: scripts_basic
 tools-all: export HOST_TOOLS_ALL=y
 tools-all: env tools ;
 
+cross_tools: export CROSS_BUILD_TOOLS=y
+cross_tools: tools ;
+
 .PHONY : CHANGELOG
 CHANGELOG:
        git log --no-merges U-Boot-1_1_5.. | \
index dcd49f82916379e99e5e6776de865863da037c7e..8fccc650cc490efa49b0632ed193845a4a18cc33 100644 (file)
@@ -191,3 +191,15 @@ $(LOGO_DATA_H):    $(obj)/bmp_logo $(LOGO_BMP)
 
 # Let clean descend into subdirs
 subdir- += env
+
+ifneq ($(CROSS_BUILD_TOOLS),)
+HOSTCC = $(CC)
+
+quiet_cmd_crosstools_strip = STRIP   $^
+      cmd_crosstools_strip = $(STRIP) $^; touch $@
+$(obj)/.strip: $(call objectify,$(filter $(always),$(hostprogs-y)))
+       $(call cmd,crosstools_strip)
+
+always += .strip
+endif
+clean-files += .strip