[ELDK] compiling u-boot/tools/env

Stefano Babic sbabic at denx.de
Sat May 16 08:04:31 CEST 2015


Hi Richard,

On 16/05/2015 00:30, K Richard Pixley wrote:
> I've just upgraded to a more recent version of u-boot for one of my
> targets.  And now I'm thoroughly stumped on how to build fw_printenv.
> 
> The README says to use CROSS_COMPILE, but that doesn't include all the
> other environment variables from sourcing my eldk environment file.

This because it has nothing to do with ELDK. You can build u-boot even
with other toolchains. How you set ELDK, it is not part of U-Boot.
U-Boot needs only to have set the CROSS_COMPILE variable. Of course,
toolchain must already works.

>  It
> also doesn't work.  Attempting to build hides /everything/ so I can't
> even tell what compiler is being used.  It /says/ HOSTCC, which is
> wrong, and it should know better.  And neither setting HOSTCC nor CC on
> the command line produces anything useful, (of course, it's hidden, so I
> can't tell if it's really taking effect anyway).

Why do you do that ? README does not tell to do this.

> 
> Shouldn't this thing just be a simple "$(CC) -o fw_printenv *.c"?

Why do you think so ? When a Makefile and/or a build system is provide,
we expect to have a "make <target>", instead of calling the compiler
from command line.

>  I
> tried that, and tried adding -I options to find the headers, but
> apparently some of the u-boot headers are intended to replace standard
> system library headers.  I suppose that might make sense for standalone
> u-boot, but not for fw_printenv that runs inside a running linux.

You have of course to configure your target:

make <your_target_defconfig>

Example:

make P2020RDB-PC_36BIT_defconfig

Then simply:

$ make env
  HOSTCC  tools/env/fw_env.o
  HOSTCC  tools/env/fw_env_main.o
  HOSTCC  tools/env/crc32.o
  HOSTCC  tools/env/ctype.o
  HOSTCC  tools/env/linux_string.o
  HOSTCC  tools/env/env_attr.o
  HOSTCC  tools/env/env_flags.o
  HOSTCC  tools/env/aes.o
  HOSTLD  tools/env/fw_printenv
  STRIP   tools/env/fw_printenv


> 
> This is the most opaque Makefile I've seen in years, btw.  Kudos.

Well, maybe you have to take a look at how Kbuild works.

> 
> *sigh*
> 
> How do I build fw_printenv for my target, (ie, in a cross
> configuration), using my eldk toolchain?  What's the secret?
> 
> I checked top-of-tree in git and it looks like the same arrangement in
> the code I was handed by a vendor that's marked 2014.07.  So whatever
> the secret is, I'm guessing that it's the same secret as is used for
> top-of-tree.

No secret, call make.

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================


More information about the eldk mailing list