FreeCalypso > hg > fc-am-toolkit
diff sh/c11x-gen-fc-script @ 20:aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 10 Jun 2023 23:53:15 +0000 |
parents | sh/c139-gen-fc-script@2299f1ebbfd2 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sh/c11x-gen-fc-script Sat Jun 10 23:53:15 2023 +0000 @@ -0,0 +1,66 @@ +#!/bin/sh + +# This shell script generates the set of files needed for reflashing a Motorola +# C11x/12x phone to FreeCalypso: it invokes c11x-gen-fc-ffs-img to generate +# fc-ffs.bin (customized FFS image containing IMEI and extracted factory RF +# calibration values specific to your particular phone), and the present script +# then generates a command script for fc-loadtool that flashes everything +# in one go. + +if [ $# != 1 ] +then + echo "usage: $0 fwimage.bin" 1>&2 + exit 1 +fi + +if [ ! -f "$1" ] +then + echo "Error: $1 does not exist or is not a regular file" 1>&2 + exit 1 +fi + +flashimg=flashdump.bin + +if [ ! -f $flashimg ] +then + echo "Error: $flashimg is missing" 1>&2 + exit 1 +fi + +if [ ! -d rfbin ] +then + echo "Error: rfbin directory is missing" 1>&2 + exit 1 +fi + +if [ ! -f IMEI ] +then + echo "Error: IMEI file is missing" 1>&2 + exit 1 +fi + +set -e + +length=`wc -c $flashimg | cut -d ' ' -f 1` + +case "$length" in + 2097152) + flash=2m + ffs_addr=0x1C0000 + ;; + 4194304) + flash=4m + ffs_addr=0x300000 + ;; + *) + echo "Error: file length of $flashimg is not understood" 1>&2 + exit 1 +esac + +c11x-gen-fc-ffs-img rfbin IMEI $flash + +echo 'flash erase-program-boot /opt/freecalypso/target-bin/compal-flash-boot-for-fc.bin' > fc-flash-script +echo "flash e-program-bin 0x10000 $1" >> fc-flash-script +echo "flash e-program-bin $ffs_addr fc-ffs.bin" >> fc-flash-script + +echo 'Generated fc-loadtool command script in fc-flash-script'