Skip to main content
Visitor II
July 1, 2019
Question

Creating a bootable SD card with dd

  • July 1, 2019
  • 3 replies
  • 2385 views

I've tried to create a bootable CD card image using both the Starter image as well as a Yocto built image. In both cases the device fails to boot.

I've gone into stm32mp1-openstlinux-4.19-thud-mp1-19-02-20/images/stm32mp1 directory and then run:

scripts/create_sdcard_from_flashlayout.sh flashlayout_st-image-weston/FlashLayout_sdcard_stm32mp157c-dk2-basic.tsv

This creates a .RAW image and instruction on how to load that onto the SD card. I then run:

sudo dd if=flashlayout_st-image-weston/../flashlayout_st-image-weston_FlashLayout_sdcard_stm32mp157c-dk2-basic.raw of=/dev/sdb bs=8M conv=fdatasync status=progress

When this is done I insert the SD card into the stm32mp157c-dk2 board and set both boot dip switches to on. I then apply power and nothing happens. There is no output on the terminal.

Is this method supported?

    This topic has been closed for replies.

    3 replies

    Technical Moderator
    July 2, 2019

    Hi @nlbutts​ 

    Yes this is supported

    Please refer to User manual to check you didn't forget any step :

    https://wiki.st.com/stm32mpu/wiki/How_to_populate_the_SD_card_with_dd_command

    Hope it help

    Olivier

    nlbuttsAuthor
    Visitor II
    July 2, 2019

    Thanks for the response. I followed that page precisely and my board would not boot. I did get it to boot by using the STM32_Programmer_CLI tool. But I would like to simply image an SD card.

    Technical Moderator
    July 3, 2019

    Hello, did you use a Linux PC or a VM ?

    I just tried using VMware without trouble.

    On VM, be sure you write to the right SD-Card and this one is visible (use cat /proc/partitions).

    ~/STM32MP15-Ecosystem-v1.0.0/Starter-Package/stm32mp1-openstlinux-4.19-thud-mp1-19-02-20/images/stm32mp1/scripts$ ./create_sdcard_from_flashlayout.sh 
    ../flashlayout_st-image-weston/FlashLayout_sdcard_stm32mp157c-dk2-basic.tsv
    Create Raw empty image: ../flashlayout_st-image-weston/../flashlayout_st-image-weston_FlashLayout_sdcard_stm32mp157c-dk2-basic.raw of 1536MB
    Create partition table:
    [CREATED] part 1: fsbl1 [partition size 256.0 KiB]
    [CREATED] part 2: fsbl2 [partition size 256.0 KiB]
    [CREATED] part 3: ssbl [partition size 2.0 MiB]
    [CREATED] part 4: bootfs [partition size 64.0 MiB]
    [CREATED] part 5: vendorfs [partition size 16.0 MiB]
    [CREATED] part 6: rootfs [partition size 750.4 MiB]
    [CREATED] part 7: userfs [partition size 703.0 MiB]
     
    Partition table from ../flashlayout_st-image-weston/../flashlayout_st-image-weston_FlashLayout_sdcard_stm32mp157c-dk2-basic.raw
    Disk ../flashlayout_st-image-weston/../flashlayout_st-image-weston_FlashLayout_sdcard_stm32mp157c-dk2-basic.raw: 3145728 sectors, 1.5 GiB
    Sector size (logical): 512 bytes
    Disk identifier (GUID): 1868411E-3CF7-4736-B071-95E882E39B34
    Partition table holds up to 128 entries
    Main partition table begins at sector 2 and ends at sector 33
    First usable sector is 34, last usable sector is 3145694
    Partitions will be aligned on 2-sector boundaries
    Total free space is 0 sectors (0 bytes)
     
    Number Start (sector) End (sector) Size Code Name
     1 34 545 256.0 KiB 8300 fsbl1
     2 546 1057 256.0 KiB 8300 fsbl2
     3 1058 5153 2.0 MiB 8300 ssbl
     4 5154 136225 64.0 MiB 8300 bootfs
     5 136226 168993 16.0 MiB 8300 vendorfs
     6 168994 1705857 750.4 MiB 8300 rootfs
     7 1705858 3145694 703.0 MiB 8300 userfs
     
    Populate raw image with image content:
    [ FILLED ] part 1: fsbl1, image: u-boot-spl.stm32-stm32mp157c-dk2-basic 
    [ FILLED ] part 2: fsbl2, image: u-boot-spl.stm32-stm32mp157c-dk2-basic 
    [ FILLED ] part 3: ssbl, image: u-boot-stm32mp157c-dk2-basic.img 
    [ FILLED ] part 4: bootfs, 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/../flashlayout_st-image-weston_FlashLayout_sdcard_stm32mp157c-dk2-basic.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/../flashlayout_st-image-weston_FlashLayout_sdcard_stm32mp157c-dk2-basic.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)
     
    ###########################################################################
    ###########################################################################
    ~/STM32MP15-Ecosystem-v1.0.0/Starter-Package/stm32mp1-openstlinux-4.19-thud-mp1-19-02-20/images/stm32mp1/scripts$ sudo dd if=../flashlayout_st-image-weston_FlashLayout_sdcard_stm32mp157c-dk2-basic.raw of=/dev/sdb bs=8M conv=fdatasync
    192+0 records in
    192+0 records out
    1610612736 bytes (1.6 GB, 1.5 GiB) copied, 82.6478 s, 19.5 MB/s

    then when you boot the DK2 platform using this SD-Card, should see on the console (ST-Link VCP)

    U-Boot SPL 2018.11-stm32mp-r2 (Nov 14 2018 - 16:10:06 +0000)
    Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
    RAM: DDR3-1066/888 bin G 1x4Gb 533MHz v1.41
    Trying to boot from MMC1
     
     
    U-Boot 2018.11-stm32mp-r2 (Nov 14 2018 - 16:10:06 +0000)
     
    CPU: STM32MP157CAC Rev.B
    Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
    Board: stm32mp1 in basic mode (st,stm32mp157c-dk2)
    Board: MB1272 Var2 Rev.C-01
     Watchdog enabled
    DRAM: 512 MiB
    .......