How to flash .gptimg in eMMC flash memory of STM32MP157C board

Hello @mirzak,

I have integrated mender support in STM32MP157C based custom board as per your instructions STM32MP157C Discovery Kit - Board Integrations / Yocto Project - Mender Hub.

I am able to do FW upgrade using mender in SD card. Now, I want to do the same thing in eMMC boot device.

I have done the modification accordingly in mender configurations and generated .gptimg to be flashed in eMMC.

I don’t find any way to upgrade .gptimg in eMMC using STM32CubeProgrammer. Can you please guide me how to flash .gptimg in eMMC?

Thanks & Regards,
Pratik Manvar

Hi All,

Follow below steps to flash full image (.sdcard or .gptimg) into the stm32mp1 series platform using STMCubeProgrammer.

  1. Your directory structure of images should be as below.
    Mender_Release_Package
    ├── arm-trusted-firmware
    │ ├── tf-a-stm32mp157c-osd32mp1-brk-serialboot.stm32
    │ └── tf-a-stm32mp157c-osd32mp1-brk-trusted.stm32
    ├── bootloader
    │ └── u-boot-stm32mp157c-osd32mp1-brk-trusted.stm32
    ├── FlashLayout_emmc_stm32mp157c-osd32mp1-brk-trusted.tsv
    ├── st-image-weston-openstlinux-weston-stm32mp1-eval.img

  2. The content of .tsv file should be as following.

$ cat FlashLayout_emmc_stm32mp157c-osd32mp1-brk-trusted.tsv
#Opt Id Name Type IP Offset Binary
- 0x01 fsbl1-boot Binary none 0x0 arm-trusted-firmware/tf-a-stm32mp157c-osd32mp1-brk-serialboot.stm32
- 0x03 ssbl-boot Binary none 0x0 bootloader/u-boot-stm32mp157c-osd32mp1-brk-trusted.stm32
P 0x10 sdcard RawImage mmc1 0x0 st-image-weston-openstlinux-weston-stm32mp1-eval.img

Thanks & Regards,
Pratik Manvar

1 Like

Hi, tnx for explanation. but I have some questions:

  1. the output image with mender are .gptimg how should I change it to .img?
  2. the image that mender creates it need to be the whole size of my eMMC ?

A gptimg is a type of img, so you can just use it as if it was img. You can even rename it if it suits you better.

It can be, but it can also be smaller. If it’s smaller, the data partition will be resized when you boot the device to fill the remaining space.

1 Like

@kacf, Thanks for your answers.
@SergeyMich, Actually STMCubeProgrammer does not understand .gptimg, so as suggested by @kacf, I renamed .gptimg to .img extention.

Regarding image size, I seen that it’s created of size what we have given in “MENDER_STORAGE_TOTAL_SIZE_MB”.

B. Regards,
Pratik Manvar

Great Thanks.

Hey Pratik Manvar,
I had an issue with my build. And I wondering if you can help.
My board : stm32mp153a - custom
I am building Yocto project to custom board with mender on Kirkstone openstlinux 4.0 distro.
I made some changes to dunfell meta-mender-community so it will run on kirkstone and so far it’s looks ok. the project builds successfully. but when I flash the board the u-boot doesn’t starts at all and there no any outputs on the serial console.


So I cannot continue to flash the image. and it’s looks like the u-boot didn’t get the dtb files of my board.
can you help?
tnx

Hi @SergeyMich,

It seems like you are trying to flash your images with mender support first time on your custom board and till now you are using images without mender support.

If so, you can use your old fsbl (tf-a) and ssbl (u-boot) images (without mender changes) for flashing your gptimg into eMMC.

But, I doubt you will get same issue while booting from eMMC.

Best Regards,
Pratik Manvar

Thanks,
I changed the USB boot files and its writing the image but now I think I have issues with the stm32mp-gptimg.bbclass that I need to adapt it to the Kirkstone distro that has metadata and different fglashlayout :man_facepalming: