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