This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM3352: Saveenv in NAND fails

Part Number: AM3352

Tool/software: Linux

Hello, 

We are using AM3352 custom board and need to boot form the NAND.

I am able to write in the NAND and boot the board form NAND, but I need to set boot env every time to take images from TFTP and NFS,  

I want to save boot env in to the NAND, But I am getting "*** Error - No Valid Environment Area found" while boot 

/-------------------------------- Boot Log -----------------------------------------/

# CCCCCCCC
U-Boot SPL 2016.05-00312-g409aa68-dirty (May 06 2017 - 16:25:50)
Trying to boot from NAND
The Expected Linux image was not found. Please check your NAND configuration.
Trying to start u-boot now...


U-Boot 2016.05-00312-g409aa68-dirty (May 06 2017 - 16:25:50 +0530)

CPU : AM335X-GP rev 2.1
Model: TI AM335x EVM
Watchdog enabled
DRAM: 256 MiB
NAND: 256 MiB
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Error - No Valid Environment Area found
*** Warning - bad CRC, using default environment

<ethaddr> not set. Validating first E-fuse MAC
Net: cpsw, usb_ether
Press SPACE to abort autoboot in 2 seconds

CHECK# setenv netboot 'echo Booting from network ...; setenv autoload no; run netloadimage; run netloadfdt; run netargs; bootz ${loadaddr} - ${fdtaddr}';
CHECK# setenv netargs 'setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=10.99.8.101:${rootpath},${nfsopts} rw ip=dhcp';
CHECK# setenv bootfile zImage; setenv fdtfile am335x-prcheck.dtb;
CHECK# setenv serverip 10.99.8.101;
CHECK# setenv rootpath /opt/nfs/AM335x_BIG;

CHECK# saveenv
Saving Environment to NAND...
Erasing redundant NAND...
Attempt to erase non block-aligned data
Erasing NAND...
Attempt to erase non block-aligned data
CHECK#

/----------------------------------------------------------------------------------------------/

Please do the needful.

Regards,

-- Roank

  • The software team have been notified. They will respond here.
  • Thank You for response.

    Regards,

    -- Ronak

  • Hi Ronak,

    For the first error you see:
    *** Error - No Valid Environment Area found

    Executing saveenv prior to any other u-boot command solves this problem.

    The next errors:
    Saving Environment to NAND...
    Erasing redundant NAND...
    Attempt to erase non block-aligned data
    Erasing NAND...
    Attempt to erase non block-aligned data
    indicates that your device doesn't find the NAND or it cannot see anything to add to your environment. Errors are printed from nand_utils.c driver:
    if ((opts->offset & (meminfo->erasesize - 1)) != 0) {
    printf("Attempt to erase non block-aligned data\n");
    return -1;
    }

    Best Regards,
    Yordan
  • Hello Yordan,

    Thank you for responding. :)

    In the second error you are saying that, device doesn't find the NAND or it cannot see anything to add to your environment.

    But while I do the saveenv i can see the starting and ending address of env part below is the logs.

    -------------------------------------------------------------- Logs -------------------------------------------------------------

    CHECK# mtdparts

    device nand0 <nand.0>, # parts = 10

    #: name size offset mask_flags
    0: NAND.SPL 0x00020000 0x00000000 0
    1: NAND.SPL.backup1 0x00020000 0x00020000 0
    2: NAND.SPL.backup2 0x00020000 0x00040000 0
    3: NAND.SPL.backup3 0x00020000 0x00060000 0
    4: NAND.u-boot-spl-os 0x00040000 0x00080000 0
    5: NAND.u-boot 0x00100000 0x000c0000 0
    6: NAND.u-boot-env 0x00020000 0x001c0000 0
    7: NAND.u-boot-env.backup10x00020000 0x001e0000 0
    8: NAND.kernel 0x00800000 0x00200000 0
    9: NAND.file-system 0x0f600000 0x00a00000 0

    active partition: nand0,0 - (NAND.SPL) 0x00020000 @ 0x00000000

    defaults:
    mtdids : nand0=nand.0
    mtdparts: mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.backup2),128k(NAND.S
    PL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND.u-boot-env),128k(NAND.u-boot-env.ba
    ckup1),8m(NAND.kernel),-(NAND.file-system)


    PRCHECK# setenv netboot 'echo Booting from network ...; setenv autoload no; run netloadimage; run
    netloadfdt; run netargs; bootz ${loadaddr} - ${fdtaddr}';
    PRCHECK# saveenv
    Saving Environment to NAND...
    ### CONFIG_ENV_OFFSET =1c0000 & CONFIG_ENV_OFFSET_REDUND =1e0000
    Erasing redundant NAND...
    ### opts->offset = 8ff94eb0 meminfo->erasesize = 1e0000####

    Attempt to erase non block-aligned data
    Erasing NAND...
    ### opts->offset = 8ff94e80 meminfo->erasesize = 1c0000####

    Attempt to erase non block-aligned data
    /----------------------------------------------------------------------------------------------------------------------------------------/

    And I can easily write MLO in NAND.SPL and u-boot.img in NAND.u-boot.

    Regards,

    -- Ronak

  • Hi,Ronak,

          Is your problem solved?How to fix it?Now I encountered the same problem.

  • Hello, 

    Nope that thread is on hold now, so I didn't  try yet.

    sorry for that.

    Regards,

    -- Ronak