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:刷写后根文件系统未使用完整的 eMMC 分区

Guru**** 2455450 points
Other Parts Discussed in Thread: AM62P

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1484357/sk-am62b-p1-root-filesystem-not-utilizing-full-emmc-partition-after-flashing

器件型号:SK-AM62B-P1
主题中讨论的其他器件:AM62P

工具与软件:

您好、TI 专家:

我们 不能直接刷写压缩(.tar.gz) rootfs 文件系统。 这需要转换为 EXT4文件系统、该文件系统需要进行刷写。

请参阅以下参考说明、其中我已按照未压缩文件系统的大小修改要搜索的编号。

$ 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

成功转换到 ext4后、我将其刷写到 eMMC 的特定分区中、并在刷写后成功引导。  但问题是 dd 命令分配的 rootfs 大小与我分配的稀疏文件的大小相同。  

此问题可能是由您造成的 /dev/root未调整根文件系统()的大小 刷写后。 当我刷写映像时、它仅占用最初创建的大小(约3.9 GB)、尽管我们的 eMMC 分区为9 GB。

=> setenv 分区"name=rootfs1、size=2G、uuid=$uuuid_gpt_rootfs1;name=rootfs2、size=9G、uid=$uuuid_gpt_fs2;name=uufs3、size=-、uuid=$rootid_gpt_rootfs3"

在这里、您可以看到、我已从 uboot 提示符为 eMMC 第二个分区分配了9 GB 的空间。

如何 使用完整的9 GB 内存? 请查看随附的日志。

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

此致、

Suraj

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、TI 专家:

    是否有任何方法可以 利用全部9 GB 内存?

    此致

    Suraj

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Suraj、您好!

    是否有办法 利用全部9 GB?

    我们的 SDK SD 卡映像管理此操作的方式是在启动后运行调整 rootfs 分区大小的脚本/服务。 这样做的优点是、您无需对不必要的较大段 eMMC/SD 进行预编程、并且可以灵活地自动适应不同的 eMMC/SD 大小。

    您能否在此处查看这两个帖子(它们在同一 E2E 主题中彼此相邻):

    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

    此致、Andreas

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Andreas:

    正如我们所知、我们不能直接刷写压缩的(.tar.gz) rootfs 文件系统。 这需要转换为 EXT4文件系统、该文件系统需要进行刷写。  每当我将 tar 文件转换到 ext4文件系统时,即使我在使用 dd 命令搜索中提供了超过4GB 的空间,它也不会在使用 dfu util 刷写后刷写。  但如果我提供不到4 GB 即3900、那么它会成功闪烁、为什么会这样?

    $ dd if=rootfs.ext4 /dev/null 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_fs

    请参阅以下参考说明、其中我们需要根据未压缩的文件系统大小修改为了搜索而传递的编号。 实际上我的 tar.gz 映像大小约为1.3 GB、所以我在命令中出错了、如果你纠正它会更好吗

    此致、Suraj

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [报价 userid="600470" url="~/support/processors-group/processors/f/processors-forum/1484357/sk-am62b-p1-root-filesystem-not-utilizing-full-emmc-partition-after-flashing/5706380 #5706380"]$ dd if=rootfs.ext4 /dev/null bs=1M seek=3900

    如果要创建 FS 映像、需要使用`count=`参数来指定大小。 `seek=`用于跳过图像的某个(初始)部分。

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

    此致、Andreas

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Andreas:

    感谢您的快速响应、  

    我根据您所说的内容使用此计数、然后使用 DFU 刷写、但没有刷写。  我已共享输出日志、请进行一次检查。

    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 sourceforge.net/.../
    
    
    
    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!!!
    

    我已经在 eMMC 的第二个分区中分配了11GB 的空间、并且在 ext4转换命令中给出了 count = 9000。 请查看随附的日志。 但如果我给出不到4 GB、即3900、那么它将成功闪烁。

    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
    

    此致、Suraj

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Andreas:

    是否有办法解决此问题?

    此致、Suraj

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    那么、您的 DFU 闪存过程会出现什么故障?
    可能是与存储器(DDR)相关的约束或错误。

    您是否确实需要使用4GB 的用户数据进行编程? 该数据中有多少是零? 如果您通过 DFU 对小映像进行编程、然后让文件系统在运行时如我前面所述自行扩展、该操作会更简单/更快。

    此致、Andreas

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Andreas:

    我添加了您提到的 resze2fs systemd 服务、它在运行时扩展、但如果我通过 DFU 在 eMMC 中 刷写映像、则映像在运行时不会扩展、并且其他一切都正常工作、就像我在刷写 SD 卡后引导、那么它在运行时扩展 rootfs 一样。

    如果我从脚本中删除 IF 条件、那么脚本能否正常工作?

    工程师 之间的比较 if确保如此 随时运行 继续进行分区扩展。 请查找演变的脚本。

    #!/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

    此致、Suraj

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Suraj、您好!

    这里还有一条评论...

    哦、您的 DFU 闪存流程出现了什么故障?
    可能是与内存(DDR)相关的约束或错误。[/QUOT]

    快速看一下源代码树,它看起来像闪存 eMMC 分区>4GB 的大小 应该工作,例如基于这个(较早) Git 提交这里从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>

    此 Git 提交是我们最新 SDK v9.x 和 SDK v10.x 版本中的一部分。

    如果您愿意、可以在最后尝试为我们即将推出的 AM62P SDK v11.0使用最新的 CI/CD 快照版本(~ e/o、正式)。 它使用了最新的2029.xx U-Boot 源、因此值得查看 U-Boot DFU 行为是否有任何不同。 我之前看到过、您仍在使用旧的 v9.x SDK、因此尝试新版本绝对值得一试。

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

    [报价 userid="600470" url="~/support/processors-group/processors/f/processors-forum/1484357/sk-am62b-p1-root-filesystem-not-utilizing-full-emmc-partition-after-flashing/5709146 #5709146"]

    如果我从脚本中删除 IF 条件、那么脚本能否正常工作?

    工程师 之间的比较 if确保如此 随时运行 继续进行分区扩展。 请查找演变的脚本。

    [报价]

    如果您修改了脚本、您需要仔细检查并了解这可能产生的副作用、这可能包括但不限于...

    1. 系统启动速度慢
    2. 系统可靠性降低(如果在这些不断的重新调整尝试中出现问题、或在此期间切断电源等、会出现什么情况)

    好消息是,你应该能够从 shell 提示符手动逐行执行该脚本,看看它正在做什么,并跟踪和理解为什么它不能像你认为的那样工作。 这不应该太难做到。 如果您认为有总体改进的空间、可以在此处随意分享任何发现。

    此致、Andreas