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.

PROCESSOR-SDK-AM62X: SDCard(mmc1) Boot and u-boot saveenv command

Part Number: PROCESSOR-SDK-AM62X
Other Parts Discussed in Thread: AM625

Hi Forum,

I am working on AM625x GP board, generated builds images with yocto and flashed on target board using uSDcard. I have few questions here.

First Question:-

After flashing, observed that mmcblk1p1 partition(where uboot files present) is mounted on /run/media/mmcblk1p1 and mmcblk1p2 partition (rootfs) is mounted on / (as a root) and that's looks fine.

But here question is, why mmcblk0p1 partition is mounted as /run/media/mmcblk0p1 with rootfs when we flashed images with SDcard ? Is there anyway to remove mmcblk0 partition or disable emmc in am62xx ?

same observation with am62xx ti-sdk-default images also.

root@am62xx-evm:~# dmesg | grep mount
[ 1.835177] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null)
[ 1.837026] devtmpfs: mounted
[ 3.124766] systemd[1]: Starting Remount Root and Kernel File Systems...
[ 3.148046] EXT4-fs (mmcblk1p2): re-mounted. Opts: (null)
[ 9.110743] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
root@am62xx-evm:~#

root@am62xx-lrd:~# lsblk
NAME                MAJ:MIN  RM   SIZE    RO  TYPE   MOUNTPOINT
mmcblk0           179:0         0      14.8G    0    disk  
`-mmcblk0p1     179:1         0      14.8G    0    part      /run/media/mmcblk0p1
mmcblk0boot0  179:32       0      31.5M    1    disk
mmcblk0boot1  179:64       0      31.5M    1    disk
mmcblk1           179:96       0       7.4G     0    disk
|-mmcblk1p1     179:97       0      62M      0     part      /run/media/mmcblk1p1
`-mmcblk1p2     179:98       0      7.3G     0     part      /
root@am62xx-lrd:~#

Second Question :-

I flashed sdcard with two partitions, one has small VFAT partition with tiboot3.bin, tispl.bin, u-boot.img, uEnv.txt and another one has larger kernelImage, dts file and rootfs partition formatted as ext4.
I stopped booting at u-boot prompt, to create uboot.env file with saveenv command.

The output of saveenv cmd says, Environment saved to MMC(0), but it should saved to FAT partition of sdcard (i.e. MMC(1) ) and uboot.env file is not created.

Can please explain, how saveenv command will work in AM62xx target ? How can I create uboot.env file in sdcard where uEnv.txt file is present ?

Note :- In other boards like am335x and am437x, saveenv command will save Environment into FAT partition and uboot.env file is created where uEnv.txt file is presented. 

Below commands are executed at u-boot prompt :-

Hit any key to stop autoboot: 0
=> mmc list
mmc@fa10000: 0 (eMMC)
mmc@fa00000: 1
mmc@fa20000: 2
=>
=> printenv mmcdev
mmcdev=1
=>
=> fatls mmc 1:1
332038 tiboot3.bin
931720 tispl.bin
881588 u-boot.img
1396 uEnv.txt

4 file(s), 0 dir(s)

=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK
=>
=> fatls mmc 1:1
332038 tiboot3.bin
931720 tispl.bin
881588 u-boot.img
1396 uEnv.txt

4 file(s), 0 dir(s)

=>

Final Question :- 

What is boot commands flow execution sequence in u-boot environment during booting ? How to know which u-boot commands will execute 1st and their commands sequence ?

Thanks for your help, and please let me know if any clarification is needed.

Best regards,

Mallikarjuna

  • Hi,

    1. You could erase that parititon in eMMC using fdisk command:

    fdisk /dev/mmcblk0

    Then select 'd' to delete the partition.

    The following doc seems to explain this well enough: https://docs.oracle.com/cd/E88353_01/html/E72487/fdisk-8.html

    2. For AM62x on 08.06 SDK, we need save U-boot environment by default to eMMC, if you wish to save to SD card try the following patch, but for AM62x:

    diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig
    index a6d3cb6866..2ea212fa17 100644
    --- a/configs/j721e_evm_a72_defconfig
    +++ b/configs/j721e_evm_a72_defconfig
    @@ -80,10 +80,11 @@ CONFIG_OF_LIST="k3-j721e-common-proc-board k3-j721e-tps65917-proc-board k3-j721e
     CONFIG_SPL_MULTI_DTB_FIT=y
     CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
     CONFIG_ENV_OVERWRITE=y
    -CONFIG_ENV_IS_IN_MMC=y
     CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
     CONFIG_SYS_RELOC_GD_ENV_ADDR=y
    -CONFIG_SYS_MMC_ENV_PART=1
    +CONFIG_ENV_IS_NOWHERE=y
    +CONFIG_ENV_IS_IN_FAT=y
    +CONFIG_ENV_FAT_DEVICE_AND_PART="1:1"
     CONFIG_NET_RANDOM_ETHADDR=y
     CONFIG_DM=y
     CONFIG_SPL_DM=y
    diff --git a/configs/j721e_evm_r5_defconfig b/configs/j721e_evm_r5_defconfig
    index 01dadb98bf..f6620698dd 100644
    --- a/configs/j721e_evm_r5_defconfig
    +++ b/configs/j721e_evm_r5_defconfig
    @@ -68,6 +68,7 @@ CONFIG_SPL_MULTI_DTB_FIT=y
     CONFIG_SPL_OF_LIST="k3-j721e-r5-common-proc-board k3-j721e-r5-eaik"
     CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
     CONFIG_ENV_OVERWRITE=y
    +CONFIG_ENV_IS_NOWHERE=y
     CONFIG_SYS_RELOC_GD_ENV_ADDR=y
     CONFIG_DM=y
     CONFIG_SPL_DM=y


    3. Which Processor SDK are you using? From u-boot, you only need to execute:
    => boot
    to boot the device.

    ~ Judith

  • Hi TI_Expert,

    Thank you the reply, with above mentioned patch changes, u-boot environment saved into FAT partition and also uboot.env file created into mmc 1:1(SDCard).

    But Problem is :
    In the uEnv.txt file, I added one command, which will set three variables once uEnv.txt is loaded, but here those variables are set and stored in uboot.env file which is at FAT partition of SDCard(MMC1), not saved in default u-boot environment variables.

    I wish to save my uEnv.txt commands output into default u-boot environment and FAT partition(i.e. uboot.env file), because of my target will boot based on variables which are set by command in uEnv.txt file. Currently, that command output is not saved into default u-boot environment.


    Can i know reason my uEnv.txt command output not saved into default uboot environment when target is booting with SDCard ?? what changes/modifications needs to do for that ?

    For your reference :-

    1) Please find below attached image, the output of fw_printenv command which is use uboot.env file and printenv command output at u-boot prompt.

    2) Please find Attached link for uEnv.txt and am62xx_boot_logs file, in which both fw_printenv and printenv command output at u-boot prompt logs there.

    file:///C:/Users/Ambatima/Desktop/uboot_env_issue/

    Best regards,

    Mallikarjuna

  • Hi Mallikarjuna,

    Can you try adding:

    => run envboot

    to the arge_mmc environment variable?

    Run envboot should load 'uEnv.txt' as shown:

    => run envboot
    switch to partitions #0, OK
    mmc1 is current device
    SD/MMC found on device 1
    Failed to load 'boot.scr'
    Failed to load 'uEnv.txt'
    => 
    


    You could recompile u-boot and update the args_mmc environment variable to include "run envboot".

    ~ Judith

  • Hi Judith,

    envboot command already there in enviroment and it's loading uEnv.txt file.

    In u-boot, 1st bootcmd_linux command is running, it will run following commands in sequence order

       findfdt, envboot, init_mmc(args_all, args_mmc), get_kern_mmc, get_fdt_mmc, get_overlay_mmc, run_kern(it will boot kernel).

     

    Problem is :- 

    Here, I am able to load uEnv.txt file but when saveenv command is executed, it's not saving into default environment at u-boot level but it's creating uboot.env file where uEnv.txt related changes are updated.

    I want to save my uEnv.txt file related changes into both default u-boot environment and into uboot.env file. For that, any specific changes are required ?

     

    Attaching links to download uEnv.txt file and boot_logs(In which, you can see printenv and fw_printenv output)

    /cfs-file/__key/communityserver-discussions-components-files/791/6102.uEnv.txt

    /cfs-file/__key/communityserver-discussions-components-files/791/am62xx_5F00_boot_5F00_logs.txt

  • Hi,

    I am OOO and will respond as soon as I get back.

    ~ Judith

  • Hi,

    What processor SDK are you using?
     08.06?

    Also, are you trying to load u-boot environment from uEnv.txt and also to save u-boot environment to uEnv.txt?

    Is so, you could use the following commands:

    => printenv bootenvfile
    bootenvfile=uEnv.txt
    => printenv mmcdev
    mmcdev=1


    Writing environment to SD card
       => env export -t $loadaddr
       => fatwrite mmc ${mmcdev} ${loadaddr} ${bootenvfile} ${filesize}


    Loading environment from SD card
       => run envboot

    or

       => fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
       => env import -t ${loadaddr} ${filesize}

    ~Judith

  • Hi Judith,

    Yes, we are using 08.06.00.003 SDK.

    we already using commands that you suggested above,

    for loading environment, we are using run envboot command. 

    Here, I am sharing u-boot logs of am62xx SK and am335x-evm boards where both boards are booting from SDcard.

    AM335x u-boot logs

    U-Boot SPL 2020.01-g2781231a33 (Mar 26 2021 - 17:56:23 +0000)
    Trying to boot from MMC1
    U-Boot 2020.01-g2781231a33 (Mar 26 2021 - 17:56:23 +0000)
    CPU : AM335X-GP rev 2.1
    Model: TI AM335x EVM
    DRAM: 1 GiB
    WDT: Started with servicing (60s timeout)
    NAND: 0 MiB
    MMC: OMAP SD/MMC: 0
    Loading Environment from FAT... OK
    Net: eth0: ethernet@4a100000
    Warning: usb_ether MAC addresses don't match:
    Address in ROM is de:ad:be:ef:00:01
    Address in environment is 0c:1c:57:08:28:fb, eth1: usb_ether
    Hit any key to stop autoboot: 0
    switch to partitions #0, OK
    mmc0 is current device
    SD/MMC found on device 0
    1396 bytes read in 4 ms (340.8 KiB/s)
    Loaded env from uEnv.txt
    Importing environment from mmc0 ...
    switch to partitions #0, OK
    mmc0 is current device
    Scanning mmc 0:1...
    switch to partitions #0, OK
    mmc0 is current device
    SD/MMC found on device 0
    ROOTFS_B exist
    Saving Environment to FAT... OK
    5427712 bytes read in 353 ms (14.7 MiB/s)
    95597 bytes read in 13 ms (7 MiB/s)
    ## Flattened Device Tree blob at 88000000
    Booting using the fdt blob at 0x88000000
    Loading Device Tree to 8ffe5000, end 8ffff56c ... OK

    AM62xx u-boot logs

    U-Boot 2021.01-g999 (Aug 25 2023 - 13:35:48 +0000)

    SoC: AM62X SR1.0 GP
    Model: Texas Instruments AM625 SK
    EEPROM not available at 0x50, trying to read at 0x51
    Board: AM62-SKEVM rev E3
    DRAM: 2 GiB
    MMC: mmc@fa10000: 0, mmc@fa00000: 1, mmc@fa20000: 2
    In: serial@2800000
    Out: serial@2800000
    Err: serial@2800000
    Net: eth0: ethernet@8000000port@1
    Hit any key to stop autoboot: 0
    switch to partitions #0, OK
    mmc1 is current device
    SD/MMC found on device 1
    Failed to load 'boot.scr'
    1671 bytes read in 3 ms (543.9 KiB/s)
    Loaded env from uEnv.txt
    Importing environment from mmc1 ...
    Saving Environment to FAT... OK
    19567104 bytes read in 410 ms (45.5 MiB/s)
    59144 bytes read in 5 ms (11.3 MiB/s)
    ## Flattened Device Tree blob at 88000000
    Booting using the fdt blob at 0x88000000
    Loading Device Tree to 000000008feee000, end 000000008fffffff ... OK

    Observations from above u-boot logs :-

    In am335x, Environment is saved to FAT partition and while booting, environment is loading from FAT partition whatever we saved using uEnv.txt.

    where as, In am62xx, Environment is saved to FAT partition but while booting, environment is not loading from FAT partition.

     

    Question:

    So, In am62xx, to load from environment from FAT partition while booting like am335x, What changes or any u-boot configuration changes are required ?

    For reference, please go through above shared  u-boot logs of both am335x and am62xx sk board.

    Thanks and Regards,

    Mallikarjuna Reddy Ambati.