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.

AM6411: unable to use the u-boot shell to create FAT partitions in the eMMC

Part Number: AM6411

Tool/software:

Hello,

Are there any steps I can take to use the u-boot shell to format and create the FAT partition in eMMC?

Regards,

Dharmik

  • Hello,

    The U-Boot only supports partitioning the eMMC/SD with GPT partition table. It does not suppport formatting the created partitions.

    For partitioning alone, you could refer to the following guide

    https://software-dl.ti.com/processor-sdk-linux/esd/AM64X/09_02_01_10/exports/docs/linux/Foundational_Components/U-Boot/UG-Memory.html#partitioning-emmc-from-u-boot

    Regards,

    Prashant

  • Thank you for the replay.

    Using link's step I am able to create the below partitions,

    => setenv uuid_gpt_disk 1b227e49-3270-4cc9-8264-9786391c9315
    => setenv uuid_gpt_rootfs ba2e82e5-095d-4e85-849f-69c90f9e4b7b
    => setenv  partitions "uuid_disk=${uuid_gpt_disk};name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}"
    => gpt write mmc 0 ${partitions}
    Writing GPT: success!
    => mmc part
    
    Partition Map for MMC device 0  --   Partition Type: EFI
    
    Part    Start LBA       End LBA         Name
            Attributes
            Type GUID
            Partition GUID
      1     0x00001000      0x01da3fde      "rootfs"
            attrs:  0x0000000000000000
            type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
            guid:   ba2e82e5-095d-4e85-849f-69c90f9e4b7b

    But I want to create the partitions as given below,

    => mmc part
    
    Partition Map for MMC device 0  --   Partition Type: DOS
    
    Part    Start Sector    Num Sectors     UUID            Type
      1     2048            262144          781be063-01     0c Boot
      2     264192          24576000        781be063-02     83
      3     24840192        6240256         781be063-03     83

    The purpose of this is to use the DFU mode to flash the images into the board when eMMC is brand-new and there are no partitions. At that point, we require boot and rootfs partitions, How can I create the partitions?

    Tell me if I missed something, please.

    Thanks, 

    Dharmik

  • Hello,

    But I want to create the partitions as given below,

    The U-Boot does not support MBR partitions so you will have to resort to GPT partitions if partitioning via the U-Boot. However, you can create multiple GPT partitions if that's the requirement. Please refer the following thread in that case:

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1349733/am625-not-able-to-create-boot-partition/5143574#5143574

    Regards,

    Prashant

  • It's working, I am able create 2 partition.

    => mmc part
    
    Partition Map for MMC device 0  --   Partition Type: EFI
    
    Part    Start LBA       End LBA         Name
            Attributes
            Type GUID
            Partition GUID
      1     0x00000022      0x00000061      "boot"
            attrs:  0x0000000000000000
            type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
            guid:   d39df892-87d6-4811-bb62-f5902c4cc75a
      2     0x00000062      0x01da3fde      "rootfs"
            attrs:  0x0000000000000000
            type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
            guid:   147f21e7-6f59-4ba9-a3ac-6a6b27759f57
    

    While using DFU mode I am getting the below error while transferring the tiboot3.bin, but it is working fine while rootfs transferring.

    => setenv dfu_alt_info 'boot part 0 1; rootfs part 0 2; tiboot3.bin fat 0 1; tispl.bin fat 0 1; u-boot.img fat 0 1; uEnv.txt fat 0 1; sysfw.itb fat 0 1'
    => dfu 0 mmc 0
    ##dfu: fs_set_blk_dev error!
    Deferred dfu_flush() failed!dfu - Device Firmware Upgrade
    
    Usage:
    dfu <USB_controller> [<interface> <dev>] [list]
    - device firmware upgrade via <USB_controller>
    on device <dev>, attached to interface
    <interface>
    [list] - list available alt settings

    Thanks,

    Dharmik

  • Hello,

    While using DFU mode I am getting the below error while transferring the tiboot3.bin, but it is working fine while rootfs transferring.

    This is because you haven't formatted the partitions yet. To flash the tiboot3.bin/tispl.bin/u-boot.img/uEnv.txt, you will have to format the boot partition first as a FAT partition.

    The reason rootfs image transfer works because I think you have already created the rootfs image as a Linux EXT4 filesystem image which is flashed as a raw binary image in the 2nd partition (rootfs part 0 2).

    So, you could do the same for boot partition as well by creating a FAT filesystem image on your PC and flashing it with (boot part 0 1)

    dfu-util -a boot -D <FAT filesystem image path>

    Regards,

    Prashant

  • Hello,

    I made the.img file using the link below and tested it on the same EFI boot disc, but your provided command is still returning an error.

    https://fejlesztek.hu/create-a-fat-file-system-image-on-linux/

    => dfu 0 mmc 0
    Request would exceed designated area!
    #
    

    If it is requires to format the boot partition with the FAT then please share the step or link.

    Let me know it I miss something.

    Thanks,

    Dharmik

  • Hello,

    but your provided command is still returning an error.

    This is because the boot partition you created has size 32MB. So, you would need to make sure the FAT filesystem image is not larger than 32MB which should ideally be the case. The tiboot3.bin/tispl.bin/u-boot.img would take about 5MB. But, ofcourse you could create a larger sized FAT partition according to your requirement.

    Regards,

    Prashant

  • I appreciate your assistance and quick response.

    I can now flash the BOOT partition because there was a size issue with the partitions.

    Even though I enabled the bootable flag on the partition, I am still unable to boot from the eMMC after flashing the boot partitions.

    setenv partitions 'name=boot,size=35M,bootable,uuid=${uuid_gpt_boot};name=rootfs,size=-,uuid=${uuid_gpt_rootfs}'
    gpt write mmc 0 $partitions

    Do you believe I should change the boot modes? For now, I'm using FS mode. And What would mmc partconf and mmc bootbus be for this method?

    Thanks,

    Dharmik

  • Hello,

    The correct bootmode for eMMC UDA FS is => B0-B7: 11000010, B8-B15: 00000000

    If this is correctly set then you should once confirm if the images are correctly present in the FAT partition like so

    => ls mmc 0:1
      1017011   tispl.bin
      1328819   u-boot.img
       612067   tiboot3.bin
    
    3 file(s), 0 dir(s)

    Let me know if files are correctly present and still not booting.

    Regards,

    Prashant

  • Hello,

    We are using the same bootmode as you have mentioned, also I am getting images in the boot partition, but still no eMMC booting.

    => ls mmc 0:1
       928663   tispl.bin
       519126   tiboot3.bin
      1393399   u-boot.img
    
    3 file(s), 0 dir(s)

    Boot from the USB and get the mmc partition using fdisk command,

    root@am64xx-evm:~# fdisk -l
    Disk /dev/mmcblk0: 14.82 GiB, 15913189376 bytes, 31080448 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: C04B234F-4D45-40ED-A167-AB564E0BB471
    
    Device         Start      End  Sectors  Size Type
    /dev/mmcblk0p1    34    71713    71680   35M Microsoft basic data
    /dev/mmcblk0p2 71714 31080414 31008701 14.8G Microsoft basic data

    Regards,

    Dharmik

  • Hi Dharmik,

    I will have to once get the clarification from the ROM team to know if it even supports booting from a FAT partition in GPT partition table. If it doesn't then you will have to use MBR partition table which has been tested and works.

    I understand U-Boot doesn't support partitioning eMMC with MBR partition table but this is not really a problem. You could create the full disk image on your PC and flash it directly. For instance, the prebuilt WIC image (uncompressed) is a disk image partitioned with MBR which can be flashed as a raw binary image in eMMC UDA.

    I would also like you to know that usually, we keep the U-Boot images in the eMMC Boot0 partition and the Rootfs partitions in the eMMC UDA. This way, we can use either MBR or GPT partition table for Rootfs partitions. So, this is also an option.

    Regards,

    Prashant

  • Hi Prashant,

    Any update on the FAT partition?

    Also I have tested the DFU with raw mode, for that I have followed below steps,

    1) create the partitions using below command.

    setenv uuid_gpt_disk 1b227e49-3270-4cc9-8264-9786391c9315
    setenv uuid_gpt_rootfs ba2e82e5-095d-4e85-849f-69c90f9e4b7b
    setenv partitions "uuid_disk=${uuid_gpt_disk};name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}"
    gpt write mmc 0 ${partitions}

    2) Boot from the DFU.

    3) Set below parameters.

    => setenv dfu_alt_info 'rawemmc raw 0 0x800000 mmcpart 1; rootfs part 0 1; tiboot3.bin.raw raw 0x0 0x400 mmcpart 1; tispl.bin.raw raw 0x400 0x1000 mmcpart 1; u-boot.img.raw raw 0x1400 0x2000 mmcpart 1; u-env.raw raw 0x3400 0x100 mmcpart 1'

    => dfu 0 mmc 0 list
    DFU alt settings list:
    dev: eMMC alt: 0 name: rawemmc layout: RAW_ADDR
    dev: eMMC alt: 1 name: rootfs layout: RAW_ADDR
    dev: eMMC alt: 2 name: tiboot3.bin.raw layout: RAW_ADDR
    dev: eMMC alt: 3 name: tispl.bin.raw layout: RAW_ADDR
    dev: eMMC alt: 4 name: u-boot.img.raw layout: RAW_ADDR
    dev: eMMC alt: 5 name: u-env.raw layout: RAW_ADDR
    => dfu 0 mmc 0

    4) eMMC partition looks like,

    => mmc part

    Partition Map for MMC device 0 -- Partition Type: EFI

    Part Start LBA End LBA Name
    Attributes
    Type GUID
    Partition GUID
    1 0x00001000 0x01da3fde "rootfs"
    attrs: 0x0000000000000000
    type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
    guid: ba2e82e5-095d-4e85-849f-69c90f9e4b7b
    =>

    5)Load the images from the host machine.

    sudo dfu-util -a tiboot3.bin.raw -D tiboot3.bin --device 0451
    sudo dfu-util -a tispl.bin.raw -D tispl.bin --device 0451
    sudo dfu-util -a u-boot.img.raw -D u-boot.img --device 0451
    sudo dfu-util -R -a rootfs -D rootfs.ext4 --device 0451

    6) Set boot flag.

    => mmc partconf 0 1 1 1
    => mmc bootbus 0 2 0 0
    Set to BOOT_BUS_WIDTH = 0x2, RESET = 0x0, BOOT_MODE = 0x0

    7) Change BOOTMODE to eMMC UDA with FS/RAW pin High

    Still not boot from the eMMC,

    Do I miss something?

    Thanks,

    Dharmik

  • Hi Dharmik,

    Any update on the FAT partition?

    Unfortunately, the ROM does not support booting from GPT partitions.

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1323764/tmds64gpevm-u-boot-and-gpt-partition-format/5036482#5036482

    So, you could either use MBR partition table in UDA or keep U-Boot images in Boot0 partition and MBR/GPT Rootfs partitions in eMMC UDA.

    7) Change BOOTMODE to eMMC UDA with FS/RAW pin High

    Since you have flashed the U-Boot images to Boot0 partition, you would have to use the eMMC Alternate bootmode as shown here

    https://software-dl.ti.com/mcu-plus-sdk/esd/AM64X/09_02_00_50/exports/docs/api_guide_am64x/EVM_SETUP_PAGE.html#BOOTMODE_EMMC

    Regards,

    Prashant