comparison 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
comparison
equal deleted inserted replaced
1:acfe834e174f 2:12810ff4aa92
1 #!/bin/sh
2
3 if [ $# != 1 ]
4 then
5 echo "usage: $0 flashdump.bin" 1>&2
6 exit 1
7 fi
8
9 if [ ! -f "$1" ]
10 then
11 echo "Error: $1 does not exist or is not a regular file" 1>&2
12 exit 1
13 fi
14
15 length=`wc -c $1 | cut -d ' ' -f 1`
16
17 case "$length" in
18 2097152)
19 echo 'Flash dump file size is 2 MiB'
20 echo 'Is it a small-flash C11x/12x phone?'
21 flash=2m
22 cal_offset=0x1FC000
23 ;;
24 4194304)
25 echo 'Flash dump file size is 4 MiB'
26 echo 'Possible Compal phones: C11x/12x, C139/140, SE J100'
27 flash=4m
28 cal_offset=0x3FC000
29 ;;
30 8388608)
31 echo 'Flash dump file size is 8 MiB'
32 echo 'Is it a Motorola C155/156 phone?'
33 flash=8m
34 cal_offset=0x7E0000
35 ;;
36 *)
37 echo "Error: file length of $1 is not understood" 1>&2
38 exit 1
39 esac
40
41 set -e
42
43 echo 'Parsing for RF calibration records'
44 c1xx-calextr -a rfasc -b rfbin "$1" $cal_offset
45
46 if [ ! -d rfbin/rx -o ! -d rfbin/tx ]
47 then
48 echo "Error: no RF calibration records found" 1>&2
49 exit 1
50 fi