Commit f806e08a authored by Angus Ainslie's avatar Angus Ainslie
Browse files write a file to partition 0

This script uses uuu to write a file into partition 0 of the eMMC. Linux
mounts this partition as /boot so the files can be accessed from
Signed-off-by: default avatarAngus Ainslie <>
parent 8bdf9d43
set -e
if [ $# -lt 2 ]; then
echo "Usage: $0 <file> <mmc_dev[:part]>"
echo "*************************************************************"
echo "* Until u-boot is updated to mainline don't try to write to *"
echo "* anything other than partition 0. Writing to partition 1 *"
echo "* will DESTROY your rootfs ! *"
echo "*************************************************************"
exit 1
[ -z "${UUU_SCRIPT}" ] || rm -f "${UUU_SCRIPT}"
trap cleanup EXIT
OUT_FILE=$(basename $1)
SIZE=$(stat --printf="%s" ${FILE})
HEX_SIZE=$(printf "0x%x" ${SIZE})
UUU_SCRIPT=$(mktemp -p ./)
cat << EOF > ${UUU_SCRIPT}
uuu_version 1.0.1
# Use uboot to write a file to the rootfs
SDP: boot -f files/u-boot-librem5-recovery.imx
# This command will be run when use SPL
SDPU: delay 1000
SDPU: write -f files/u-boot-librem5-recovery.imx -offset 0x57c00
SDPU: jump
# This command will be run when ROM support stream mode
SDPS: boot -f files/u-boot-librem5-recovery.imx
FB: ucmd setenv fastboot_buffer 0x43000000
FB: download -f ${FILE}
#FB: ucmd ext4write mmc ${MMC_DEV} 0x43000000 /${OUT_FILE} ${HEX_SIZE}
FB: ucmd save mmc ${MMC_DEV} 0x43000000 /${OUT_FILE} ${HEX_SIZE}
FB: Done
echo "About to run ${UUU_SCRIPT}"
sudo uuu ${UUU_SCRIPT}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment