[U-Boot] [PATCH 2/2] kbuild: add cross_tools target to build tools for the target

2014-03-03 Thread Masahiro Yamada
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 yamad...@jp.panasonic.com
Reported-by: Heiko Schocher h...@denx.de
Cc: Wolfgang Denk w...@denx.de
Cc: Tom Rini tr...@ti.com
---

 Makefile   |  3 +++
 tools/Makefile | 12 
 2 files changed, 15 insertions(+)

diff --git a/Makefile b/Makefile
index 3647804..ea4a362 100644
--- a/Makefile
+++ b/Makefile
@@ -1145,6 +1145,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.. | \
diff --git a/tools/Makefile b/tools/Makefile
index dcd49f8..8fccc65 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -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
-- 
1.8.3.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] kbuild: add cross_tools target to build tools for the target

2014-03-03 Thread Heiko Schocher

Hello Masahiro,

Am 03.03.2014 03:06, schrieb Masahiro Yamada:

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:

   $ maketarget_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 Yamadayamad...@jp.panasonic.com
Reported-by: Heiko Schocherh...@denx.de
Cc: Wolfgang Denkw...@denx.de
Cc: Tom Rinitr...@ti.com
---

  Makefile   |  3 +++
  tools/Makefile | 12 
  2 files changed, 15 insertions(+)


Tested-by: Heiko Schocher h...@denx.de
(on the IDS8247 and upcoming ids8313 board)

Acked-by: Heiko Schocher h...@denx.de

bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot