Commit 98bdf401 authored by Angus Ainslie (Purism)'s avatar Angus Ainslie (Purism)
Browse files

compare_flash.sh: add a script to check the flash contents



Check the contents of the on board flash.
Signed-off-by: default avatarAngus Ainslie (Purism) <angus@akkea.ca>
parent 887cdf27
Pipeline #57128 passed with stages
in 7 minutes and 42 seconds
#!/bin/sh
set -e
if [ $# -lt 1 ]; then
echo "Usage: $0 <file>"
echo "\tCompare a file to the NOR flash contents"
exit 1
fi
cleanup()
{
[ -z "${UUU_SCRIPT}" ] || rm -f "${UUU_SCRIPT}"
}
trap cleanup EXIT
FILE=$1
SIZE=$(stat --printf="%s" ${FILE})
SIZE=$(echo "(${SIZE}/4096+1)*4096" | bc)
HEX_SIZE=$(printf "0x%x" ${SIZE})
# the last block will contain some junk so only campre the beginning
SIZE=$(echo "(${SIZE}/4-1024)" | bc)
HEX_WORDS=$(printf "0x%x" ${SIZE})
UUU_SCRIPT=$(mktemp -p ./)
cat << EOF > ${UUU_SCRIPT}
uuu_version 1.0.1
CFG: FB: -vid 0x316d -pid 0x4c05
CFG: SDP: -chip MX8MQ -compatible MX8MQ -vid 0x316d -pid 0x4c05
SDP: boot -f files/u-boot-librem5.imx
# This command will be run when use SPL
SDPU: delay 1000
SDPU: write -f files/u-boot-librem5.imx -offset 0x57c00
SDPU: jump
SDPV: delay 1000
SDPV: write -f files/u-boot-librem5.imx -skipspl
SDPV: jump
FB: ucmd setenv fastboot_buffer 0x43000000
FB: download -f ${FILE}
FB: ucmd sf probe
FB: ucmd sf read 0x44000000 0 ${HEX_SIZE}
FB: delay 2000
FB: ucmd cmp 0x43000000 0x44000000 ${HEX_WORDS}
FB: Done
EOF
echo "About to run ${UUU_SCRIPT}"
cat ${UUU_SCRIPT}
uuu -v ${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