From: Wolter Kamphuis Date: Fri, 28 Nov 2003 18:04:43 +0100 Subject: [U-Boot-Users] reading environment from flash fails Message-ID: <3FC7802B.7010506@wkamphuis.student.utwente.nl> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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: http://wkamphuis.student.utwente.nl/u-boot/ppcboot-1_1_6_qs.patch This patch is for the QSLinux QST23/QS850/QS860T boards. See http://www.snmc.com/prod_qs850.html 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) #define CFG_ENV_ADDR (CFG_MONITOR_BASE + CFG_ENV_SECT_SIZE - CFG_ENV_SIZE) 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: http://wkamphuis.student.utwente.nl/u-boot/ 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.