[U-Boot-Users] reading environment from flash fails

Wolter Kamphuis spam at wkamphuis.student.utwente.nl
Fri Nov 28 18:04:43 CET 2003

Hi all,

I need some help converting a patch for ppcboot-1.1.6 to u-boot.

I've got the following patch for ppcoot-1.1.6:

This patch is for the QSLinux QST23/QS850/QS860T boards. See 
The patch is made by Daris Nevil (SNMC), it works fine but hasn't been 
ported to u-boot yet, it's also very large (+500k).

The past few days I've been busy porting this patch to u-boot, version 
1.0.0. While porting I've run into a problem. Saving the environment to 
flash ('saveenv') works but this environment isn't read when rebooting. 
I can't figure out why.

Our board has 8Mb flash, mapped to ff800000. Here's the layout:
ff800000 to ffee0000: root filesystem
ffee0000 to ff000000: readwrite ext2 filesystem
fff00000 to fff20000: u-boot
fff20000 to ffffffff: linux kernel

We define:
#define CFG_MONITOR_BASE 0xFFF00000
#define CFG_ENV_SECT_SIZE (128*1024)
#define CFG_ENV_SIZE (2*1024)

So the environment is located at fff1f800. I've added some debugging 
into the source, which results in:

file console.c, func console_init_f, line 368
CFG_ENV_ADDR = 'fff1f800'
gd->env_addr = 'fff08174'

Memory location fff1f800 contains nothing, but after a 'saveenv' my 
environment is saved there. Memory location fff08174 contains my default 
environment and is unchanged after a 'saveenv'.

Shouldn't gd->env_addr be equal to CFG_ENV_ADDR? Now my saved 
environment settings aren't read and after a reset all settings are 
restored to the defaults.

The original patch, my unfinished patch and some screendumps are 
available on my website:

Could someone give me a tip pointer where to look for a solution? I have 
a feeling it has something to do with the u-boot.lds file but I don't 
know what.

thanks in advance,
   Wolter Kamphuis, MuLogic B.V.

More information about the U-Boot mailing list