[U-Boot-Users] [PATCH: u-boot-fdt] Improve error print messages.

Jerry Van Baren
2007-08-08T12:50:42Z

Michal Simek wrote:
> Hi,
>
> I am trying to work with fdt (MPC8349EMDS board) but I have some problems.
>
> I download the latest version from u-boot-fdt.git fdt branch
>
> I made minor changes in setting file.
>
> diff --git a/include/configs/MPC8349EMDS.h b/include/configs/MPC8349EMDS.h
> index 1567fcf..33198d6 100644
> --- a/include/configs/MPC8349EMDS.h
> +++ b/include/configs/MPC8349EMDS.h
> @@ -339,6 +339,7 @@
> #endif
>
> /* pass open firmware flat tree */
> +#define CONFIG_OF_LIBFDT 1
> #define CONFIG_OF_FLAT_TREE 1
> #define CONFIG_OF_BOARD_SETUP 1

Undefine CONFIG_OF_FLAT_TREE - it and CONFIG_OF_LIBFDT are mutually
exclusive. That is The Old Way, CONFIG_OF_LIBFDT is The New Way. The
following is the starting point. CONFIG_OF_BOARD_SETUP is most likely
necessary, CONFIG_OF_HAS_BD_T is either necessary or A Good Thing, and
CONFIG_OF_HAS_UBOOT_ENV is optional.

/* pass open firmware flat tree */
#define CONFIG_OF_LIBFDT 1
#undef CONFIG_OF_FLAT_TREE
#define CONFIG_OF_BOARD_SETUP 1
#define CONFIG_OF_HAS_BD_T 1
#define CONFIG_OF_HAS_UBOOT_ENV 1

>
> @@ -739,7 +740,7 @@
> "bootm ${kernel_addr} ${ramdisk_addr}\0" \
> "net_nfs=tftp 200000 ${bootfile};run nfsargs addip addtty;" \
> "bootm\0" \
> - "load=tftp 100000 /tftpboot/mpc8349emds/u-boot.bin\0" \
> + "load=tftp 100000 mpc8349emds/u-boot.bin\0" \
> "update=protect off fe000000 fe03ffff; " \
> "era fe000000 fe03ffff; cp.b 100000 fe000000 ${filesize}\0" \
> "upd=run load;run update\0" \
> [monstr at simekmichal1 u-boot-fdt.git]$
>
> I got error message in compiling process
>
> ppc_82xx-gcc -g -Os -fPIC -ffixed-r14 -meabi -mrelocatable -D__KERNEL__ -DTEXT_BASE=0xFE000000 -I/tmp/1/u-boot-fdt.git/include -fno-builtin -ffreestanding -nostdinc -isystem /opt/eldk/usr/bin/../lib/gcc/powerpc-linux/4.0.0/include -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_MPC83XX -DCONFIG_E300 -ffixed-r2 -ffixed-r29 -msoft-float -Wall -Wstrict-prototypes -c -o cpu.o cpu.c
> cpu.c: In function 'fdt_set_eth0':
> cpu.c:336: warning: implicit declaration of function 'fdt_get_property'
> cpu.c:337: warning: implicit declaration of function 'fdt_setprop'
> cpu.c: In function 'ft_cpu_setup':
> cpu.c:502: warning: implicit declaration of function 'fdt_find_node_by_path'
> cpu.c:502: error: 'fdt' undeclared (first use in this function)
> cpu.c:502: error: (Each undeclared identifier is reported only once
> cpu.c:502: error: for each function it appears in.)
> make[1]: *** [cpu.o] Error 1
> make[1]: Leaving directory `/tmp/1/u-boot-fdt.git/cpu/mpc83xx'
> make: *** [cpu/mpc83xx/libmpc83xx.a] Error 2
> [monstr at simekmichal1 u-boot-fdt.git]$
>
> I made simple changes. I suppose that function needs pointer to fdt structure.
>
> diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c
> index 1a6cba7..37cbaa8 100644
> --- a/cpu/mpc83xx/cpu.c
> +++ b/cpu/mpc83xx/cpu.c
> @@ -497,6 +497,7 @@ ft_cpu_setup(void *blob, bd_t *bd)
> int nodeoffset;
> int err;
> int j;
> + void *fdt=getenv("fdtaddr");
>
> for (j = 0; j < (sizeof(fixup_props) / sizeof(fixup_props[0])); j++) {
> nodeoffset = fdt_find_node_by_path(fdt, fixup_props[j].node);
>
> Now building process ends with success.

Perhaps successful build, but the wrong fix. The problem is due to your
enabling CONFIG_OF_FLAT_TREE.

[snip]

> And I got an error. Do you know where is the problem?

Yes.

> Thanks for your responds,
> Best regards,
>
> Michal Simek

HTH,
gvb