diff sh/c1xx-analyze-image @ 2:12810ff4aa92

c1xx-analyze-image: initial version
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 09 Jun 2023 06:07:09 +0000
parents
children 632d62e5efb4
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sh/c1xx-analyze-image	Fri Jun 09 06:07:09 2023 +0000
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+if [ $# != 1 ]
+then
+	echo "usage: $0 flashdump.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
+
+length=`wc -c $1 | cut -d ' ' -f 1`
+
+case "$length" in
+	2097152)
+		echo 'Flash dump file size is 2 MiB'
+		echo 'Is it a small-flash C11x/12x phone?'
+		flash=2m
+		cal_offset=0x1FC000
+		;;
+	4194304)
+		echo 'Flash dump file size is 4 MiB'
+		echo 'Possible Compal phones: C11x/12x, C139/140, SE J100'
+		flash=4m
+		cal_offset=0x3FC000
+		;;
+	8388608)
+		echo 'Flash dump file size is 8 MiB'
+		echo 'Is it a Motorola C155/156 phone?'
+		flash=8m
+		cal_offset=0x7E0000
+		;;
+	*)
+		echo "Error: file length of $1 is not understood" 1>&2
+		exit 1
+esac
+
+set -e
+
+echo 'Parsing for RF calibration records'
+c1xx-calextr -a rfasc -b rfbin "$1" $cal_offset
+
+if [ ! -d rfbin/rx -o ! -d rfbin/tx ]
+then
+	echo "Error: no RF calibration records found" 1>&2
+	exit 1
+fi