[U-Boot-Users] U-boot environment not loading from flash
Umar Qureshey
umarq at quartics.com
Tue Feb 14 02:57:18 CET 2006
Wolfgang Denk wrote:
>In message <43ED4459.3060007 at quartics.com> you wrote:
>
>
>>>Sounds as if your system was misconfigured.
>>>
>>>
>...
>
>
>>Yes, indeed. What source file/configuration define do I need to look at
>>to see the cause of this problem??
>>
>>
>
>In the first step: your board configuration file(s), i. e.
>include/config/<board>.h and board/<board>/config.mk
>
>Best regards,
>
>Wolfgang Denk
>
>
>
Hi,
I have made some progress on this issue. I thought that fully
describing the scenario might help in deciphering the solution.
I am working without the ARM JTAG tools. In order to get U-Boot up and
flashed, I had to rely on the ARM bootPROM monitor that comes built-in
in the Integrator/CP board.
So to get U-Boot flashed, I take the U-Boot binary and run the following
command on it:
arm-linux-objcopy --change-address 0x24000000 -I binary -O srec
u-boot.bin my-u-boot.srec
The command above changes the base address fro 0x1000000 (SDRAM) to
0x24000000 (first sector of the flash chip). I send this srec file to
the monitor which flashes
the file to the flash chip. This allows me to flip a switch on the
board and the ARM bootPROM monitor to run the image at location
0x24000000.
The problem I am encountering is that U-Boot does not load the saved
environment variables from flash but rather uses the ones that have been
compiled-in with the code.
I found out this is happening because of the following code in
include/environment.h:
# if (CFG_ENV_ADDR >= CFG_MONITOR_BASE) && \
(CFG_ENV_ADDR+CFG_ENV_SIZE) <= (CFG_MONITOR_BASE + CFG_MONITOR_LEN)
# define ENV_IS_EMBEDDED 1
# endif
So, in common/env_flash.c, I put the following at the beginning:
#undef ENV_IS_EMBEDDED
This changes the environment address to 0x24f80000, which is the correct
address. However, when I print the environment using the "printenv"
command I get:
Integrator-CP # printenv
bo´
cm´
cp´
x2´
80´
0 ´
7f´
0´
00´
0;´
oo´
An "md" command on that address reveals the following memory contents:
Integrator-CP # md 0x24f80000
24f80000: 00b4d8f9 00b46f62 00b46d63 00b47063 ....bo..cm..cp..
24f80010: 00b43278 00b43038 00b42030 00b46637 x2..80..0 ..7f..
24f80020: 00b43020 00b43030 00b43b30 00b46f6f 0..00..0;..oo..
24f80030: 00b46200 00b46474 00b47961 00b46200 .b..td..ay...b..
24f80040: 00b47264 00b43d65 00b43034 00b47473 dr..e=..40..st..
24f80050: 00b43d6e 00b46972 00b47300 00b4756f n=..ri...s..ou..
24f80060: 00b46573 00b46c61 00b46474 00b43d72 se..al..td..r=..
24f80070: 00b46972 00b47600 00b46669 00b4006e ri...v..if..n...
24f80080: 00b4746f 00b47367 00b46f6f 00b4642f ot..gs..oo../d..
24f80090: 00b46d2f 00b46c62 00b4306b 00b42077 /m..bl..k0..w ..
24f800a0: 00b4746f 00b47974 00b46a3d 00b43273 ot..ty..=j..s2..
24f800b0: 00b46474 00b47472 00b47261 00b4616c td..rt..ar..la..
24f800c0: 00b4302e 00b46178 00b43030 00b47830 .0..xa..00..0x..
24f800d0: 00b43030 00b46a28 00b43273 00b46f63 00..(j..s2..co..
24f800e0: 00b46c6f 00b47474 00b4414d 00b47069 ol..tt..MA..ip..
24f800f0: 00b46e6f 00b40000 00b40000 00b40000 on..............
However, I know that this data is not being read correctly because if I
define ENV_IS_EMBEDDED again, recompile, and reload then I get:
Integrator-CP # md 0x24f80000
24f80000: 3eb0d8f9 746f6f62 3d646d63 30207063 ...>bootcmd=cp 0
24f80010: 30343278 30303038 78302030 30636637 x24080000 0x7fc0
24f80020: 31783020 30303030 62203b30 6d746f6f 0x100000; bootm
24f80030: 6f6f6200 6c656474 323d7961 75616200 .bootdelay=2.bau
24f80040: 74617264 38333d65 00303034 69647473 drate=38400.stdi
24f80050: 65733d6e 6c616972 64747300 3d74756f n=serial.stdout=
24f80060: 69726573 73006c61 72656474 65733d72 serial.stderr=se
24f80070: 6c616972 72657600 3d796669 6f62006e rial.verify=n.bo
24f80080: 7261746f 723d7367 3d746f6f 7665642f otargs=root=/dev
24f80090: 64746d2f 636f6c62 7220306b 6f722077 /mtdblock0 rw ro
24f800a0: 7366746f 65707974 66666a3d 6d203273 otfstype=jffs2 m
24f800b0: 61706474 3d737472 666d7261 6873616c tdparts=armflash
24f800c0: 303a302e 30306178 40303030 63327830 .0:0xa00000 at 0x2c
24f800d0: 30303030 66666a28 20293273 736e6f63 0000(jffs2) cons
24f800e0: 3d656c6f 41797474 2030414d 6e3d7069 ole=ttyAMA0 ip=n
24f800f0: 00656e6f 00000000 00000000 00000000 one.............
So the actual data is still stored in flash in perfect condition but
defining ENV_IS_EMBEDDED causes U-Boot to start eating the data when it
reads it.
Any help on why this is happening is appreciated...
Regards,
Umar
More information about the U-Boot
mailing list