cancel
Showing results for 
Search instead for 
Did you mean: 

Image install to emmc using sd card

SPark.15
Associate II

Hello Guys

I'm using a157-EV1 board and my custom board.

Both board have sd card slot and emmc. And possible of linux install to sd card and emmc.

Anyway if built images using STM32_Programmer_CLI in Ubuntu environment can be install on the board according to Flashlayout_emmc.tsv, 

Similarly, when booting from a sd card, can i the built images be install in emmc according to Flashlayout_emmc.tsv using command? 

Among the results of complete Image build, if I look at create_sdcard_from_flashlayout.sh and FlashLayout_sdcard_stm32mp157.how_to_update.txt in the script directory, it seems possible with a command, but I don't know how to change and use that fit for emmc.

I need a lot of help as I have no professional knowledge in BSP.

How can I install Linux on EMMC using commands after booting from SD card?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Eldam
Senior

hello,

I'v did the same with our board.

booting from sdcard (select correct boot mode)

copying tfa/uboot/ext4 to emmc from linux user space

poweroff

booting from emmc (select correct boot mode)

some warning:

i've got two rootfs (one main, one save).

Do not raw use the file i give, inspire of them,

Maybe it's not the best "way to do"

use lsblk to know where is mounted emmc ans sdcard

there is a lot of discussion on this forum about emmc

have fun!

or not.

View solution in original post

5 REPLIES 5
Eldam
Senior

hello,

I'v did the same with our board.

booting from sdcard (select correct boot mode)

copying tfa/uboot/ext4 to emmc from linux user space

poweroff

booting from emmc (select correct boot mode)

some warning:

i've got two rootfs (one main, one save).

Do not raw use the file i give, inspire of them,

Maybe it's not the best "way to do"

use lsblk to know where is mounted emmc ans sdcard

there is a lot of discussion on this forum about emmc

have fun!

or not.

Eldam
Senior
 

Hello Eldam

Thanks for your answer.

your answer has been very very helpful to me.

After seeing your command set I first saved my partition information with gdisk. Then I proceeded as follows.

- My Partition Information -

label: gpt
label-id: 3FCF4825-681C-49A9-8A78-4FD2C9FB8295
device: /dev/mmcblk1
unit: sectors
first-lba: 34
last-lba: 7733214
sector-size: 512
 
/dev/mmcblk1p1 : start=        1024, size=        8192, type=8DA63339-0007-60C0-C436-083AC8230908, uuid=F6EF3B3D-14FD-4458-97C0-053F1411EB67, name="fip"
/dev/mmcblk1p2 : start=        9216, size=      131072, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=C057D67D-B786-4F52-8BC2-1FE5682193B5, name="boot", attrs="LegacyBIOSBootable"
/dev/mmcblk1p3 : start=      140288, size=       32768, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=6976DB38-22D1-4994-9C0D-4571C35122CF, name="vendorfs"
/dev/mmcblk1p4 : start=      173056, size=     1524736, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=491F6117-415D-4F53-88C9-6E0DE54DEAC6, name="rootfs"
/dev/mmcblk1p5 : start=     1697792, size=     6034432, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=C66C679D-9903-4D6F-A6C0-B620D3EAE5ED, name="userfs"

- Command Set -

umount -f /dev/mmcblk1*
gdisk -l /dev/mmcblk1
wipefs --all /dev/mmcblk1
 
sfdisk /dev/mmcblk1 < ./FlashLayout_emmc.txt
 
gdisk -l /dev/mmcblk1
 
dd if=/dev/zero of=/dev/mmcblk1p1
dd if=/home/root/20211216/fip-stm32mp157c-ori_c_ev1-mx-trusted.bin of=/dev/mmcblk1p1 bs=1M
 
echo 0 > /sys/class/block/mmcblk1boot0/force_ro
echo 0 > /sys/class/block/mmcblk1boot1/force_ro
dd if=./tf-a-stm32mp157c-ori_c_ev1-mx-emmc.stm32 of=/dev/mmcblk1boot0 bs=1M
dd if=./tf-a-stm32mp157c-ori_c_ev1-mx-emmc.stm32 of=/dev/mmcblk1boot1 bs=1M
sync
 
mkfs.ext4 -F /dev/mmcblk1p2
mkfs.ext4 -F /dev/mmcblk1p3
mkfs.ext4 -F /dev/mmcblk1p4
mkfs.ext4 -F /dev/mmcblk1p5
 
dd if=/home/root/20211216/st-image-bootfs-openstlinux-weston-stm32mp1-ori_c_ev1.ext4 of=/dev/mmcblk1p2 bs=1M 
sync
dd if=/home/root/20211216/st-image-vendorfs-openstlinux-weston-stm32mp1-ori_c_ev1.ext4 of=/dev/mmcblk1p3 bs=1M 
sync
dd if=/home/root/20211216/st-image-core-openstlinux-weston-stm32mp1-ori_c_ev1.ext4 of=/dev/mmcblk1p4 bs=1M 
sync
dd if=/home/root/20211216/st-image-userfs-openstlinux-weston-stm32mp1-ori_c_ev1.ext4 of=/dev/mmcblk1p5 bs=1M 
sync
 
mmc bootpart enable 2 1 /dev/mmcblk1
 

I type it line by line directly(in SD boot). It's going very well. The installation seems to have been completed normally.

(Because gdisk and mmc-util are not installed in the image that was previously installed in emmc. I checked that it exists after a fresh installation)

I have a question!

Unfortunately I don't have a board without Image installed in emmc. Can I expect the same result for a completely empty emmc?

And in the partition information obtained with gdisk, there are no lines for mmcblkXboot0, mmcblkXboot1. Do these two not need partitioning?

Finally if I look at your command set, I can see the following lines:

#copy dtb+extlinux[-->extlinux plus necessaire, on utilise boot.scr.uimg]
mkdir -p /media/mmcblk2p2 
mount /dev/mmcblk2p2 /media/mmcblk2p2
 
#copie du dtb
cp /media/sda1/bootfiles/stm32mp157c-dk2.dtb /media/mmcblk2p2/ -v
sync
 
#copy du uboot.scr.uimg (sdcard/emmc)
#V1.1: boot.scr.uimg est intégré au bootfs
#cp /media/sda1/bootfiles/boot.scr.uimg.emmc /media/mmcblk2p2/boot.scr.uimg -v
#sync
 
#echo copy du kernel
cp /media/sda1/bootfiles/uImage /media/mmcblk2p2/uImage -v
sync

Do I have to do those lines separately? Does it not exist in .ext4 files?

I am very much looking forward to your reply.

Your answer is very helpful to me!

​Thanks

Eldam
Senior

happy to help,

This whole **ù^*$m*m is a bit too much complicated some times.

empty emmc:

Well we use this process to program empty emmc (board just assembled)

we boot on sd card with minimal distri on it (but with gdisk and others utils)

we plug in an usb stick containing ext4 file + config for emmc

we execute script

poweroff

boot to emmc

and thats all folk!

last lines:

unfortunately, im not been able to use the "ST way of using distribution package" :

ie:

use st cube mx to do dts file

import them in yocto user layer

and so on

and program using stm32 programmer (bad usb schematic on our board for using DFU mode)

Instead:

we made a simple layer with our (client+utils) program for yocto,

we build the distri

and after copying ext4 file (on emmc/sd),

we overwrite important files:

LinuxKernel,Tfa,Uboot

thats whats the last lines of my script are for.

mmcblkXboot0, mmcblkXboot1. Do these two not need partitioning?

--> don't know, emmc OldOnes mystery thing , surely Nyarlatotep invocation secret place...

Seeya!

Thank you!

I understand what you mean.

Again, your answer has been very helpful to me.

​Thanks!!