annotate gsm-fw/cfgmagic/functions @ 413:1ed2d78f150c

loadtools: boot-reflash-hack hwparam setting hooked in
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Tue, 17 Jun 2014 05:11:25 +0000
parents afceeeb2cba1
children 11b6ca57a079
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 target() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 if [ $# -lt 1 ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 echo "target setting: required argument missing" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 if [ -n "$TARGET" ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 echo "Error: target specified more than once" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 if [ ! -f "cfgmagic/target.$1" ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 echo "Error: target $1 not known" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 # looks good, proceed
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 TARGET="$1"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 . "cfgmagic/target.$1"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 . cfgmagic/post-target
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 feature() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 if [ $# -lt 1 ]
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 "feature setting: required argument missing" 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 if [ -z "$TARGET" ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 echo "Please specify the target before any features" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 if [ ! -f "cfgmagic/feature.$1" ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 echo "Error: feature $1 not known" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 fi
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 # looks good, proceed
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 . "cfgmagic/feature.$1"
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 export_to_c() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 if [ $# != 1 ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 echo "export_to_c: wrong number of arguments" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 fi
91
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
49 case "$c_export_list" in
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
50 *" $1 "* | *" $1")
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
51 ;;
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
52 *)
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
53 c_export_list="$c_export_list $1"
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
54 ;;
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
55 esac
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 export_to_mk() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 if [ $# != 1 ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 echo "export_to_mk: wrong number of arguments" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 fi
91
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
64 case "$mk_export_list" in
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
65 *" $1 "* | *" $1")
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
66 ;;
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
67 *)
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
68 mk_export_list="$mk_export_list $1"
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
69 ;;
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
70 esac
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 }
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 export_to_m4() {
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 if [ $# != 1 ]
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 then
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76 echo "export_to_m4: wrong number of arguments" 1>&2
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 exit 1
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 fi
91
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
79 case "$m4_export_list" in
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
80 *" $1 "* | *" $1")
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
81 ;;
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
82 *)
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
83 m4_export_list="$m4_export_list $1"
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
84 ;;
3641e44f044e nuc-fw config: export_to_*(): catch multiple exports of the same setting
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
85 esac
88
ccde45a06737 nuc-fw: beginning of the configuration mechanism
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 }