view sh/c1xx-analyze-image @ 5:b3ddbc65c28a

bootref: c11x-lockable.ranges done
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 09 Jun 2023 08:05:52 +0000
parents 12810ff4aa92
children 632d62e5efb4
line wrap: on
line source

#!/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