annotate gsm-fw/cfgmagic/processconf.sh @ 182:13a0348ffce4

rvinterf/etm: checkpointing not-yet-compilable code
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 24 Nov 2013 06:59:09 +0000
parents df335d255ac4
children c70c077243dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 #
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 # The current directory is expected to be the top level of nuc-fw, i.e.,
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
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
18 # some defaults
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
19 RVTMUX_UART_port=IrDA
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
20 RVTMUX_UART_baud=115200
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
21
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 . ./build.conf
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 if [ -z "$TARGET" ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 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
27 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29
122
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
30 # Serial configuration
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
31 case "$RVTMUX_UART_port" in
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
32 IrDA)
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
33 ;;
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
34 MODEM)
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
35 CONFIG_RVTMUX_ON_MODEM=1
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
36 export_to_c CONFIG_RVTMUX_ON_MODEM
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
37 ;;
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
38 *)
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
39 echo "Error: unknown RTVMUX_UART_port=$RTVMUX_UART_port" 1>&2
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
40 exit 1
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
41 ;;
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
42 esac
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
43
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
44 TR_BAUD_CONFIG=TR_BAUD_$RVTMUX_UART_baud
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
45 export_to_c TR_BAUD_CONFIG
28f967578233 RVT compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
46
167
df335d255ac4 gsm-fw: services subdir hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
47 # 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
48 # 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
49 # now it is static.
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50
167
df335d255ac4 gsm-fw: services subdir hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
51 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
52 export_to_mk BUILD_COMPONENTS
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53
167
df335d255ac4 gsm-fw: services subdir hooked into the build
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 143
diff changeset
54 # 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
55 # 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
56
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 BUILD_DEFAULT_IMAGE=ramImage
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 export_to_mk BUILD_DEFAULT_IMAGE
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 # Now generate the output files!
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 parse_export_list() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 for var in $1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 do
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 eval "value=\"\$$var\""
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 emit_def "$var" "$value"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 done
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 # make config.h
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 emit_def() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 echo "#define $1 $2" >> include/config.h
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 : > include/config.h
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 parse_export_list "$c_export_list"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 # make config.mk
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 emit_def() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 echo "$1= $2" >> include/config.mk
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 : > include/config.mk
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 parse_export_list "$mk_export_list"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 # make config.m4
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85 emit_def() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 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
87 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 : > include/config.m4
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89 parse_export_list "$m4_export_list"