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.

AM3358: Saving U-boot enviroment fails

Part Number: AM3358

Hello, Ti members,

  Now I want to use TFTP and NFS to start the Beaglebone black board, and it can run as normal, but in this process, the u-boot enviroments can not been saved, when run saveenv command, console feedback Saving Enviroment to FAT... Failed(1), can you help how to resolve? many thanks,

  • Saving the U-Boot environment is part of our SDK regression testing, and it requires a writable Flash memory such as MMC/SD, eMMC, NAND, SPI, etc. In case of the BeagleBone black the ENV is kept in the FAT boot partition. Are you booting from eMMC/SD card or booting over network all the way (starting with the ROM bootloader loading SPL over the network)?

    Also are you using our Linux SDK for AM335x? If not can you please download and try the current version from here: https://software-dl.ti.com/processor-sdk-linux/esd/AM335X/latest/index_FDS.html   There is a script included that creates a bootable SD card, which should allow you to have a known-good starting point. The associated U-Boot ENV configuration looks like this:

    $ grep ENV .config
    CONFIG_ENV_VARS_UBOOT_CONFIG=y
    # CONFIG_SYS_CONSOLE_IS_IN_ENV is not set
    # CONFIG_SYS_CONSOLE_ENV_OVERWRITE is not set
    CONFIG_SPL_ENV_SUPPORT=y
    # CONFIG_SPL_SAVEENV is not set
    CONFIG_CMD_ASKENV=y
    CONFIG_CMD_EXPORTENV=y
    CONFIG_CMD_IMPORTENV=y
    CONFIG_CMD_EDITENV=y
    # CONFIG_CMD_GREPENV is not set
    CONFIG_CMD_SAVEENV=y
    CONFIG_CMD_ENV_EXISTS=y
    # CONFIG_CMD_ENV_CALLBACK is not set
    # CONFIG_CMD_ENV_FLAGS is not set
    # CONFIG_ENV_IS_IN_EEPROM is not set
    CONFIG_ENV_IS_IN_FAT=y
    # CONFIG_ENV_IS_IN_EXT4 is not set
    # CONFIG_ENV_IS_IN_FLASH is not set
    # CONFIG_ENV_IS_IN_MMC is not set
    # CONFIG_ENV_IS_IN_NAND is not set
    # CONFIG_ENV_IS_IN_NVRAM is not set
    # CONFIG_ENV_IS_IN_ONENAND is not set
    # CONFIG_ENV_IS_IN_REMOTE is not set
    # CONFIG_ENV_IS_IN_SPI_FLASH is not set
    # CONFIG_ENV_IS_IN_UBI is not set
    CONFIG_ENV_FAT_INTERFACE="mmc"
    CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
    CONFIG_ENV_FAT_FILE="uboot.env"
    # CONFIG_USE_DEFAULT_ENV_FILE is not set
    CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
    CONFIG_SPL_ENV_IS_NOWHERE=y
    # CONFIG_BOOTCOUNT_ENV is not set

    If you want to switch to using something other than eMMC/SD you should be able to update this configuration however keep in mind that some of the configuration (such as Flash offsets, etc.) sits in the board-specific header file at include/configs/am335x_evm.h.

    Regards, Andreas

  • Thanks Andreas Dannenberg,

       yes, I'm booting from eMMC on the Beaglebone black board, not from network or SD card, it can run as normal. Here I would like to share the process of what I operated, like these:

      1. Using SDK script "create-sdcard.sh" to creat a bootable SD card, successed.

      2. Beaglebone black boot from SD card, successed.

      3. Using script "debrick.sh" to flash eMMC, successed.

      4. Unload SD card, boot from eMMC on beaglebone black, successed.

      5. Boot from eMMC, under uboot mode, set uboot environment parameters, appeared error "Saving Enviroment to FAT... Failed(1)".

      6. Try to using boot from SD card to set uboot enviroment parameters, successed.

     In your reply, it means that I need to modify the include/configs/am335x_evm.h file, and then re-compile the uboot code again? many thanks,

  • I looked into this a bit further and it seems like storing the ENV in an eMMC boot partition was supported earlier using the am335x_boneblack_defconfig configuration which has since been removed from U-Boot.

    There was an effort to restore this defconfig into the U-Boot tree, but ultimately the change was not accepted at this time. You can find applicable discussion and patches below (two patches)

    https://lists.denx.de/pipermail/u-boot/2019-September/thread.html#383434

    It seems like on challenge is that activating the storage of ENV in eMMC somehow conflics with NAND, which you are probably not using. Nevertheless instead of restoring this old configuration I would recommend reviewing this thread in detail, and making appropriate configuration changes (via 'make ... menuconfig') in U-Boot to the currently-recommended am335x_evm_defconfig to enable storing of ENV in eMMC (turn on CONFIG_ENV_IS_IN_MMC) and disabling of NAND support (turn off CONFIG_NAND and related configs).

    Below a quick patch I created that updates the am335x_evm_defconfig for storing the ENV in eMMC to apply on top of ti-u-boot-2019.01. I build tested it but did not very functionality.

    diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig
    index c9bcdb7def..ec72e85480 100644
    --- a/configs/am335x_evm_defconfig
    +++ b/configs/am335x_evm_defconfig
    @@ -6,6 +6,7 @@ CONFIG_SPL=y
     CONFIG_DISTRO_DEFAULTS=y
     CONFIG_SPL_LOAD_FIT=y
     CONFIG_OF_BOARD_SETUP=y
    +CONFIG_SYS_EXTRA_OPTIONS="EMMC_BOOT"
     CONFIG_BOOTCOMMAND="if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd"
     CONFIG_LOGLEVEL=3
     CONFIG_SYS_CONSOLE_INFO_QUIET=y
    @@ -16,6 +17,7 @@ CONFIG_SPL_ETH_SUPPORT=y
     # CONFIG_SPL_EXT_SUPPORT is not set
     CONFIG_SPL_MTD_SUPPORT=y
     CONFIG_SPL_MUSB_NEW_SUPPORT=y
    +# CONFIG_SPL_NAND_SUPPORT is not set
     CONFIG_SPL_NET_SUPPORT=y
     CONFIG_SPL_NET_VCI_STRING="AM335x U-Boot SPL"
     CONFIG_SPL_OS_BOOT=y
    @@ -24,7 +26,6 @@ CONFIG_SPL_USB_ETHER=y
     CONFIG_CMD_SPL=y
     CONFIG_CMD_SPL_NAND_OFS=0x00080000
     # CONFIG_CMD_FLASH is not set
    -CONFIG_CMD_NAND=y
     # CONFIG_CMD_SETEXPR is not set
     CONFIG_CMD_MTDPARTS=y
     CONFIG_MTDIDS_DEFAULT="nand0=nand.0"
    @@ -33,11 +34,14 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),1
     CONFIG_OF_CONTROL=y
     CONFIG_DEFAULT_DEVICE_TREE="am335x-evm"
     CONFIG_OF_LIST="am335x-evm am335x-bone am335x-boneblack am335x-evmsk am335x-bonegreen am335x-icev2"
    +# CONFIG_ENV_IS_IN_FAT is not set
    +CONFIG_ENV_IS_IN_MMC=y
     CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
     CONFIG_SPL_ENV_IS_NOWHERE=y
     CONFIG_BOOTCOUNT_LIMIT=y
    +CONFIG_CLK=y
    +CONFIG_CLK_CDCE9XX=y
     CONFIG_DFU_MMC=y
    -CONFIG_DFU_NAND=y
     CONFIG_DFU_RAM=y
     CONFIG_USB_FUNCTION_FASTBOOT=y
     CONFIG_DM_I2C=y
    @@ -45,7 +49,7 @@ CONFIG_MISC=y
     CONFIG_DM_MMC=y
     # CONFIG_MMC_HW_PARTITIONING is not set
     CONFIG_MMC_OMAP_HS=y
    -CONFIG_NAND=y
    +CONFIG_MTD_DEVICE=y
     CONFIG_SPI_FLASH=y
     CONFIG_SPI_FLASH_WINBOND=y
     CONFIG_DM_ETH=y
    @@ -71,5 +75,3 @@ CONFIG_USB_ETHER=y
     CONFIG_DYNAMIC_CRC_TABLE=y
     CONFIG_RSA=y
     CONFIG_LZO=y
    -CONFIG_CLK=y
    -CONFIG_CLK_CDCE9XX=y
    

    Please let me know if this solves your issue.

    Regards, Andreas

  • Hello Andreas Dannenberg,

       Many thanks your reply, these days I plan to use SD to boot the beaglebone board, so your suggest steps I will do test after I finish my proiect. Anyway, I will do a test later, many thanks again,