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.

SK-AM62B-P1: Root Filesystem Not Utilizing Full eMMC Partition After Flashing

Part Number: SK-AM62B-P1
Other Parts Discussed in Thread: AM62P

Tool/software:

Hello TI Expert,

We cannot directly flash the compressed (.tar.gz) rootfs filesystem. This needs to be converted into a EXT4 filesystem which needs to be flashed.

Please refer to the following reference instructions where i have followed to modify the number passed to seek as per your uncompressed filesystem size.

$ dd if=/dev/null of=rootfs.ext4 bs=1M seek=3900
$ mkfs.ext4 -F rootfs.ext4
$ mkdir mnt_fs
$ sudo mount -t ext4 rootfs.ext4 mnt_fs
$ cd mnt_fs
$ sudo tar xzf ../agl-ivi-image-flutter-am62xx-evm.rootfs-20250227130438.tar.gz 
$ cd ..
$ sudo umount mnt_fs

After successfully converting to ext4, I am flashing it in a particular partition of emmc and it is booting successfully after flashing. But the problem is that the dd command is allocating the same size of rootfs as the size of sparse file that I have allocated. 

The issue is likely due to your root filesystem (/dev/root) not being resized after flashing. When i flash the image, it only occupies the size it was originally created with (around 3.9 GB), even though our eMMC partition is 9 GB.

=> setenv partitions "name=rootfs1,size=2G,uuid=$uuid_gpt_rootfs1;name=rootfs2,size=9G,uuid=$uuid_gpt_rootfs2;name=rootfs3,size=-,uuid=$uuid_gpt_rootfs3"

Here as you can see i have allocated space 9 gb for eMMC 2nd partition from uboot prompt.

How To utilise the full 9 GB? Please find attached log.

am62xx-evm login: root
root@am62xx-evm:~# lsblk -f
NAME         FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
mtdblock0                                                                           
mtdblock1                                                                           
mtdblock2                                                                           
mtdblock3                                                                           
mtdblock4                                                                           
mtdblock5                                                                           
mtdblock6                                                                           
mmcblk0                                                                             
|-mmcblk0p1                                                                         
|-mmcblk0p2  ext4               4cae867c-53fe-4d60-889f-ad044a898c9e       0    97% /
`-mmcblk0p3                                                                         
mmcblk0boot0                                                                        
mmcblk0boot1                                                                        
root@am62xx-evm:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       3.7G  3.6G     0 100% /
devtmpfs        901M     0  901M   0% /dev
tmpfs           966M     0  966M   0% /dev/shm
tmpfs           387M  9.9M  377M   3% /run
tmpfs           966M     0  966M   0% /tmp
tmpfs           966M   36K  966M   1% /var/volatile
tmpfs           194M  4.0K  194M   1% /run/user/1001
tmpfs           194M  4.0K  194M   1% /run/user/0

Best Regards,

Suraj

  • Hello TI Expert,

    Is there any way to utilise the full 9 GB?

    Best Regards

    Suraj

  • Hi Suraj,

    Is there any way to utilise the full 9 GB?

    the way our SDK SD card images manage this is by running a script/service after bootup that resizes the rootfs partition. This has the advantage that you don't need to pre-program unnecessarily large sections of eMMC/SD, as well as being flexible to accommodate different eMMC/SD sizes automatically.

    Can you please review these two posts here (they are right next to each other in the same E2E thread):

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1430607/am625-emmc-flashing-releated-query/5490225#5490225
    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1430607/am625-emmc-flashing-releated-query/5495632#5495632

    Regards, Andreas

  • Hi Andreas,

    As we know that we cannot directly flash the compressed (.tar.gz) rootfs filesystem. This needs to be converted into a EXT4 filesystem which needs to be flashed. Whenever I am converting tar file to ext4 file system, even if I give more than 4GB space in seek using dd command, it is not flashing even after flashing using dfu util. but if I give less than 4 GB i.e. 3900 then it is flashing successfully, why is that so?

    $ dd if=/dev/null of=rootfs.ext4 bs=1M seek=3900
    $ mkfs.ext4 -F rootfs.ext4
    $ mkdir mnt_fs
    $ sudo mount -t ext4 rootfs.ext4 mnt_fs
    $ cd mnt_fs
    $ sudo tar xzf ../agl-ivi-image-flutter-am62xx-evm.rootfs-20250227130438.tar.gz
    $ cd ..
    $ sudo umount mnt_fs

    Please refer to the following reference instructions where we would need to modify the number passed to seek as per our uncompressed filesystem size. Actually my tar.gz image size is approx 1.3 gb, So where am I going wrong in my command, it would be better if you rectify it?

    Regards, Suraj

  • $ dd if=/dev/null of=rootfs.ext4 bs=1M seek=3900

    If you want to create an FS image, you need to use the `count=` parameter to specify the size. `seek=` is used to skip over an certain (initial) part of an image.

    https://manpages.ubuntu.com/manpages/jammy/man1/dd.1.html

    Regards, Andreas

  • Hi Andreas,

    Thanks for quick response, 

    I used the count as per what you said and then flashed it using dfu but it did not flash. I have shared the output log, please check it once.

    suraj@suraj-HP-Laptop-15s-fr2xxx:/opt/ti-processor-sdk-linux-am62xx-evm-09.02.01.09/bin/DFU_flash$ sudo python3 dfu_flash.py -d am62xx-evm -t hsfs -c /opt/ti-processor-sdk-linux-am62xx-evm-09.02.01.09/bin/DFU_flash/bin/am62xx-evm/hsfs/flash-files.cfg
    2025-03-12 12:45:23 INFO: Starting the flashing tool
    2025-03-12 12:45:23 INFO: Validating the requirements before flashing...
    2025-03-12 12:45:23 INFO: Validated the CLI arguments and the paths to the DFU boot binaries
    2025-03-12 12:45:23 INFO: Parsing the flash configuration file {/opt/ti-processor-sdk-linux-am62xx-evm-09.02.01.09/bin/DFU_flash/bin/am62xx-evm/hsfs/flash-files.cfg}...
    2025-03-12 12:45:23 INFO: Found 4 flash images
    <<DFU_FLASH_CONF
    ----------------------- ------------------------------------------------- ---------- -------- ----- ----------
                        Alt Path                                                    Size   Offset Media Attributes
    ----------------------- ------------------------------------------------- ---------- -------- ----- ----------
    tiboot3-am62x-hs-fs-evm /home/suraj/Downloads/tiboot3-am62x-hs-fs-evm.bin     295502      0x0 EMMC  raw,1,-   
                      tispl /home/suraj/Downloads/tispl.bin-am62xx-evm           1182907  0x80000 EMMC  raw,1,-   
          u-boot-am62xx-evm /home/suraj/Downloads/u-boot-am62xx-evm.img           968683 0x280000 EMMC  raw,1,-   
                     rootfs /home/suraj/Downloads/rootfs.ext4                 9437184000      0x0 EMMC  part,0,2  
    ----------------------- ------------------------------------------------- ---------- -------- ----- ----------
    DFU_FLASH_CONF
    2025-03-12 12:45:23 INFO: Found 4 boot images
    <<DFU_BOOT_CONF
    ---------- ------------------------------------------------------------------------------------------------ ------
           Alt Path                                                                                               Size
    ---------- ------------------------------------------------------------------------------------------------ ------
    bootloader /opt/ti-processor-sdk-linux-am62xx-evm-09.02.01.09/bin/DFU_flash/bin/am62xx-evm/hsfs/tiboot3.bin 333163
     tispl.bin /opt/ti-processor-sdk-linux-am62xx-evm-09.02.01.09/bin/DFU_flash/bin/am62xx-evm/hsfs/tispl.bin   960044
    u-boot.img /opt/ti-processor-sdk-linux-am62xx-evm-09.02.01.09/bin/DFU_flash/bin/am62xx-evm/hsfs/u-boot.img  894876
      uEnv.txt /opt/ti-processor-sdk-linux-am62xx-evm-09.02.01.09/bin/DFU_flash/bin/am62xx-evm/hsfs/uEnv.txt       190
    ---------- ------------------------------------------------------------------------------------------------ ------
    DFU_BOOT_CONF
    2025-03-12 12:45:23 INFO: Number of USB DFU devices detected: 1
    2025-03-12 12:45:23 INFO: Starting flashing for 1 identified devices
    2025-03-12 12:45:23 INFO: Spawning 1 parallel processes
    2025-03-12 12:45:24 INFO:             1-1 Sent! /opt/ti-processor-sdk-linux-am62xx-evm-09.02.01.09/bin/DFU_flash/bin/am62xx-evm/hsfs/tiboot3.bin
    2025-03-12 12:45:27 INFO:             1-1 Sent! /opt/ti-processor-sdk-linux-am62xx-evm-09.02.01.09/bin/DFU_flash/bin/am62xx-evm/hsfs/tispl.bin
    2025-03-12 12:45:31 INFO:             1-1 Sent! /opt/ti-processor-sdk-linux-am62xx-evm-09.02.01.09/bin/DFU_flash/bin/am62xx-evm/hsfs/u-boot.img
    2025-03-12 12:45:35 INFO:             1-1 Sent! /opt/ti-processor-sdk-linux-am62xx-evm-09.02.01.09/bin/DFU_flash/bin/am62xx-evm/hsfs/uEnv.txt
    2025-03-12 12:45:37 INFO:             1-1 Sent! /home/suraj/Downloads/tiboot3-am62x-hs-fs-evm.bin
    2025-03-12 12:45:39 INFO:             1-1 Sent! /home/suraj/Downloads/tispl.bin-am62xx-evm
    2025-03-12 12:45:40 INFO:             1-1 Sent! /home/suraj/Downloads/u-boot-am62xx-evm.img
    2025-03-12 12:45:42 ERROR:             1-1 Error! /home/suraj/Downloads/rootfs.ext4
    <<DFU_ERROR_LOGS
    dfu-util 0.11
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2021 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    
    
    DFU_ERROR_LOGS
    2025-03-12 12:45:42 INFO: Flashed 0 out of 1 identified devices successfully...
    ^C2025-03-12 12:50:04 INFO: Exiting!!!
    

    And I have allocated 11GB space in the 2nd partition of emmc and in the ext4 conversion command the count = 9000 has been given. Please find attached log. But if I give less than 4 GB i.e. 3900 then it is flashing successfully.

    suraj@suraj-HP-Laptop-15s-fr2xxx:~/Downloads$ dd if=/dev/zero of=rootfs.ext4 bs=1M count=9000
    3900+0 records in
    3900+0 records out
    4089446400 bytes (4.1 GB, 3.8 GiB) copied, 9.68999 s, 422 MB/s
    suraj@suraj-HP-Laptop-15s-fr2xxx:~/Downloads$ mkfs.ext4 -F rootfs.ext4
    mke2fs 1.46.5 (30-Dec-2021)
    Discarding device blocks: done                            
    Creating filesystem with 998400 4k blocks and 249984 inodes
    Filesystem UUID: 113e2424-9608-4d34-bf3c-4297e8fe7f8f
    Superblock backups stored on blocks: 
    	32768, 98304, 163840, 229376, 294912, 819200, 884736
    
    Allocating group tables: done                            
    Writing inode tables: done                            
    Creating journal (16384 blocks): done
    Writing superblocks and filesystem accounting information: done 
    
    suraj@suraj-HP-Laptop-15s-fr2xxx:~/Downloads$ mkdir mnt_fs
    suraj@suraj-HP-Laptop-15s-fr2xxx:~/Downloads$ sudo mount -t ext4 rootfs.ext4 mnt_fs
    [sudo] password for suraj: 
    suraj@suraj-HP-Laptop-15s-fr2xxx:~/Downloads$ cd mnt_fs/
    suraj@suraj-HP-Laptop-15s-fr2xxx:~/Downloads/mnt_fs$ sudo tar xzf ../agl-ivi-image-flutter-am62xx-evm.rootfs-20250311
    agl-ivi-image-flutter-am62xx-evm.rootfs-20250311073609.tar.gz  agl-ivi-image-flutter-am62xx-evm.rootfs-20250311124316.tar.gz  
    suraj@suraj-HP-Laptop-15s-fr2xxx:~/Downloads/mnt_fs$ sudo tar xzf ../agl-ivi-image-flutter-am62xx-evm.rootfs-20250311124316.tar.gz 
    suraj@suraj-HP-Laptop-15s-fr2xxx:~/Downloads/mnt_fs$ cd ..
    suraj@suraj-HP-Laptop-15s-fr2xxx:~/Downloads$ sudo umount mnt_fs
    

    Regards, Suraj

  • Hi Andreas,

    Is there any way to fix this?

    Regards, Suraj

  • Oh so what fails is your DFU flash process?
    Might be a memory (DDR)-related constraint or bug.

    Do you really need to use 4GB of userdata to be programmed? How much of that data is zeros? It'll be a lot easier/faster if you program a small image over DFU, and then have the filesystem expand itself at runtime as I outlined earlier.

    Regards, Andreas

  • Hi Andreas,

    I added the resize2fs systemd service you mentioned, it is expanding during runtime but if I flash the image in emmc via dfu then the image is not expanding during runtime, and everything else is working properly like if I boot after flashing the sd card then it is expanding the rootfs at runtime.

    So can a script work if I remove the if condition from the script?

    script without the if condition, ensuring that it always proceeds with partition expansion. please find evolved script.

    #!/bin/bash
    # This startup script expands the rootfs partition to the full size of the boot device.
    
    ROOT_PART=$(mount | grep "/ " | awk '{print $1}' | cut -d'/' -f3)
    BOOT_DEV=${ROOT_PART%p*}
    
    # Get the available free space on the device
    FREE_SPACE=$(parted /dev/$BOOT_DEV unit '%' print free | grep 'Free Space' | tail -n1 | awk '{print $3}')
    
    if [[ ${FREE_SPACE%.*} -gt 0 ]]; then
        echo "$FREE_SPACE of /dev/$BOOT_DEV is free. Extending partition #2..."
        
        # Extend partition 2 to utilize the remaining free space
        echo ",+" | sfdisk -N 2 /dev/$BOOT_DEV --no-reread
    
        # Inform the kernel of partition changes
        partprobe
    
        # Resize the filesystem to match the new partition size
        resize2fs /dev/$ROOT_PART
    fi

    Regards, Suraj

  • Hi Suraj,

    one more comment here...

    Oh so what fails is your DFU flash process?
    Might be a memory (DDR)-related constraint or bug.

    Doing a quick look at the source tree it looks like flashing eMMC partition >4GB in size should work, based for example on this (older) Git commit here from 2017...

    commit 15970d871c299c8a4218911ee68edb0495a69cd4
    Author: Patrick Delaunay <patrick.delaunay@foss.st.com>
    Date:   Wed Jul 19 16:39:23 2017 +0200
    
        dfu: remove limitation on partition size
    
        Change long (32 bits on arm) to u64 (same type than offset)
        for size and read offset r_left
    
        So partition and device used for DFU can be greater than 4GB
    
        Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

    This Git commit is part of all of our recent SDK v9.x and SDK v10.x releases.

    One thing you could try on your end if you like is using the latest CI/CD snapshot release for our upcoming AM62P SDK v11.0 (~ e/o March, officially). It uses the latest 2025.xx U-Boot sources, so it's worth to see if U-Boot DFU behavior is any different. I saw earlier you are still using the old v9.x SDK, so trying the latest version is definitely worth a shot.

    https://software-dl.ti.com/cicd-report/linux/index.html?section=platform&platform=am62pxx

    So can a script work if I remove the if condition from the script?

    script without the if condition, ensuring that it always proceeds with partition expansion. please find evolved script.

    If you modify the script you need to carefully examine and understand potential side effects of this, which could include but may not be limited to...

    1. Slower system startup
    2. Less system reliability (what if something goes wrong during those constant re-size attempt, or power is cut just during that time, etc.)

    The good news is you should be able to just execute line by line from that script manually from the shell prompt, to see what it is doing, and to trace and understand why it may not work as you think it should. This should not be too difficult to do. Feel free to share any findings here if you think there's room for general improvement.

    Regards, Andreas