cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble creating v2.0.0 bootable SD card with create_sdcard_from_flashlayout.sh. Is there a pre-built sdcard.img file available?

BMaha.1
Associate II

Following the instructions found in en.FLASH-stm32mp1-openstlinux-5-4-dunfell-mp1-20-06-24.tar.xz and using create_sdcard_from_flashlayout.sh to write the data to an SD card did not work for me. When I inserted the card on the stm32mp157c-dk2 dev board and power up, nothing happens on the serial port or the units display. Things are working with the card shipped with the unit, so the HW is working.

Is there a pre-built SD card image to write to a card to get the v2.0.0 equivalent of what was on the card that came with the dev board?

As I'm posting this and scrolling back in my terminal window I notice warnings about sgdisk. Are those fatal?

Here is a log of what I tried:

```

$ ./create_sdcard_from_flashlayout.sh ../flashlayout_st-image-weston/trusted/FlashLayout_sdcard_stm32mp157c-dk2-trusted.tsv

[WARNING]: A previous raw image are present on this directory

[WARNING]:   ../flashlayout_st-image-weston/trusted/../../FlashLayout_sdcard_stm32mp157c-dk2-trusted.raw

[WARNING]: would you like to erase it: [Y/n]

Create Raw empty image: ../flashlayout_st-image-weston/trusted/../../FlashLayout_sdcard_stm32mp157c-dk2-trusted.raw of 1536MB

Create partition table:

part 1:   fsbl1 ..../create_sdcard_from_flashlayout.sh: line 431: sgdisk: command not found

./create_sdcard_from_flashlayout.sh: line 432: sgdisk: command not found

[CREATED] part 1:   fsbl1 [partition size ]

part 2:   fsbl2 ..../create_sdcard_from_flashlayout.sh: line 431: sgdisk: command not found

./create_sdcard_from_flashlayout.sh: line 432: sgdisk: command not found

[CREATED] part 2:   fsbl2 [partition size ]

part 3:    ssbl ..../create_sdcard_from_flashlayout.sh: line 431: sgdisk: command not found

./create_sdcard_from_flashlayout.sh: line 432: sgdisk: command not found

[CREATED] part 3:    ssbl [partition size ]

part 4:    boot ..../create_sdcard_from_flashlayout.sh: line 431: sgdisk: command not found

./create_sdcard_from_flashlayout.sh: line 432: sgdisk: command not found

[CREATED] part 4:    boot [partition size ]

part 5: vendorfs ..../create_sdcard_from_flashlayout.sh: line 431: sgdisk: command not found

./create_sdcard_from_flashlayout.sh: line 432: sgdisk: command not found

[CREATED] part 5: vendorfs [partition size ]

part 6:  rootfs ..../create_sdcard_from_flashlayout.sh: line 431: sgdisk: command not found

./create_sdcard_from_flashlayout.sh: line 432: sgdisk: command not found

[CREATED] part 6:  rootfs [partition size ]

part 7:  userfs ..../create_sdcard_from_flashlayout.sh: line 431: sgdisk: command not found

./create_sdcard_from_flashlayout.sh: line 432: sgdisk: command not found

[CREATED] part 7:  userfs [partition size ]

Partition table from ../flashlayout_st-image-weston/trusted/../../FlashLayout_sdcard_stm32mp157c-dk2-trusted.raw

./create_sdcard_from_flashlayout.sh: line 443: sgdisk: command not found

Populate raw image with image content:

[ FILLED ] part 1:   fsbl1, image: arm-trusted-firmware/tf-a-stm32mp157c-dk2-trusted.stm32

[ FILLED ] part 2:   fsbl2, image: arm-trusted-firmware/tf-a-stm32mp157c-dk2-trusted.stm32

[ FILLED ] part 3:    ssbl, image: bootloader/u-boot-stm32mp157c-dk2-trusted.stm32

[ FILLED ] part 4:    boot, image: st-image-bootfs-openstlinux-weston-stm32mp1.ext4

[ FILLED ] part 5: vendorfs, image: st-image-vendorfs-openstlinux-weston-stm32mp1.ext4

[ FILLED ] part 6:  rootfs, image: st-image-weston-openstlinux-weston-stm32mp1.ext4

[ FILLED ] part 7:  userfs, image: st-image-userfs-openstlinux-weston-stm32mp1.ext4

###########################################################################

###########################################################################

RAW IMAGE generated: ../flashlayout_st-image-weston/trusted/../../FlashLayout_sdcard_stm32mp157c-dk2-trusted.raw

WARNING: before to use the command dd, please umount all the partitions

   associated to SDCARD.

   sudo umount `lsblk --list | grep mmcblk0 | grep part | gawk '{ print $7 }' | tr '\n' ' '`

To put this raw image on sdcard:

   sudo dd if=../flashlayout_st-image-weston/trusted/../../FlashLayout_sdcard_stm32mp157c-dk2-trusted.raw of=/dev/mmcblk0 bs=8M conv=fdatasync status=progress

(mmcblk0 can be replaced by:

    sdX if it's a device dedicated to receive the raw image

         (where X can be a, b, c, d, e)

###########################################################################

###########################################################################

$

$ sudo dd if=FlashLayout_sdcard_stm32mp157c-dk2-trusted.raw of=/dev/sda bs=8M conv=fdatasync status=progress

[sudo] password for XXXXXXX:

1610612736 bytes (1.6 GB, 1.5 GiB) copied, 225.329 s, 7.1 MB/s

192+0 records in

192+0 records out

1610612736 bytes (1.6 GB, 1.5 GiB) copied, 249.535 s, 6.5 MB/s

$

```

1 ACCEPTED SOLUTION

Accepted Solutions

OK, figured it out. sgdisk is in /sbin, which is not in the default $PATH due to security. The script assumes that it is in the $PATH instead of using the full /sbin/sgdisk in it. Editing the script to use /sbin/sgdisk fixes it.

Still would be a good idea to have a pre-built v2.0.0_sdcard.img file that can just be written to a card available for download.

View solution in original post

4 REPLIES 4
KnarfB
Principal III

> sgdisk: command not found

You must install gdisk providing sgdisk:

sudo apt install gdisk

and then re-create the image file.

https://wiki.st.com/stm32mpu/wiki/STM32MP15_Discovery_kits_-_Starter_Package

As a workaround, STM32CubeProgrammer is able to write an image if the board was booted in DFU mode

I already have it installed:

```

$ sudo apt install gdisk

Reading package lists... Done

Building dependency tree      

Reading state information... Done

gdisk is already the newest version (1.0.3-1.1).

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$

```

OK, figured it out. sgdisk is in /sbin, which is not in the default $PATH due to security. The script assumes that it is in the $PATH instead of using the full /sbin/sgdisk in it. Editing the script to use /sbin/sgdisk fixes it.

Still would be a good idea to have a pre-built v2.0.0_sdcard.img file that can just be written to a card available for download.

(I was too late, you found it)

> As I'm posting this and scrolling back in my terminal window I notice warnings about sgdisk. Are those fatal?

Its listed as a pre-requisite tool and used in the script. Maybe its not found on the path (try which sgdisk), uninstall+re-install the package?