cancel
Showing results for 
Search instead for 
Did you mean: 

EMMC system upgrade from SD Card

MWoło.2
Senior II

Hi,

my system working fine from EMMC(written through cube programmer). I also have on my board an SD-Card slot and boot configuration pins. Is it possible to upgrade the system through SD-Card to EMMC via dd if=... from rootfs?

How to prepare EMMC....raw file, is it possible?

I try to write sd_card.....raw file using dd application to EMMC, but the system can't start. After powering on, nothing is shown on uart debug log (boot pins changes, of course).

Thanks in advanced

BR Michal

1 ACCEPTED SOLUTION

Accepted Solutions
MWoło.2
Senior II

I think I have a procedure, but it is complicated a little bit

Step 1. The emmc....tsv file modification

0693W00000SuoZPQAZ.pngJust remove P in lines 4 and 5 and type -. Suggested create a copy of the original file because in next compilation file will be again replaced to the original content.

Step 2. Generation *.raw file

./create_sdcard_from_flashlayout.sh ../flashlayout_st-image-weston/trusted/FlashLayout_emmc_xxxx.tsv

Step 3. Copy to sd card created *.raw and tf-a-stm32mp157c...-mx-emmc.stm32 into to /usr/local for instance

Step 4. Write prepared raw image into EMMC memory by typing

dd if=/usr/local/FlashLayout_emmc_stm32mp157c-....-mx-trusted.raw of=/dev/mmcblk1 bs=8M conv=fdatasync status=progress

Step 5. Unlock the EMMC boot area

echo 0 > /sys/class/block/mmcblk1boot0/force_ro
echo 0 > /sys/class/block/mmcblk1boot1/force_ro

Step 6. Write tf-a image into the EMMC

dd if=/usr/local/tf-a-stm32mp157c-...-mx-emmc.stm32 of=/dev/mmcblk1boot0
dd if=/usr/local/tf-a-stm32mp157c-...-mx-emmc.stm32 of=/dev/mmcblk1boot1

Step 7. Mount boot partition on EMMC

mkdir -p /mnt/emmc-card
mount /dev/mmcblk1p6 /mnt/emmc-card
vi /mnt/emmc-card/extlinux.conf

Change record

root=PARTUUID=491f6117-415d-4f53-88c9-6e0de54deac6

to

root=/dev/mmcblk1p8

Step 8. Clean up procedure

umount /mnt/emmc-card
rm -rf /mnt/emmc-card

Step 9. Synchronize written files

sync

Step 10. Power off the board and change boot pins to EMMC

One more thing finally, to be able to store the new prepared *.raw file into /usr/local it is necessary to extend sd-card /usr/local partition. I do it like that in the file create_sdcard_from_flashlayout.sh

0693W00000SuobkQAB.pngbut this is only for the Sd-card for the EMMC go back to Your settings.

Can someone reproduce this procedure and confirm that everything is right?

View solution in original post

6 REPLIES 6
MWoło.2
Senior II

Upgrade I mean from the previous version to the latest(4.0.2) version with partition change.

Christophe Guibout
ST Employee

Hi @Michał Wołowik​ ,

eMMC contains two extra partitions (boot0 and boot1) that are not in sdcard. If these partitions are not flashed, it can explain why the system form eMMC can't start.

I would recommand to create a eMMC raw file (you may need to create a dedicated flashlayout file, and hack create_sdcard_from_flashlayout.sh script) that you put into the sdcard, and also the eMMC TF-A (ex:tf-a-stm32mp157f-ev1-emmc.stm32), then you could do something like that on your board :

dd if=<sdcard>/<eMMC image>.raw of=/dev/mmcblk1
dd if=<sdcard>/tf-a-stm32mp157f-ev1-emmc.stm32 of=/dev/mmcblk1boot0
dd if=<sdcard>/tf-a-stm32mp157f-ev1-emmc.stm32 of=/dev/mmcblk1boot1

Feel free to follow the links from the wiki to have a better understanding of these explanations.

BR,

Christophe

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
MWoło.2
Senior II

Thanks for the answer I will try.

Yes, You have right both mmcblk1boot0 and mmcblk1boot1 are after USB programming on the EMMC memory.

MWoło.2
Senior II

I think I have a procedure, but it is complicated a little bit

Step 1. The emmc....tsv file modification

0693W00000SuoZPQAZ.pngJust remove P in lines 4 and 5 and type -. Suggested create a copy of the original file because in next compilation file will be again replaced to the original content.

Step 2. Generation *.raw file

./create_sdcard_from_flashlayout.sh ../flashlayout_st-image-weston/trusted/FlashLayout_emmc_xxxx.tsv

Step 3. Copy to sd card created *.raw and tf-a-stm32mp157c...-mx-emmc.stm32 into to /usr/local for instance

Step 4. Write prepared raw image into EMMC memory by typing

dd if=/usr/local/FlashLayout_emmc_stm32mp157c-....-mx-trusted.raw of=/dev/mmcblk1 bs=8M conv=fdatasync status=progress

Step 5. Unlock the EMMC boot area

echo 0 > /sys/class/block/mmcblk1boot0/force_ro
echo 0 > /sys/class/block/mmcblk1boot1/force_ro

Step 6. Write tf-a image into the EMMC

dd if=/usr/local/tf-a-stm32mp157c-...-mx-emmc.stm32 of=/dev/mmcblk1boot0
dd if=/usr/local/tf-a-stm32mp157c-...-mx-emmc.stm32 of=/dev/mmcblk1boot1

Step 7. Mount boot partition on EMMC

mkdir -p /mnt/emmc-card
mount /dev/mmcblk1p6 /mnt/emmc-card
vi /mnt/emmc-card/extlinux.conf

Change record

root=PARTUUID=491f6117-415d-4f53-88c9-6e0de54deac6

to

root=/dev/mmcblk1p8

Step 8. Clean up procedure

umount /mnt/emmc-card
rm -rf /mnt/emmc-card

Step 9. Synchronize written files

sync

Step 10. Power off the board and change boot pins to EMMC

One more thing finally, to be able to store the new prepared *.raw file into /usr/local it is necessary to extend sd-card /usr/local partition. I do it like that in the file create_sdcard_from_flashlayout.sh

0693W00000SuobkQAB.pngbut this is only for the Sd-card for the EMMC go back to Your settings.

Can someone reproduce this procedure and confirm that everything is right?

MWoło.2
Senior II

One thing is strange. After programming the EMMC memory and keeping boot pins to mmc0(sd-card) during startup, the system mount rootfs not from SD-Card but EMMC. So I experimented with formatting the EMMC and then the system mount rootfs from the Sd-Card as it should. How do avoid such behaviour?

Additionally, I have a warning.

0693W00000SuofhQAB.pngThe rootfs seem to be fine.

0693W00000Suog6QAB.pngAfter erasing the EMMC root, the mount point looks the same

0693W00000SuogkQAB.pngbut now it is mounted correctly

So where is the problem?

MWoło.2
Senior II

I think I found a solution it is necessary to change the record for mmc0 for file extlinux.conf.

Change from

	APPEND root=PARTUUID=e91c4e10-16e6-4c0e-bd0e-77becf4a3582 rootwait rw   console=${console},${baudrate}

to

	APPEND root=/dev/mmcblk0p10 rootwait rw   console=${console},${baudrate}

For me works.