[U-Boot] [PATCH v7 38/38] tools/env: cross-compile fw_printenv without setting HOSTCC

Gerhard Sittig gsi at denx.de
Tue Jan 28 14:57:15 CET 2014


On Fri, Jan 24, 2014 at 19:38 +0900, Masahiro Yamada wrote:
> 
> fw_printenv is a program which mostly runs on the target Linux.
> 
> Before switching to Kbuild, we needed to set HOSTCC at the
> command line like this:
>     make HOSTCC=<your CC cross-compiler> env
> 
> Going forward we can cross compile it by specifying CROSS_COMPILE:
>     make CROSS_COMPILE=<your cross-compiler prefix> env
> This looks more natural.

As mentioned in my tested-by response, the tool builds fine for
both cross and native builds.  Have checked the output of the
file(1) command and that the binaries can run on their respective
target platform (got the builtin help text), haven't checked the
correct operation though.

It's a little funny that the build progress says "HOSTCC" while
it does a cross build, but agree that this is mere cosmetics and
results from the development history of the tool's use scenario.

And it's good that you could keep the original 'env' make target
name, this keeps the mainline documentation as is, and keeps
external references stable (external projects need not adjust to
different versions and how to invoke them).


As a side note, I noticed that there are "different schools" of
how to build the software.  You appear to assume that the spec
for CROSS_COMPILE is the exception, and always gets passed in
explicit ways.  While I "live in the world" where a shell gets
setup for cross compilation, and _all_ of the remaining work is
done this way, i.e. native builds are the exceptional case.

But this does not matter, it's just an observation, and depends
on what your main activity is or what you initially get taught.
In any case, with a ${CROSS_COMPILE} spec you get cross built
binaries, with no spec or an empty spec you get native binaries
(this is how I created native binaries from a cross build
environment -- pass 'CROSS_COMPILE=' to the make(1) invocation).


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de


More information about the U-Boot mailing list