diff sh/c139-gen-fc-ffs-tree @ 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
children 2299f1ebbfd2
line wrap: on
line diff
--- /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"