annotate sh/c139-gen-fc-script @ 19:2299f1ebbfd2

c139-gen-fc-* shell scripts: add explanatory comments
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 10 Jun 2023 23:20:44 +0000
parents c8ad6188b9ed
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
2299f1ebbfd2 c139-gen-fc-* shell scripts: add explanatory comments
Mychaela Falconia <falcon@freecalypso.org>
parents: 18
diff changeset
4 # C139/140 phone to FreeCalypso: it invokes c139-gen-fc-ffs-img to generate
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
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 if [ ! -d rfbin ]
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 then
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 echo "Error: rfbin directory is missing" 1>&2
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 exit 1
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 fi
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 if [ ! -f IMEI ]
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 then
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 echo "Error: IMEI file is missing" 1>&2
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 exit 1
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 fi
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 set -e
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 c139-gen-fc-ffs-img rfbin IMEI
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 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
39 echo "flash e-program-bin 0x10000 $1" >> fc-flash-script
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 echo "flash e-program-bin 0x300000 fc-ffs.bin" >> fc-flash-script
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 echo 'Generated fc-loadtool command script in fc-flash-script'