FreeCalypso > hg > freecalypso-citrine
comparison cfgmagic/processconf.sh @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children | 7155882cc49d |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 #!/bin/sh | |
2 # The top level Makefile invokes this Bourne shell script after ensuring | |
3 # that the build.conf file is present. The job of this script is to grok | |
4 # that configuration file and to produce include/config.{h,mk,m4} files | |
5 # corresponding to the selected configuration. | |
6 # | |
7 # The current directory is expected to be the top level of gsm-fw, i.e., | |
8 # all fragments are sourced as cfgmagic/blah. | |
9 # Don't run this script directly - let the Makefile do it for you. | |
10 | |
11 set -e | |
12 . cfgmagic/functions | |
13 TARGET= | |
14 c_export_list= | |
15 mk_export_list= | |
16 m4_export_list= | |
17 target_feature_list= | |
18 | |
19 # some defaults | |
20 FFS_IN_RAM=1 | |
21 RVTMUX_UART_port=IrDA | |
22 RVTMUX_UART_baud=115200 | |
23 FLASH_BOOT_VIA_BOOTROM=1 | |
24 FLASHIMAGE_BASE_ADDR=0x2000 | |
25 DWNLD=1 | |
26 L1_DYN_DSP_DWNLD=0 | |
27 | |
28 # We always export CONFIG_INCLUDE_xxx to config.h and config.mk, whether | |
29 # enabled or disabled. This way enabling any of these components is | |
30 # as simple as CONFIG_INCLUDE_xxx=1, without having to remember the | |
31 # export_to_{c,mk} magic. | |
32 CONFIG_INCLUDE_GPF=0 | |
33 export_to_c CONFIG_INCLUDE_GPF | |
34 export_to_mk CONFIG_INCLUDE_GPF | |
35 CONFIG_INCLUDE_L1=0 | |
36 export_to_c CONFIG_INCLUDE_L1 | |
37 export_to_mk CONFIG_INCLUDE_L1 | |
38 CONFIG_INCLUDE_PCM=0 | |
39 export_to_c CONFIG_INCLUDE_PCM | |
40 export_to_mk CONFIG_INCLUDE_PCM | |
41 CONFIG_INCLUDE_PS=0 | |
42 export_to_c CONFIG_INCLUDE_PS | |
43 export_to_mk CONFIG_INCLUDE_PS | |
44 CONFIG_INCLUDE_SIM=0 | |
45 export_to_c CONFIG_INCLUDE_SIM | |
46 export_to_mk CONFIG_INCLUDE_SIM | |
47 | |
48 . ./build.conf | |
49 | |
50 if [ -z "$TARGET" ] | |
51 then | |
52 echo "Error: target not set in build.conf" 1>&2 | |
53 exit 1 | |
54 fi | |
55 | |
56 # Serial configuration | |
57 case "$RVTMUX_UART_port" in | |
58 IrDA) | |
59 CONFIG_LLDBG_UART_BASE=0xFFFF5000 | |
60 ;; | |
61 MODEM) | |
62 CONFIG_LLDBG_UART_BASE=0xFFFF5800 | |
63 CONFIG_RVTMUX_ON_MODEM=1 | |
64 export_to_c CONFIG_RVTMUX_ON_MODEM | |
65 ;; | |
66 *) | |
67 echo "Error: unknown RVTMUX_UART_port=$RVTMUX_UART_port" 1>&2 | |
68 exit 1 | |
69 ;; | |
70 esac | |
71 | |
72 TR_BAUD_CONFIG=TR_BAUD_$RVTMUX_UART_baud | |
73 export_to_c TR_BAUD_CONFIG | |
74 | |
75 # FFS in RAM | |
76 export_to_c FFS_IN_RAM | |
77 export_to_m4 FFS_IN_RAM | |
78 if [ $FFS_IN_RAM = 1 ] | |
79 then | |
80 if [ -z "$RAMFFS_BLKSIZE_LOG2" -o -z "$RAMFFS_NBLOCKS" ] | |
81 then | |
82 echo \ | |
83 "Error: RAMFFS_BLKSIZE_LOG2 and RAMFFS_NBLOCKS need to be defined" 1>&2 | |
84 exit 1 | |
85 fi | |
86 export_to_c RAMFFS_BLKSIZE_LOG2 RAMFFS_NBLOCKS | |
87 export_to_m4 RAMFFS_BLKSIZE_LOG2 RAMFFS_NBLOCKS | |
88 fi | |
89 | |
90 # Sane vs. Compal target differences for flash boot | |
91 export_to_c FLASH_BOOT_VIA_BOOTROM | |
92 export_to_m4 FLASH_BOOT_VIA_BOOTROM FLASHIMAGE_BASE_ADDR | |
93 | |
94 # L1 configuration | |
95 if [ "$CONFIG_GSM" = 1 -a "$CONFIG_L1_STANDALONE" = 1 ] | |
96 then | |
97 echo "Error: feature gsm and feature l1stand are mutually exclusive" \ | |
98 1>&2 | |
99 exit 1 | |
100 fi | |
101 if [ "$CONFIG_INCLUDE_L1" = 1 ] | |
102 then | |
103 export_to_c L1_DYN_DSP_DWNLD DWNLD | |
104 export_to_mk L1_DYN_DSP_DWNLD | |
105 fi | |
106 | |
107 # The list of build components: we have some invariants that are always | |
108 # included, and some others that are included depending on the configuration. | |
109 | |
110 BUILD_COMPONENTS="bsp libiram nucleus riviera serial services sprintf sysglue" | |
111 | |
112 if [ "$CONFIG_INCLUDE_GPF" = 1 ] | |
113 then | |
114 BUILD_COMPONENTS="$BUILD_COMPONENTS gpf" | |
115 fi | |
116 if [ "$CONFIG_INCLUDE_L1" = 1 ] | |
117 then | |
118 BUILD_COMPONENTS="$BUILD_COMPONENTS L1" | |
119 fi | |
120 if [ "$CONFIG_INCLUDE_PS" = 1 ] | |
121 then | |
122 BUILD_COMPONENTS="$BUILD_COMPONENTS ccd comlib" | |
123 BUILD_COMPONENTS="$BUILD_COMPONENTS g23m-aci g23m-glue g23m-gsm" | |
124 fi | |
125 if [ "$CONFIG_LLDBG" = 1 ] | |
126 then | |
127 BUILD_COMPONENTS="$BUILD_COMPONENTS lldbg" | |
128 fi | |
129 | |
130 export_to_mk BUILD_COMPONENTS | |
131 | |
132 # The default build image type depends on the target and features | |
133 if [ -f "cfgmagic/defimage.$TARGET" ] | |
134 then | |
135 . "cfgmagic/defimage.$TARGET" | |
136 else | |
137 BUILD_DEFAULT_IMAGE=ramImage | |
138 fi | |
139 | |
140 export_to_mk BUILD_DEFAULT_IMAGE | |
141 | |
142 # Now generate the output files! | |
143 | |
144 parse_export_list() { | |
145 for var in $1 | |
146 do | |
147 eval "value=\"\$$var\"" | |
148 emit_def "$var" "$value" | |
149 done | |
150 } | |
151 | |
152 # make config.h | |
153 emit_def() { | |
154 echo "#define $1 $2" >> include/config.h | |
155 } | |
156 : > include/config.h | |
157 parse_export_list "$c_export_list" | |
158 | |
159 # make config.mk | |
160 emit_def() { | |
161 echo "$1= $2" >> include/config.mk | |
162 } | |
163 : > include/config.mk | |
164 parse_export_list "$mk_export_list" | |
165 | |
166 # make config.m4 | |
167 emit_def() { | |
168 echo 'define(`'"$1'"',`'"$2')dnl" >> include/config.m4 | |
169 } | |
170 : > include/config.m4 | |
171 parse_export_list "$m4_export_list" |