[U-Boot] Saving environment question

Charles Krinke charles.krinke at gmail.com
Fri Apr 1 01:04:07 CEST 2011


I have an MPC8323ERDB that I am trying to update from an older version of
u-boot to 2010.12 and am having trouble saving the environment with
"saveenv". I turn on the debug in env_flash.c and can see the failure is at
line 271 near the beginning of the saveenv() routine where we are trying to
mallic(up_data).

    up_data = (end_addr + 1 - ((long)flash_addr + CONFIG_ENV_SIZE));
    debug("2 Data to save 0x%lx  end:%lx new:%lx\n", up_data, end_addr,
flash_addr);
    if (up_data) {
        if ((saved_data = malloc(up_data)) == NULL) {
            printf("Unable to save the rest of sector (%ld)\n",
                up_data);
            goto done;
        }

At the debug statement, up_data = 0x1E000, end_addr = 0xFE07FFFF and
flash_addr = 0xFE060000. The end_addr and flash_addr seem reasonable to me
as the flash in 128Kb sectors in the MPC8323ERDB so the first few sectors
are:

FE000000 - FE01FFFF
FE020000 - FE03FFFF
FE040000 - FE05FFFF
*FE060000 - FE07FFFF*

The malloc itself appears to be failing and this puzzles me.

Would anyone be willing to point out the location of the "naievety hole" I
have fallen into with this little sub-project??
-- 
Charles Krinke


More information about the U-Boot mailing list