Hi Masahiro-san, >> > How do I cross compile it for my embedded system? Do I just set the >> > HOSTCC environment variable in the Makefile? >> >> No changes in any makefiles are needed, just do >> >> make HOSTCC=arm-none-linuex-gnueabi-gcc env > > It looks weird to me.
You're not alone actually :) In a land far away in time, we used to always cross-compile this tool. But at a certain stage IIRC Mike Frysinger convinced us that this tool should be compiled with the host toolchain instead (honestly, I can't remember why). So we accepted this and documented it a later commit log: commit 02bd475e343582b3c915b94ef4016d5876d4a4f1 Author: Daniel Hobi <daniel.h...@schmid-telecom.ch> Date: Wed Nov 10 14:11:21 2010 +0100 tools/env: cleanup host build flags This patch makes tools/env/Makefile more similar to tools/imls: - define HOSTSRCS and HOSTCPPFLAGS, so that .depend generation works. - include U-Boot headers using -idirafter to prevent picking up u-boot/include/errno.h. - use HOSTCFLAGS_NOPED (fw_env.c does not conform to -pedantic). In order to cross-compile tools/env, override the HOSTCC variable as in this example: make tools env HOSTCC=bfin-uclinux-gcc Signed-off-by: Daniel Hobi <daniel.h...@schmid-telecom.ch> Tested-by: Detlev Zundel <d...@denx.de> Tested-by: Steve Sakoman <steve.sako...@linaro.org> I for myself only "saved" the magic invocation needed and forgot the reasoning... > I think HOSTCC should be always "gcc". Correct. One should only switch this for one specific build target. > In my understanding, tools/env/fw_printenv is not a host program > but a one for the target embedded Linux. Correct. > Is there any reason that we don't fix tools/env/Makefile? > > $(obj)fw_printenv: $(HOSTSRCS) $(HEADERS) > $(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTLDFLAGS) -o $@ $(HOSTSRCS) > $(HOSTSTRIP) $@ > > to > > $(obj)fw_printenv: $(HOSTSRCS) $(HEADERS) > $(CC) $(HOSTCFLAGS_NOPED) $(HOSTLDFLAGS) -o $@ $(HOSTSRCS) > $(STRIP) $@ Personally I think I can now remember that the change was mostly done to get the makefile somehow "more similar" to other makefiles. So considering your massive (and most welcome!) work on the build infrastructure, I think you have become kind of an unspoken authority on these issues ;) So if it helps in your cleanup and nobody objects, I'll ack your changes. Best wishes Detlev -- Our choice isn't between a digital world where the NSA can eavesdrop and one where the NSA is prevented from eavesdropping; it's between a digital world that is vulnerable to allattackers, and one that is secure for all users. -- Bruce Schneier -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot