Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed from November 25 through December 2. Thank you for your patience.

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/BEAGLEBK: u-boot env import/export

Part Number: BEAGLEBK

Tool/software: Linux

Hi,

I have read about the env import/export commands from http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide

In the section "Making use pre-existing uEnv on SD card", it describes it is possible for u-boot to import an plain text file (uEnv.txt).

For example,

=> fatload mmc 0 0x81000000 uEnv.txt

=> env import -t 0x81000000 $filesize

Questions:

1. I have the u-boot environment variables stored in the eMMC FAT partition in the file uboot.env. Do the environment variables get saved back to uboot.env? If not, how do I save the imported contents from uEnv.txt to uboot.env so that u-boot can use them afterward?

2. Is it possible to save only one environment variable back to uboot.env? If yes, how can it be done?

3. Is there an example explaining "env export"? I assume it is the opposite of "env import", which reads from a plaint text file. So the "export" should save to a file? Please explain.

Thank you.

  • Hello Matt,

    Matt Tsai52 said:
    1. I have the u-boot environment variables stored in the eMMC FAT partition in the file uboot.env. Do the environment variables get saved back to uboot.env? If not, how do I save the imported contents from uEnv.txt to uboot.env so that u-boot can use them afterward?

    -t is for uEnv.txt, use -c for uboot.env.

    => fatload mmc 1:1 0x81000000 uboot.env
    => env import -c 0x81000000 0x20000

    If you want to convert uEnv.txt to uboot.env, please read this blog.


    Matt Tsai52 said:
    2. Is it possible to save only one environment variable back to uboot.env? If yes, how can it be done?

    Yes, it is possible.

    => setenv mat mat
    => saveenv

    or

    => setenv mat mat
    => env export -c 0x81000000
    => fatwrite  mmc 1:1 0x81000000 uboot.env 0x20000


    Matt Tsai52 said:
    3. Is there an example explaining "env export"? I assume it is the opposite of "env import", which reads from a plaint text file. So the "export" should save to a file? Please explain.

    You can find a given example explaining "env export" command here within <Processor SDK>/board-support/u-boot-<version>/cmd/nvedit.c file. This command exports the environment to a RAM address, you should later write it to a file with fatwrite command.

    Best regards,
    Kemal

  • Hi Kemal,

    Thank you.

    Just few more questions to clarify before I close the thread:

    1. So "import" is mainly for porting environment variables from say uboot.env on eMMC to other storage type such as NAND. It only loads the environment variables to a RAM address and does not save to uboot.env, correct?
    2. I assume we can only choose to use either uboot.env or uEnv.txt. If yes, How do I change it to use uEnv.txt? If not, can you please explain how they work together to be in-sync with the environment variables?

    Thank you very much!
  • Matt Tsai52 said:
    1. So "import" is mainly for porting environment variables from say uboot.env on eMMC to other storage type such as NAND. It only loads the environment variables to a RAM address and does not save to uboot.env, correct?


    export exports your currently loaded U-Boot environment to RAM address and later you can write it to NAND, eMMC or SD card from that RAM address. import imports the environment from RAM address where you had previously loaded an uboot.env or uEnv.txt from NAND, eMMC, SD card or TFTP to that address.


    Matt Tsai52 said:
    2. I assume we can only choose to use either uboot.env or uEnv.txt. If yes, How do I change it to use uEnv.txt? If not, can you please explain how they work together to be in-sync with the environment variables?

    Use -t while importing and exporting uEnv.txt and -c while importing and exporting uboot.env. First the uboot.env is loaded, later the uEnv.txt is read. You can use them both together. Please, read this thread for more details.

  • Hi Kemal,

    Thanks for the quick response, I guess I am still confused about these, please clarify:
    - For 1, uboot.env is also loaded to the environment by u-boot automatically without needing to "import". Is this true?
    - For 2, if I understand you correctly, uEnv.txt can be loaded to the boot partition manually and co-exists with uboot.env. Since it is read later, it will overrides uboot.env. Is this true?

    Thank you for your help!
  • Thank you for your help!