FreeCalypso > hg > fc-am-toolkit
annotate sh/c11x-gen-fc-script @ 21:9d7d2fdc733b
new shell scripts c155-gen-fc-{ffs-img,script}
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 11 Jun 2023 00:28:10 +0000 |
parents | aa2fd60a44fb |
children |
rev | line source |
---|---|
18
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 #!/bin/sh |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 |
19
2299f1ebbfd2
c139-gen-fc-* shell scripts: add explanatory comments
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
3 # This shell script generates the set of files needed for reflashing a Motorola |
20
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
4 # C11x/12x phone to FreeCalypso: it invokes c11x-gen-fc-ffs-img to generate |
19
2299f1ebbfd2
c139-gen-fc-* shell scripts: add explanatory comments
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
5 # fc-ffs.bin (customized FFS image containing IMEI and extracted factory RF |
2299f1ebbfd2
c139-gen-fc-* shell scripts: add explanatory comments
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
6 # calibration values specific to your particular phone), and the present script |
2299f1ebbfd2
c139-gen-fc-* shell scripts: add explanatory comments
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
7 # then generates a command script for fc-loadtool that flashes everything |
2299f1ebbfd2
c139-gen-fc-* shell scripts: add explanatory comments
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
8 # in one go. |
2299f1ebbfd2
c139-gen-fc-* shell scripts: add explanatory comments
Mychaela Falconia <falcon@freecalypso.org>
parents:
18
diff
changeset
|
9 |
18
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 if [ $# != 1 ] |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 then |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 echo "usage: $0 fwimage.bin" 1>&2 |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 exit 1 |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 fi |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 if [ ! -f "$1" ] |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 then |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 echo "Error: $1 does not exist or is not a regular file" 1>&2 |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 exit 1 |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 fi |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
20
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
22 flashimg=flashdump.bin |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
23 |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
24 if [ ! -f $flashimg ] |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
25 then |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
26 echo "Error: $flashimg is missing" 1>&2 |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
27 exit 1 |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
28 fi |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
29 |
18
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 if [ ! -d rfbin ] |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 then |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 echo "Error: rfbin directory is missing" 1>&2 |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 exit 1 |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 fi |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 if [ ! -f IMEI ] |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 then |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 echo "Error: IMEI file is missing" 1>&2 |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 exit 1 |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 fi |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 set -e |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 |
20
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
44 length=`wc -c $flashimg | cut -d ' ' -f 1` |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
45 |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
46 case "$length" in |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
47 2097152) |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
48 flash=2m |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
49 ffs_addr=0x1C0000 |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
50 ;; |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
51 4194304) |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
52 flash=4m |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
53 ffs_addr=0x300000 |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
54 ;; |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
55 *) |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
56 echo "Error: file length of $flashimg is not understood" 1>&2 |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
57 exit 1 |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
58 esac |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
59 |
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
60 c11x-gen-fc-ffs-img rfbin IMEI $flash |
18
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 echo 'flash erase-program-boot /opt/freecalypso/target-bin/compal-flash-boot-for-fc.bin' > fc-flash-script |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 echo "flash e-program-bin 0x10000 $1" >> fc-flash-script |
20
aa2fd60a44fb
new shell scripts c11x-gen-fc-{ffs-img,script}
Mychaela Falconia <falcon@freecalypso.org>
parents:
19
diff
changeset
|
64 echo "flash e-program-bin $ffs_addr fc-ffs.bin" >> fc-flash-script |
18
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 |
c8ad6188b9ed
add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 echo 'Generated fc-loadtool command script in fc-flash-script' |