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

Michal Simek
2007-08-08T07:15:35Z

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

@@ -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.

I update U-BOOT in flash.
U-Boot 1.2.0-g96aa0fa0-dirty (Aug 8 2007 - 09:01:50) MPC83XX

I download dts compiler from Joe Loeliger site (http://www.jdl.com/git_repos/)

I found dts file which desribe board (file ../arch/powerpc/boot/dts/mpc834x_mds.dts ). Linux kernel 2.6.22 (kernel.org)

I convert it to dtb format with command
dtc -b 1 -R 4 -S 0x3000 -I dts -O dtb mpc834x_mds.dts > mpc8349emds.dtb

And load it to board

=> tftp 40000 mpc8349emds.dtb
Speed: 1000, full duplex
Using TSEC0 device
TFTP from server 10.0.0.1; our IP address is 10.0.0.5
Filename 'mpc8349emds.dtb'.
Load address: 0x40000
Loading: ###
done
Bytes transferred = 12288 (3000 hex)
=> fdt addr 40000
=> fdt print /
{
model="MPC8349EMDS";
compatible="MPC8349EMDS", "MPC834xMDS", "MPC83xxMDS";
#address-cells=<00000001>;
#size-cells=<00000001>;
cpus {

... lot of code

pic at 700 {
interrupt-controller;
#address-cells=<00000000>;
#interrupt-cells=<00000002>;
reg=<00000700 00000100>;
built-in;
device_type="ipic";
linux,phandle=<00000001>;
};
};
};
=>

Linux is built with setting from arch/powerpc/configs/mpc834x_mds_defconfig without any changes.

And then I tried to run sequence of commands

=> setenv bootargs root=/dev/ram rw console=ttyS0,9600
=> tftp 2000000 uRamdisk4
Speed: 1000, full duplex
Using TSEC0 device
TFTP from server 10.0.0.1; our IP address is 10.0.0.5
Filename 'uRamdisk4'.
Load address: 0x2000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#
done
Bytes transferred = 5327936 (514c40 hex)
=> tftp 1000000 uImage
Speed: 1000, full duplex
Using TSEC0 device
TFTP from server 10.0.0.1; our IP address is 10.0.0.5
Filename 'uImage'.
Load address: 0x1000000
Loading: #################################################################
#################################################################
#################################################################
#######################################
done
Bytes transferred = 1197628 (12463c hex)
=> bootm 1000000 2000000 40000
## Booting image at 01000000 ...
Image Name: Linux-2.6.22
Created: 2007-08-07 10:08:38 UTC
Image Type: PowerPC Linux Kernel Image (gzip compressed)
Data Size: 1197564 Bytes = 1.1 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
## Loading RAMDisk Image at 02000000 ...
Image Name: ramdisk
Created: 2007-07-13 8:36:51 UTC
Image Type: PowerPC Linux RAMDisk Image (uncompressed)
Data Size: 5327872 Bytes = 5.1 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Booting using the fdt at 0x40000
Loading Ramdisk to 0fa90000, end 0ffa4c00 ... OK
fdt_chosen: FDT_ERR_BADMAGIC
ERROR: /chosen node create failed - must RESET the board to recover.
Resetting the board.?

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

Thanks for your responds,
Best regards,

Michal Simek