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-AM437X: How to make image files created from SD card smaller

Part Number: PROCESSOR-SDK-AM437X

Hello Sitara fighters.

I am developing a system using the SDK(*) on a custom board we developed.
(*):PROCESSOR-SDK-LINUX-RT-AM437X(06.03.00.106)

Our prototype board is equipped with eMMC, and the execution image is stored in the eMMC.
The executable image is copied from the SD card (16GB), but the actual executable files are not that large.
Please let me know if there is a way to make the executable file image smaller. I hope it will fit into 6GB.
Sorry for the beginner question.It would be helpful if there were explanatory materials such as tutorials.
<Background>
Unfortunately, I accidentally configured the eMMC to pSLC using U-boot's "hwpartition" command.
Therefore, I have to make the image size smaller.
Best regards,
Kazu
  • The executable image is copied from the SD card (16GB), but the actual executable files are not that large.
    Please let me know if there is a way to make the executable file image smaller. I hope it will fit into 6GB.

    How do you create the image?
    How do you move it from SD card to eMMC (commands?)

    Regards, Andreas

  • Hello Andreas-san,

    I'm sorry for replying late.

    How do you create the image?

    I took over the project, so I don't know about the initial image creation process.
    I'm just guessing, but I think it was built according to the SDK manual.
    Note: I was also able to create a zImage using the command "make linux".
    I usually use the free tool Image Writer to create images from SD cards.(ex Win32 Disk Imager)


    How do you move it from SD card to eMMC (commands?)

    Yes. I am writing using U-boot commands.
    Our prototype board has only two external interfaces:
    - UART0
    - USB0 (HOST: USB0_ID=Low(fix))
    Therefore, I am using a USB SD card reader to write the entire image of the SD card from USB0 (HOST).

    (ex.CLIP CARDREADER BSCRSDXU2)

    ex.
    usb read 0x82000000 0x0000000 0x8000
    mmc write 0x82000000 0x0000000 0x8000
    :
    :
    I'm learning about sitara and linux development.
    Once I have enough knowledge to modify the source code, I will consider a better method.

    It would be helpful if you could give me some advice.

    Best regards,
    Kazu
  • Hi Kazu,

    I'll be out of the office for the next few days so I assigned this to one of our other experts. But what you have here seems more of a generic Linux concern really - how to shrink a partition size. Doing some quick Google search I found this https://superuser.com/questions/1373289/how-do-i-shrink-the-partition-of-an-img-file-made-from-dd which suggests to first shrink the filesystem (via resize2fs) before then shrinking the partition (via fdisk). Perhaps you check this out first and do some experiments to see if you can get that working.

    Regards, Andreas

  • Hello Andreas-san,

    Thanks for the reply and tips.
    I was able to successfully reduce the image size and boot Linux.
    I will write down the steps as a memorandum.

    1.Prepare a USB memory with undefined partitions
      In my case, I used Windows standard disk management tools.
      (Create and format hard disk partitions)


    2.Create boot partition
       In my case, I used Windows standard disk management tools.
       (70MB FAT32)

    3. Copy the following files to the created partition(In my case)
        - .ipaddr
        - MLO
        - u-boot
        - u-boot.img
        - uEnv.txt

    4. Create ext4 partition using ubuntu PC
    <Command to use>
    Check the USB memory device file name: ls /dev/sd*
    Partition creation: sudo fdisk /dev/sd*(* is the alphabet that corresponds to the USB memory, e.g. "b")
    Create two 3G partitions (can be set with "+3G" in the Last sector setting during the partition creation command)
    Signing with ext4: mkfs.ext4 /dev/sd** (** is the number corresponding to the USB memory partition, e.g. "sdb2, sdb3")

    5. Place the file system on the created ext4 partition
    Refer to "3.1.1.5.8. Booting Linux from USB storage"
    "The rootfs partition contains the filesystem from ProcSDK release package."
    https://software-dl.ti.com/processor-sdk-linux/esd/AM437X/07_03_00_005/exports/docs/linux/Foundational_Components/U-Boot/UG-Memory.html

    6. Edit the contents of each file to suit your board application

       

  • Hi Kazu,

    Glad the issue is resolved. Thanks for updating with the details.