Commit 7169ceb0 authored by Guido Gunther's avatar Guido Gunther

Merge branch 'script-updates' into 'master'

Script updates

See merge request Librem5/librem5-devkit-tools!85
parents 999fe473 f806e08a
#!/bin/sh
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
fi
cleanup()
{
[ -z "${UUU_SCRIPT}" ] || rm -f "${UUU_SCRIPT}"
}
trap cleanup EXIT
FILE=$1
OUT_FILE=$(basename $1)
MMC_DEV=$2
OUT_PATH=$3
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
EOF
echo "About to run ${UUU_SCRIPT}"
cat ${UUU_SCRIPT}
sudo uuu ${UUU_SCRIPT}
uuu_version 1.0.1
# Flash a new uboot and m4.bin located in ../files to the first boot partition
SDP: boot -f ../files/u-boot-devkit-recovery.imx
# This command will be run when use SPL
SDPU: delay 1000
SDPU: write -f ../files/u-boot-devkit-recovery.imx -offset 0x57c00
SDPU: jump
SDPS: boot -f ../files/u-boot-devkit-recovery.imx
FB: ucmd mmc dev 0 1
FB: ucmd setenv fastboot_buffer 0x43000000
FB: download -f ../files/u-boot-devkit.imx
FB: ucmd mmc write 0x43000000 0x42 0x800
FB: download -f ../files/m4.bin
FB: ucmd mmc write 0x43000000 0x4 0x10
FB: ucmd mmc partconf 0 0 1 0
FB: Done
uuu_version 1.0.1
# Flash a new uboot and m4.bin located in ../files to the second boot partition
SDP: boot -f ../files/u-boot-devkit-recovery.imx
# This command will be run when use SPL
SDPU: delay 1000
SDPU: write -f ../files/u-boot-devkit-recovery.imx -offset 0x57c00
SDPU: jump
SDPS: boot -f ../files/u-boot-devkit-recovery.imx
FB: ucmd mmc dev 0 2
FB: ucmd setenv fastboot_buffer 0x43000000
FB: download -f ../files/u-boot-devkit.imx
FB: ucmd mmc write 0x43000000 0x42 0x800
FB: download -f ../files/m4.bin
FB: ucmd mmc write 0x43000000 0x4 0x10
FB: ucmd mmc partconf 0 0 2 0
FB: Done
......@@ -10,7 +10,7 @@ SDPU: jump
# This command will be run when ROM support stream mode
SDPS: boot -f ../files/u-boot-devkit-recovery.imx
SDPU: delay 1000
#FB: ucmd setenv fastboot_buffer 0x43000000
FB: ucmd mmc dev 0
FB: ucmd setenv fastboot_dev mmc
FB: ucmd setenv mmcdev 0
FB: flash -raw2sparse all ../files/devkit.img
......
uuu_version 1.0.1
# Flash a new uboot and m4.bin located in ../files
SDP: boot -f ../files/u-boot-devkit-recovery.imx
# This command will be run when use SPL
SDPU: delay 1000
SDPU: write -f ../files/u-boot-devkit-recovery.imx -offset 0x57c00
SDPU: jump
SDPS: boot -f ../files/u-boot-devkit-recovery.imx
FB: ucmd mmc partconf 0 0 1 0
FB: Done
uuu_version 1.0.1
# Flash a new uboot and m4.bin located in ../files
SDP: boot -f ../files/u-boot-devkit-recovery.imx
# This command will be run when use SPL
SDPU: delay 1000
SDPU: write -f ../files/u-boot-devkit-recovery.imx -offset 0x57c00
SDPU: jump
SDPS: boot -f ../files/u-boot-devkit-recovery.imx
FB: ucmd mmc partconf 0 0 2 0
FB: Done
uuu_version 1.0.1
SDP: boot -f ../files/u-boot-devkit-recovery.imx
# This command will be run when use SPL
SDPU: delay 1000
SDPU: write -f ../files/u-boot-devkit-recovery.imx -offset 0x57c00
SDPU: jump
SDPS: boot -f ../files/u-boot-devkit-recovery.imx
FB: ucmd mmc partconf 0 0 7 0
FB: Done
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