FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/cfgmagic/processconf.sh @ 305:4dccc9d3305f
gsm-fw: checking in DAR from Leonardo source
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 16 Mar 2014 05:48:58 +0000 |
parents | c70c077243dd |
children | 2a26785fb5a2 |
rev | line source |
---|---|
88
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 #!/bin/sh |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 # The top level Makefile invokes this Bourne shell script after ensuring |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 # that the build.conf file is present. The job of this script is to grok |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 # that configuration file and to produce include/config.{h,mk,m4} files |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 # corresponding to the selected configuration. |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 # |
207
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
7 # The current directory is expected to be the top level of gsm-fw, i.e., |
88
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 # all fragments are sourced as cfgmagic/blah. |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 # Don't run this script directly - let the Makefile do it for you. |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 set -e |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 . cfgmagic/functions |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 TARGET= |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 c_export_list= |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 mk_export_list= |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 m4_export_list= |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 |
122 | 18 # some defaults |
207
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
19 FFS_IN_RAM=1 |
122 | 20 RVTMUX_UART_port=IrDA |
21 RVTMUX_UART_baud=115200 | |
22 | |
88
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 . ./build.conf |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 if [ -z "$TARGET" ] |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 then |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 echo "Error: target not set in build.conf" 1>&2 |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 exit 1 |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 fi |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 |
122 | 31 # Serial configuration |
32 case "$RVTMUX_UART_port" in | |
33 IrDA) | |
34 ;; | |
35 MODEM) | |
36 CONFIG_RVTMUX_ON_MODEM=1 | |
37 export_to_c CONFIG_RVTMUX_ON_MODEM | |
38 ;; | |
39 *) | |
207
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
40 echo "Error: unknown RVTMUX_UART_port=$RVTMUX_UART_port" 1>&2 |
122 | 41 exit 1 |
42 ;; | |
43 esac | |
44 | |
45 TR_BAUD_CONFIG=TR_BAUD_$RVTMUX_UART_baud | |
46 export_to_c TR_BAUD_CONFIG | |
47 | |
207
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
48 # FFS in RAM |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
49 export_to_c FFS_IN_RAM |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
50 export_to_m4 FFS_IN_RAM |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
51 if [ $FFS_IN_RAM = 1 ] |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
52 then |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
53 if [ -z "$RAMFFS_BLKSIZE_LOG2" -o -z "$RAMFFS_NBLOCKS" ] |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
54 then |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
55 echo \ |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
56 "Error: RAMFFS_BLKSIZE_LOG2 and RAMFFS_NBLOCKS need to be defined" 1>&2 |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
57 exit 1 |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
58 fi |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
59 export_to_c RAMFFS_BLKSIZE_LOG2 |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
60 export_to_m4 RAMFFS_BLKSIZE_LOG2 |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
61 export_to_c RAMFFS_NBLOCKS |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
62 export_to_m4 RAMFFS_NBLOCKS |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
63 fi |
c70c077243dd
gsm-fw: beginning of config magic for FFS
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
167
diff
changeset
|
64 |
167
df335d255ac4
gsm-fw: services subdir hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
65 # At some point the list of build components will probably become |
df335d255ac4
gsm-fw: services subdir hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
66 # dependent on feature or maybe even target configurations, but for |
df335d255ac4
gsm-fw: services subdir hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
67 # now it is static. |
88
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 |
167
df335d255ac4
gsm-fw: services subdir hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
69 BUILD_COMPONENTS="bsp nucleus riviera serial services sprintf sysglue" |
88
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 export_to_mk BUILD_COMPONENTS |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 |
167
df335d255ac4
gsm-fw: services subdir hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
72 # The support for building flashable images is not here yet, |
df335d255ac4
gsm-fw: services subdir hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
73 # so ramImage is all we can build for now. |
df335d255ac4
gsm-fw: services subdir hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
74 |
88
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 BUILD_DEFAULT_IMAGE=ramImage |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 export_to_mk BUILD_DEFAULT_IMAGE |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 # Now generate the output files! |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 parse_export_list() { |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 for var in $1 |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 do |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 eval "value=\"\$$var\"" |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 emit_def "$var" "$value" |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 done |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 } |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 # make config.h |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 emit_def() { |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 echo "#define $1 $2" >> include/config.h |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 } |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 : > include/config.h |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 parse_export_list "$c_export_list" |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 # make config.mk |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 emit_def() { |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 echo "$1= $2" >> include/config.mk |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 } |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 : > include/config.mk |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 parse_export_list "$mk_export_list" |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 # make config.m4 |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 emit_def() { |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 echo 'define(`'"$1'"',`'"$2')dnl" >> include/config.m4 |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 } |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 : > include/config.m4 |
ccde45a06737
nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 parse_export_list "$m4_export_list" |