annotate sh/c139-gen-fc-ffs-tree @ 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 2299f1ebbfd2
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 is officially intended to be C139-specific, but it is
2299f1ebbfd2 c139-gen-fc-* shell scripts: add explanatory comments
Mychaela Falconia <falcon@freecalypso.org>
parents: 18
diff changeset
4 # currently used for all C1xx models. This script uses aud-c139 audio mode
2299f1ebbfd2 c139-gen-fc-* shell scripts: add explanatory comments
Mychaela Falconia <falcon@freecalypso.org>
parents: 18
diff changeset
5 # config files, but we don't have a different set of these files for other
2299f1ebbfd2 c139-gen-fc-* shell scripts: add explanatory comments
Mychaela Falconia <falcon@freecalypso.org>
parents: 18
diff changeset
6 # C1xx models, and this aspect of the hw is likely to be the same anyway.
2299f1ebbfd2 c139-gen-fc-* shell scripts: add explanatory comments
Mychaela Falconia <falcon@freecalypso.org>
parents: 18
diff changeset
7
18
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 if [ $# != 3 ]
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 then
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 echo "usage: $0 rfbin-dir imei-file output-dir" 1>&2
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 exit 1
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 fi
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 set -e
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 # Figure out RF bands
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 rfbin="$1"
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 if [ ! -d "$rfbin/rx" -o ! -d "$rfbin/tx" ]
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 then
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 echo "Error: no RF calibration records in $1" 1>&2
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 exit 1
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 fi
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 if [ -f "$rfbin/tx/levels.850" ]
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 then
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 have850=y
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 else
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 have850=n
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 fi
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 if [ -f "$rfbin/tx/levels.900" ]
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 then
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 have900=y
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 else
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 have900=n
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 fi
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 if [ -f "$rfbin/tx/levels.1800" ]
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 then
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 have1800=y
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 else
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 have1800=n
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 fi
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 if [ -f "$rfbin/tx/levels.1900" ]
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 then
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 have1900=y
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 else
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 have1900=n
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 fi
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 case $have850$have900$have1800$have1900 in
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 nyyn)
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 rfcap=dual-eu
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 ;;
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 ynny)
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 rfcap=dual-us
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 ;;
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 "Error: RF files in $1 match neither dual-eu nor dual-us" 1>&2
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 exit 1
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 esac
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 # Figure out IMEI and IMEISV
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 # SV digits are set per FreeCalypso convention
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 IMEI=`cat "$2"`
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 SV=98
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 IMEISV=`make-imeisv $IMEI $SV`
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 # Now create and populate our file system output
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 destdir="$3"
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 rm -rf "$destdir"
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 mkdir "$destdir"
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 # create the same directories as fc-fsio mk-std-dirs
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 mkdir "$destdir/gsm"
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 mkdir "$destdir/gsm/com"
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 mkdir "$destdir/pcm"
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 mkdir "$destdir/sys"
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 mkdir "$destdir/mmi"
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 mkdir "$destdir/var"
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 mkdir "$destdir/var/dbg"
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 mkdir "$destdir/etc"
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 # populate subtrees
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 cp -r "$rfbin" "$destdir/gsm/rf"
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 cp -r /opt/freecalypso/aud-c139 "$destdir/aud"
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 # populate individual files
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 tiffs-mkfile "$destdir/gsm/com/rfcap" rfcap $rfcap
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 tiffs-mkfile "$destdir/etc/IMEISV" imeisv $IMEISV
c8ad6188b9ed add c139-gen-fc-* shell script hierarchy
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 compile-fc-chg /opt/freecalypso/charging/c1xx/standard "$destdir/etc/charging"