sgufa
March 31, 2020, 3:32pm
1
Hi, any advice to create eMMC flashable image and how to flash it?
@sgufa , it wouldn’t take too much to convert the “flasher’s” we use for BeagleBoard.org products…
The biggest gotcha, is the STM32MP15x’s need sgdisk, which isn’t usually installed by default…
https://www.digikey.com/eewiki/display/linuxonarm/STM32MP1#STM32MP1-SetupmicroSDcard
Here’s a quick example from for the BeagleBone’s eMMC flasher
#!/bin/bash -e
#
# Copyright (c) 2013-2018 Robert Nelson <robertcnelson@gmail.com>
# Portions copyright (c) 2014 Charles Steinkuehler <charles@steinkuehler.net>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
This file has been truncated. show original
First to get converted would be sfdisk -> sgdisk
sfdisk_options="--force --Linux --in-order --unit M"
sfdisk_boot_startmb="${conf_boot_startmb}"
test_sfdisk=$(LC_ALL=C sfdisk --help | grep -m 1 -e "--in-order" || true)
if [ "x${test_sfdisk}" = "x" ] ; then
message="sfdisk: [2.26.x or greater]" ; broadcast
if [ "x${bootrom_gpt}" = "xenable" ] ; then
sfdisk_options="--force --label gpt"
else
sfdisk_options="--force"
fi
sfdisk_boot_startmb="${sfdisk_boot_startmb}M"
fi
message="sfdisk: [$(LC_ALL=C sfdisk --version)]" ; broadcast
message="sfdisk: [sfdisk ${sfdisk_options} ${destination}]" ; broadcast
message="sfdisk: [${sfdisk_boot_startmb},,${sfdisk_fstype},*]" ; broadcast
LC_ALL=C sfdisk ${sfdisk_options} "${destination}" <<-__EOF__
${sfdisk_boot_startmb},,${sfdisk_fstype},*
__EOF__
You could script it, or just hard code the values…
sudo sgdisk -o ${DISK}
sudo sgdisk --resize-table=128 -a 1 \
-n 1:34:545 -c 1:fsbl1 \
-n 2:546:1057 -c 2:fsbl2 \
-n 3:1058:5153 -c 3:ssbl \
-n 4:5154: -c 4:rootfs \
-p ${DISK}
sudo sgdisk -A 4:set:2 ${DISK}
Then the booloader install would be converted from 2 dd’s to 3 dd’s here:
Then convert all “1” ext4 partition’s would need to be converted to STM32MP’s “4th” ext partition configuration. (luckily other than dd’ing into Partition 1, 2, and 3 not much needs to be done with them…
Regards,
sgufa
April 1, 2020, 7:39am
3
Hello Robert,
if i’m not wrong, in this way you always need to boot the system from sd card and then you can flash the emmc from sd, right? Isn’t there a way to flash directly emmc maybe using STM32CubeProgrammer?
Zouqz
September 25, 2021, 3:40am
5
Hello Robert,
Please share with me the modified scripts.
Thanks,
Qizhang