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

**URL:** <https://hub.mender.io/t/how-to-flash-gptimg-in-emmc-flash-memory-of-stm32mp157c-board/5089>\
**Category:** Yocto Project\
**Tags:** yocto\
**Created:** [July 5, 2022, 1:58pm UTC](https://hub.mender.io/t/how-to-flash-gptimg-in-emmc-flash-memory-of-stm32mp157c-board/5089 "2022-07-05T13:58:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![manvar-pratik](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/manvar-pratik/32/1656_2.png) [@manvar-pratik](https://hub.mender.io/u/manvar-pratik)\
**Post date:** [July 5, 2022, 1:58pm UTC](https://hub.mender.io/t/how-to-flash-gptimg-in-emmc-flash-memory-of-stm32mp157c-board/5089/1 "2022-07-05T13:58:20Z")

</div>

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](https://hub.mender.io/t/stm32mp157c-discovery-kit/1676).

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

---

<div class="post-metadata">

**Author:** ![manvar-pratik](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/manvar-pratik/32/1656_2.png) [@manvar-pratik](https://hub.mender.io/u/manvar-pratik)\
**Post date:** [August 8, 2022, 8:37am UTC](https://hub.mender.io/t/how-to-flash-gptimg-in-emmc-flash-memory-of-stm32mp157c-board/5089/4 "2022-08-08T08:37:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SergeyMich](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sergeymich/32/1767_2.png) [@SergeyMich](https://hub.mender.io/u/SergeyMich)\
**Post date:** [September 13, 2022, 1:41pm UTC](https://hub.mender.io/t/how-to-flash-gptimg-in-emmc-flash-memory-of-stm32mp157c-board/5089/5 "2022-09-13T13:41:33Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [September 14, 2022, 11:54am UTC](https://hub.mender.io/t/how-to-flash-gptimg-in-emmc-flash-memory-of-stm32mp157c-board/5089/6 "2022-09-14T11:54:08Z")

</div>

> [@SergeyMich](#):
>
> the output image with mender are .gptimg how should I change it to .img?

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.

> [@SergeyMich](#):
>
> the image that mender creates it need to be the whole size of my eMMC ?

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.

---

<div class="post-metadata">

**Author:** ![manvar-pratik](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/manvar-pratik/32/1656_2.png) [@manvar-pratik](https://hub.mender.io/u/manvar-pratik)\
**Post date:** [September 16, 2022, 8:16am UTC](https://hub.mender.io/t/how-to-flash-gptimg-in-emmc-flash-memory-of-stm32mp157c-board/5089/7 "2022-09-16T08:16:01Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![SergeyMich](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sergeymich/32/1767_2.png) [@SergeyMich](https://hub.mender.io/u/SergeyMich)\
**Post date:** [September 17, 2022, 8:45pm UTC](https://hub.mender.io/t/how-to-flash-gptimg-in-emmc-flash-memory-of-stm32mp157c-board/5089/8 "2022-09-17T20:45:33Z")

</div>

Great Thanks.

---

<div class="post-metadata">

**Author:** ![SergeyMich](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sergeymich/32/1767_2.png) [@SergeyMich](https://hub.mender.io/u/SergeyMich)\
**Post date:** [October 12, 2022, 7:52am UTC](https://hub.mender.io/t/how-to-flash-gptimg-in-emmc-flash-memory-of-stm32mp157c-board/5089/9 "2022-10-12T07:52:14Z")

</div>

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.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/1/12f5a2e205999464fb2e7b93e6447b4a75ccf1ce.png)  
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

---

<div class="post-metadata">

**Author:** ![manvar-pratik](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/manvar-pratik/32/1656_2.png) [@manvar-pratik](https://hub.mender.io/u/manvar-pratik)\
**Post date:** [October 12, 2022, 8:13am UTC](https://hub.mender.io/t/how-to-flash-gptimg-in-emmc-flash-memory-of-stm32mp157c-board/5089/10 "2022-10-12T08:13:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SergeyMich](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sergeymich/32/1767_2.png) [@SergeyMich](https://hub.mender.io/u/SergeyMich)\
**Post date:** [October 12, 2022, 9:09am UTC](https://hub.mender.io/t/how-to-flash-gptimg-in-emmc-flash-memory-of-stm32mp157c-board/5089/11 "2022-10-12T09:09:55Z")

</div>

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 🤦‍♂️

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/5/5480aee3258ec52c55e66ed46db336a269e7157d.png)
