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