1 Index: common/environment.c
2 ===================================================================
3 --- common/environment.c (revision 950)
4 +++ common/environment.c (working copy)
6 * Generate embedded environment table
7 * inside U-Boot image, if needed.
9 -#if defined(ENV_IS_EMBEDDED)
10 +#if defined(ENV_IS_EMBEDDED) || (defined(ENV_IS_EMBEDDED_CUSTOM) && defined(USE_HOSTCC))
12 * Only put the environment in it's own section when we are building
13 * U-Boot proper. The host based program "tools/envcrc" does not need
15 ===================================================================
16 --- tools/envcrc.c (revision 950)
17 +++ tools/envcrc.c (working copy)
28 extern unsigned long crc32 (unsigned long, const unsigned char *, unsigned int);
30 -#ifdef ENV_IS_EMBEDDED
31 +#if defined(ENV_IS_EMBEDDED) || defined(ENV_IS_EMBEDDED_CUSTOM)
32 extern unsigned int env_size;
33 extern unsigned char environment;
34 #endif /* ENV_IS_EMBEDDED */
36 int main (int argc, char **argv)
38 -#ifdef ENV_IS_EMBEDDED
39 +#if defined(ENV_IS_EMBEDDED) || defined(ENV_IS_EMBEDDED_CUSTOM)
41 unsigned char *envptr = &environment,
42 *dataptr = envptr + ENV_HEADER_SIZE;
43 @@ -85,10 +86,27 @@ int main (int argc, char **argv)
45 /* Check if verbose mode is activated passing a parameter to the program */
47 - printf ("CRC32 from offset %08X to %08X of environment = %08X\n",
48 - (unsigned int) (dataptr - envptr),
49 - (unsigned int) (dataptr - envptr) + datasize,
51 + if (!strcmp(argv[1], "--binary")) {
52 + int le = (argc > 2 ? !strcmp(argv[2], "le") : 1);
53 + size_t i, start, end, step;
56 + end = ENV_HEADER_SIZE;
59 + start = ENV_HEADER_SIZE - 1;
63 + for (i = start; i != end; i += step)
64 + printf ("%c", (crc & (0xFF << (i * 8))) >> (i * 8));
65 + fwrite (dataptr, 1, datasize, stdout);
67 + printf ("CRC32 from offset %08X to %08X of environment = %08X\n",
68 + (unsigned int) (dataptr - envptr),
69 + (unsigned int) (dataptr - envptr) + datasize,
73 printf ("0x%08X\n", crc);