FreeCalypso > hg > fc-am-toolkit
changeset 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 | 2299f1ebbfd2 |
children | 9d7d2fdc733b |
files | sh/c11x-gen-fc-ffs-img sh/c11x-gen-fc-script |
diffstat | 2 files changed, 103 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sh/c11x-gen-fc-ffs-img Sat Jun 10 23:53:15 2023 +0000 @@ -0,0 +1,37 @@ +#!/bin/sh + +# This shell script generates an fc-ffs.bin image specifically for FreeCalypso +# on C11x, either the 2 MiB flash variant or the 4 MiB flash variant of this +# phone hw subfamily. A required command line argument selects between 2m and +# 4m FFS geometries. + +if [ $# != 3 ] +then + echo "usage: $0 rfbin-dir imei-file 2m|4m" 1>&2 + exit 1 +fi + +case "$3" in + 2m) + ffs_geom=64x3 + ;; + 4m) + ffs_geom=64x7 + ;; + *) + echo "Error: invalid flash config argument" 1>&2 + exit 1 +esac + +set -e + +# FIXME: using c139-gen-fc-ffs-tree script to populate the FFS content for +# FC on C11x is OK for now, but we may need a different script in the future. + +c139-gen-fc-ffs-tree "$1" "$2" fc-ffs + +echo 'Generated file system tree in fc-ffs' + +tiffs-mkfs -f /fc-ffs $ffs_geom fc-ffs fc-ffs.bin + +echo 'Generated FFS image for FC firmware in fc-ffs.bin'
--- /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'