changeset 18:c8ad6188b9ed

add c139-gen-fc-* shell script hierarchy
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 10 Jun 2023 08:16:10 +0000
parents 632d62e5efb4
children 2299f1ebbfd2
files sh/c139-gen-fc-ffs-img sh/c139-gen-fc-ffs-tree sh/c139-gen-fc-script
diffstat 3 files changed, 147 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sh/c139-gen-fc-ffs-img	Sat Jun 10 08:16:10 2023 +0000
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if [ $# != 2 ]
+then
+	echo "usage: $0 rfbin-dir imei-file" 1>&2
+	exit 1
+fi
+
+set -e
+
+c139-gen-fc-ffs-tree "$1" "$2" fc-ffs
+
+echo 'Generated file system tree in fc-ffs'
+
+tiffs-mkfs -f /fc-ffs 64x7 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/c139-gen-fc-ffs-tree	Sat Jun 10 08:16:10 2023 +0000
@@ -0,0 +1,95 @@
+#!/bin/sh
+
+if [ $# != 3 ]
+then
+	echo "usage: $0 rfbin-dir imei-file output-dir" 1>&2
+	exit 1
+fi
+
+set -e
+
+# Figure out RF bands
+
+rfbin="$1"
+
+if [ ! -d "$rfbin/rx" -o ! -d "$rfbin/tx" ]
+then
+	echo "Error: no RF calibration records in $1" 1>&2
+	exit 1
+fi
+
+if [ -f "$rfbin/tx/levels.850" ]
+then
+	have850=y
+else
+	have850=n
+fi
+
+if [ -f "$rfbin/tx/levels.900" ]
+then
+	have900=y
+else
+	have900=n
+fi
+
+if [ -f "$rfbin/tx/levels.1800" ]
+then
+	have1800=y
+else
+	have1800=n
+fi
+
+if [ -f "$rfbin/tx/levels.1900" ]
+then
+	have1900=y
+else
+	have1900=n
+fi
+
+case $have850$have900$have1800$have1900 in
+  nyyn)
+	rfcap=dual-eu
+	;;
+  ynny)
+	rfcap=dual-us
+	;;
+  *)
+	echo "Error: RF files in $1 match neither dual-eu nor dual-us" 1>&2
+	exit 1
+esac
+
+# Figure out IMEI and IMEISV
+# SV digits are set per FreeCalypso convention
+
+IMEI=`cat "$2"`
+SV=98
+IMEISV=`make-imeisv $IMEI $SV`
+
+# Now create and populate our file system output
+
+destdir="$3"
+
+rm -rf "$destdir"
+mkdir "$destdir"
+
+# create the same directories as fc-fsio mk-std-dirs
+
+mkdir "$destdir/gsm"
+mkdir "$destdir/gsm/com"
+mkdir "$destdir/pcm"
+mkdir "$destdir/sys"
+mkdir "$destdir/mmi"
+mkdir "$destdir/var"
+mkdir "$destdir/var/dbg"
+mkdir "$destdir/etc"
+
+# populate subtrees
+
+cp -r "$rfbin" "$destdir/gsm/rf"
+cp -r /opt/freecalypso/aud-c139 "$destdir/aud"
+
+# populate individual files
+
+tiffs-mkfile "$destdir/gsm/com/rfcap" rfcap $rfcap
+tiffs-mkfile "$destdir/etc/IMEISV" imeisv $IMEISV
+compile-fc-chg /opt/freecalypso/charging/c1xx/standard "$destdir/etc/charging"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sh/c139-gen-fc-script	Sat Jun 10 08:16:10 2023 +0000
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+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
+
+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
+
+c139-gen-fc-ffs-img rfbin IMEI
+
+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 0x300000 fc-ffs.bin" >> fc-flash-script
+
+echo 'Generated fc-loadtool command script in fc-flash-script'