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.

am335x setenv

Other Parts Discussed in Thread: AM3358

Hi

    I am using the am3358.My board has a nand.I find a problem .

    When the SD is in the board, i use the command of setenv and saveenv.But the environment variable is not save the nand.After the system is reset,the environment variable is not in the nand.

    When the SD is out of the board.The command of setenv and saveenv is valid.The environment variable is save the nand.

    I use the command of printenv, 

U-Boot# printenv
autoload=yes
baudrate=115200
bootargs=console=ttyO0,115200n8 noinitrd ip=off mem=256M rootwait=1 rw ubi.mtd=7,2048 rootfstype=ubifs root=ubi0:rootfs init=/linuxrc
bootargs_defaults=setenv bootargs console=${console} ${optargs}
bootcmd=if mmc rescan; then echo SD/MMC found on device ${mmc_dev};if run loadbootenv; then echo Loaded environment from ${bootenv};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;if run mmc_load_uimage; then run mmc_args;bootm ${kloadaddr};fi;fi;run nand_boot;
bootdelay=3
bootenv=uEnv.txt
bootfile=uImage
console=ttyO0,115200n8
ethact=cpsw
ethaddr=20:cd:39:d9:84:38
importbootenv=echo Importing environment from mmc ...; env import -t $loadaddr $filesize
ip_method=none
kloadaddr=0x80007fc0
loadaddr=0x82000000
loadbootenv=fatload mmc ${mmc_dev} ${loadaddr} ${bootenv}
mmc_args=run bootargs_defaults;setenv bootargs ${bootargs} root=${mmc_root} rootfstype=${mmc_root_fs_type} ip=${ip_method}
mmc_boot=run mmc_args; run mmc_load_uimage; bootm ${kloadaddr}
mmc_dev=0
mmc_load_uimage=fatload mmc ${mmc_dev} ${kloadaddr} ${bootfile}
mmc_root=/dev/mmcblk0p2 rw
mmc_root_fs_type=ext3 rootwait
nand_args=run bootargs_defaults;setenv bootargs ${bootargs} root=${nand_root} noinitrd rootfstype=${nand_root_fs_type} ip=${ip_method}
nand_boot=echo Booting from nand ...; run nand_args; nandecc hw 2; nand read.i ${kloadaddr} ${nand_src_addr} ${nand_img_siz}; bootm ${kloadaddr}
nand_img_siz=0x500000
nand_root=ubi0:rootfs rw ubi.mtd=7,2048
nand_root_fs_type=ubifs rootwait=1
nand_src_addr=0x280000
net_args=run bootargs_defaults;setenv bootargs ${bootargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
net_boot=echo Booting from network ...; setenv autoload no; dhcp; tftp ${kloadaddr} ${bootfile}; run net_args; bootm ${kloadaddr}
nfsopts=nolock
nor_args=run bootargs_defaults;setenv bootargs ${bootargs} root={nor_root} rootfstype=${nor_root_fs_type} ip=${ip_method}
nor_boot=echo Booting from NOR ...; run nor_args; cp.b ${0x08080000} ${kloadaddr} ${nor_img_siz}; bootm ${kloadaddr}
nor_img_siz=0x280000
nor_root=/dev/mtdblock3 rw
nor_root_fs_type=jffs2
nor_src_addr=0x08080000
rootpath=/export/rootfs
script_addr=0x81900000
spi_args=run bootargs_defaults;setenv bootargs ${bootargs} root=${spi_root} rootfstype=${spi_root_fs_type} ip=${ip_method}
spi_boot=echo Booting from spi ...; run spi_args; sf probe ${spi_bus_no}:0; sf read ${kloadaddr} ${spi_src_addr} ${spi_img_siz}; bootm ${kloadaddr}
spi_bus_no=0
spi_img_siz=0x380000
spi_root=/dev/mtdblock4 rw
spi_root_fs_type=jffs2
spi_src_addr=0x62000
static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
stderr=serial
stdin=serial
stdout=serial

Environment size: 2799/8188 bytes

Can you help me.

 

  • Hi,

    Please provide more information:

    1. Which version of U-Boot are you using?

    2. Post information about your boot source in both test-cases - are you booting from the SD card in the first case and from NAND in the second case?

    3. Post how you modify the environment variable and the output from the "saveenv" command in both cases.

    Best regards,
    Miroslav

  • Hi

    1、The version of U-Boot is U-Boot 2011.09

    2、(1)booting from SD

          

    U-Boot 2011.09 (Apr 26 2014 - 00:52:20)

    I2C:   ready
    DRAM:  256 MiB
    WARNING: Caches not enabled
    NAND:  HW ECC Hamming Code selected
    128 MiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    *** Warning - bad CRC, using default environment

    Net:   cpsw
    Hit any key to stop autoboot:  0
    U-Boot#
    U-Boot#
    U-Boot#
    U-Boot# printenv
    autoload=yes
    baudrate=115200
    bootargs_defaults=setenv bootargs console=${console} ${optargs}
    bootcmd=if mmc rescan; then echo SD/MMC found on device ${mmc_dev};if run loadbootenv; then echo Loaded environment from ${bootenv};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;if run mmc_load_uimage; then run mmc_args;bootm ${kloadaddr};fi;fi;run nand_boot;
    bootdelay=3
    bootenv=uEnv.txt
    bootfile=uImage
    console=ttyO0,115200n8
    ethact=cpsw
    ethaddr=20:cd:39:d9:84:38
    importbootenv=echo Importing environment from mmc ...; env import -t $loadaddr $filesize
    ip_method=none
    kloadaddr=0x80007fc0
    loadaddr=0x82000000
    loadbootenv=fatload mmc ${mmc_dev} ${loadaddr} ${bootenv}
    mmc_args=run bootargs_defaults;setenv bootargs ${bootargs} root=${mmc_root} rootfstype=${mmc_root_fs_type} ip=${ip_method}
    mmc_boot=run mmc_args; run mmc_load_uimage; bootm ${kloadaddr}
    mmc_dev=0
    mmc_load_uimage=fatload mmc ${mmc_dev} ${kloadaddr} ${bootfile}
    mmc_root=/dev/mmcblk0p2 rw
    mmc_root_fs_type=ext3 rootwait
    nand_args=run bootargs_defaults;setenv bootargs ${bootargs} root=${nand_root} noinitrd rootfstype=${nand_root_fs_type} ip=${ip_method}
    nand_boot=echo Booting from nand ...; run nand_args; nandecc hw 2; nand read.i ${kloadaddr} ${nand_src_addr} ${nand_img_siz}; bootm ${kloadaddr}
    nand_img_siz=0x500000
    nand_root=ubi0:rootfs rw ubi.mtd=7,2048
    nand_root_fs_type=ubifs rootwait=1
    nand_src_addr=0x280000
    net_args=run bootargs_defaults;setenv bootargs ${bootargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
    net_boot=echo Booting from network ...; setenv autoload no; dhcp; tftp ${kloadaddr} ${bootfile}; run net_args; bootm ${kloadaddr}
    nfsopts=nolock
    nor_args=run bootargs_defaults;setenv bootargs ${bootargs} root={nor_root} rootfstype=${nor_root_fs_type} ip=${ip_method}
    nor_boot=echo Booting from NOR ...; run nor_args; cp.b ${0x08080000} ${kloadaddr} ${nor_img_siz}; bootm ${kloadaddr}
    nor_img_siz=0x280000
    nor_root=/dev/mtdblock3 rw
    nor_root_fs_type=jffs2
    nor_src_addr=0x08080000
    rootpath=/export/rootfs
    script_addr=0x81900000
    spi_args=run bootargs_defaults;setenv bootargs ${bootargs} root=${spi_root} rootfstype=${spi_root_fs_type} ip=${ip_method}
    spi_boot=echo Booting from spi ...; run spi_args; sf probe ${spi_bus_no}:0; sf read ${kloadaddr} ${spi_src_addr} ${spi_img_siz}; bootm ${kloadaddr}
    spi_bus_no=0
    spi_img_siz=0x380000
    spi_root=/dev/mtdblock4 rw
    spi_root_fs_type=jffs2
    spi_src_addr=0x62000
    static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
    stderr=serial
    stdin=serial
    stdout=serial

    Environment size: 2663/8188 bytes

      (2) Booting from nand

      

    U-Boot 2011.09 (Apr 26 2014 - 00:52:20)

    I2C:   ready
    DRAM:  256 MiB
    WARNING: Caches not enabled
    NAND:  HW ECC Hamming Code selected
    128 MiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    Net:   cpsw
    Hit any key to stop autoboot:  0
    U-Boot#
    U-Boot#
    U-Boot# print env
    ## Error: "env" not defined
    U-Boot# printenv
    autoload=yes
    baudrate=115200
    bootargs=console=ttyO0,115200n8 noinitrd ip=off mem=256M rootwait=1 rw ubi.mtd=7,2048 rootfstype=ubifs root=ubi0:rootfs init=/linuxrc
    bootargs_defaults=setenv bootargs console=${console} ${optargs}
    bootcmd=if mmc rescan; then echo SD/MMC found on device ${mmc_dev};if run loadbootenv; then echo Loaded environment from ${bootenv};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;if run mmc_load_uimage; then run mmc_args;bootm ${kloadaddr};fi;fi;run nand_boot;
    bootdelay=3
    bootenv=uEnv.txt
    bootfile=uImage
    console=ttyO0,115200n8
    ethact=cpsw
    ethaddr=20:cd:39:d9:84:38
    importbootenv=echo Importing environment from mmc ...; env import -t $loadaddr $filesize
    ip_method=none
    kloadaddr=0x80007fc0
    loadaddr=0x82000000
    loadbootenv=fatload mmc ${mmc_dev} ${loadaddr} ${bootenv}
    mmc_args=run bootargs_defaults;setenv bootargs ${bootargs} root=${mmc_root} rootfstype=${mmc_root_fs_type} ip=${ip_method}
    mmc_boot=run mmc_args; run mmc_load_uimage; bootm ${kloadaddr}
    mmc_dev=0
    mmc_load_uimage=fatload mmc ${mmc_dev} ${kloadaddr} ${bootfile}
    mmc_root=/dev/mmcblk0p2 rw
    mmc_root_fs_type=ext3 rootwait
    nand_args=run bootargs_defaults;setenv bootargs ${bootargs} root=${nand_root} noinitrd rootfstype=${nand_root_fs_type} ip=${ip_method}
    nand_boot=echo Booting from nand ...; run nand_args; nandecc hw 2; nand read.i ${kloadaddr} ${nand_src_addr} ${nand_img_siz}; bootm ${kloadaddr}
    nand_img_siz=0x500000
    nand_root=ubi0:rootfs rw ubi.mtd=7,2048
    nand_root_fs_type=ubifs rootwait=1
    nand_src_addr=0x280000
    net_args=run bootargs_defaults;setenv bootargs ${bootargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
    net_boot=echo Booting from network ...; setenv autoload no; dhcp; tftp ${kloadaddr} ${bootfile}; run net_args; bootm ${kloadaddr}
    nfsopts=nolock
    nor_args=run bootargs_defaults;setenv bootargs ${bootargs} root={nor_root} rootfstype=${nor_root_fs_type} ip=${ip_method}
    nor_boot=echo Booting from NOR ...; run nor_args; cp.b ${0x08080000} ${kloadaddr} ${nor_img_siz}; bootm ${kloadaddr}
    nor_img_siz=0x280000
    nor_root=/dev/mtdblock3 rw
    nor_root_fs_type=jffs2
    nor_src_addr=0x08080000
    rootpath=/export/rootfs
    script_addr=0x81900000
    spi_args=run bootargs_defaults;setenv bootargs ${bootargs} root=${spi_root} rootfstype=${spi_root_fs_type} ip=${ip_method}
    spi_boot=echo Booting from spi ...; run spi_args; sf probe ${spi_bus_no}:0; sf read ${kloadaddr} ${spi_src_addr} ${spi_img_siz}; bootm ${kloadaddr}
    spi_bus_no=0
    spi_img_siz=0x380000
    spi_root=/dev/mtdblock4 rw
    spi_root_fs_type=jffs2
    spi_src_addr=0x62000
    static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
    stderr=serial
    stdin=serial
    stdout=serial

    Environment size: 2799/8188 bytes

    3、

    U-Boot 2011.09 (Apr 26 2014 - 00:52:20)

    I2C:   ready
    DRAM:  256 MiB
    WARNING: Caches not enabled
    NAND:  HW ECC Hamming Code selected
    128 MiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    Net:   cpsw
    Hit any key to stop autoboot:  0
    U-Boot#
    U-Boot#
    U-Boot# print env
    ## Error: "env" not defined
    U-Boot# printenv
    autoload=yes
    baudrate=115200
    bootargs=console=ttyO0,115200n8 noinitrd ip=off mem=256M rootwait=1 rw ubi.mtd=7,2048 rootfstype=ubifs root=ubi0:rootfs init=/linuxrc
    bootargs_defaults=setenv bootargs console=${console} ${optargs}
    bootcmd=if mmc rescan; then echo SD/MMC found on device ${mmc_dev};if run loadbootenv; then echo Loaded environment from ${bootenv};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;if run mmc_load_uimage; then run mmc_args;bootm ${kloadaddr};fi;fi;run nand_boot;
    bootdelay=3
    bootenv=uEnv.txt
    bootfile=uImage
    console=ttyO0,115200n8
    ethact=cpsw
    ethaddr=20:cd:39:d9:84:38
    importbootenv=echo Importing environment from mmc ...; env import -t $loadaddr $filesize
    ip_method=none
    kloadaddr=0x80007fc0
    loadaddr=0x82000000
    loadbootenv=fatload mmc ${mmc_dev} ${loadaddr} ${bootenv}
    mmc_args=run bootargs_defaults;setenv bootargs ${bootargs} root=${mmc_root} rootfstype=${mmc_root_fs_type} ip=${ip_method}
    mmc_boot=run mmc_args; run mmc_load_uimage; bootm ${kloadaddr}
    mmc_dev=0
    mmc_load_uimage=fatload mmc ${mmc_dev} ${kloadaddr} ${bootfile}
    mmc_root=/dev/mmcblk0p2 rw
    mmc_root_fs_type=ext3 rootwait
    nand_args=run bootargs_defaults;setenv bootargs ${bootargs} root=${nand_root} noinitrd rootfstype=${nand_root_fs_type} ip=${ip_method}
    nand_boot=echo Booting from nand ...; run nand_args; nandecc hw 2; nand read.i ${kloadaddr} ${nand_src_addr} ${nand_img_siz}; bootm ${kloadaddr}
    nand_img_siz=0x500000
    nand_root=ubi0:rootfs rw ubi.mtd=7,2048
    nand_root_fs_type=ubifs rootwait=1
    nand_src_addr=0x280000
    net_args=run bootargs_defaults;setenv bootargs ${bootargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
    net_boot=echo Booting from network ...; setenv autoload no; dhcp; tftp ${kloadaddr} ${bootfile}; run net_args; bootm ${kloadaddr}
    nfsopts=nolock
    nor_args=run bootargs_defaults;setenv bootargs ${bootargs} root={nor_root} rootfstype=${nor_root_fs_type} ip=${ip_method}
    nor_boot=echo Booting from NOR ...; run nor_args; cp.b ${0x08080000} ${kloadaddr} ${nor_img_siz}; bootm ${kloadaddr}
    nor_img_siz=0x280000
    nor_root=/dev/mtdblock3 rw
    nor_root_fs_type=jffs2
    nor_src_addr=0x08080000
    rootpath=/export/rootfs
    script_addr=0x81900000
    spi_args=run bootargs_defaults;setenv bootargs ${bootargs} root=${spi_root} rootfstype=${spi_root_fs_type} ip=${ip_method}
    spi_boot=echo Booting from spi ...; run spi_args; sf probe ${spi_bus_no}:0; sf read ${kloadaddr} ${spi_src_addr} ${spi_img_siz}; bootm ${kloadaddr}
    spi_bus_no=0
    spi_img_siz=0x380000
    spi_root=/dev/mtdblock4 rw
    spi_root_fs_type=jffs2
    spi_src_addr=0x62000
    static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
    stderr=serial
    stdin=serial
    stdout=serial

    Environment size: 2799/8188 byte

    3、the comman of setenv:


    setenv bootargs 'console=ttyO0,115200n8 noinitrd ip=off mem=256M rootwait=1 rw ubi.mtd=7,2048 rootfstype=ubifs root=ubi0:rootfs init=/linuxrc'

    saveenv

     

     

  • My first suggestion is to use a newer version of U-Boot. Version 2011.09 was part of PSP 04.06.00.08, which is very old and no longer supported.

    I still didn't get the output of the "saveenv" command when you run it in both cases. Please post it if the problem persists after updating the U-Boot.

    Best regards,
    Miroslav