This repository has been archived by the owner on Jan 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rdk_build.sh
executable file
·172 lines (155 loc) · 4.88 KB
/
rdk_build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/bin/bash
##########################################################################
# If not stated otherwise in this file or this component's LICENSE
# file the following copyright and licenses apply:
#
# Copyright 2019 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##########################################################################
#######################################
#
# Build Framework standard script for
#
# xw4 common component
# use -e to fail on any shell issue
# -e is the requirement from Build Framework
set -e
# default PATHs - use `man readlink` for more info
# the path to combined build
export RDK_PROJECT_ROOT_PATH=${RDK_PROJECT_ROOT_PATH-`readlink -m ..`}
export COMBINED_ROOT=$RDK_PROJECT_ROOT_PATH
# path to build script (this script)
export RDK_SCRIPTS_PATH=${RDK_SCRIPTS_PATH-`readlink -m $0 | xargs dirname`}
export RDK_TOOLCHAIN_PATH=${RDK_TOOLCHAIN_PATH-`readlink -m $RDK_PROJECT_ROOT_PATH/sdk/toolchain/staging_dir`}
# path to components sources and target
export RDK_SOURCE_PATH=${RDK_SOURCE_PATH-`readlink -m .`}
export RDK_TARGET_PATH=${RDK_TARGET_PATH-$RDK_SOURCE_PATH}
# default component name
export RDK_COMPONENT_NAME=${RDK_COMPONENT_NAME-`basename $RDK_SOURCE_PATH`}
export RDK_DIR=$RDK_PROJECT_ROOT_PATH
#source $RDK_SCRIPTS_PATH/soc/build/soc_env.sh
# To enable rtMessage
export RTMESSAGE=yes
if [ "$XCAM_MODEL" == "SCHC2" ]; then
. ${RDK_PROJECT_ROOT_PATH}/build/components/amba/sdk/setenv2
elif [ "$XCAM_MODEL" == "SERXW3" ] || [ "$XCAM_MODEL" == "SERICAM2" ]; then
. ${RDK_PROJECT_ROOT_PATH}/build/components/sdk/setenv2
else #No Matching platform
echo "Source environment that include packages for your platform. The environment variables PROJ_PRERULE_MAK_FILE should refer to the platform s PreRule make"
fi
if [ "$XCAM_MODEL" != "XHB1" ];then
export RDK_DUMP_SYMS=${RDK_PROJECT_ROOT_PATH}/utility/prebuilts/breakpad-prebuilts/x86/dump_syms
export STRIP=${RDK_TOOLCHAIN_PATH}/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip
else
export RDK_DUMP_SYMS=${RDK_PROJECT_ROOT_PATH}/utility/prebuilts/breakpad-prebuilts/x64/dump_syms
fi
# parse arguments
INITIAL_ARGS=$@
function usage()
{
set +x
echo "Usage: `basename $0` [-h|--help] [-v|--verbose] [action]"
echo " -h --help : this help"
echo " -v --verbose : verbose output"
echo " -p --platform =PLATFORM : specify platform for xw4 common"
echo
echo "Supported actions:"
echo " configure, clean, build (DEFAULT), rebuild, install"
}
# options may be followed by one colon to indicate they have a required argument
if ! GETOPT=$(getopt -n "build.sh" -o hvp: -l help,verbose,platform: -- "$@")
then
usage
exit 1
fi
eval set -- "$GETOPT"
while true; do
case "$1" in
-h | --help ) usage; exit 0 ;;
-v | --verbose ) set -x ;;
-p | --platform ) CC_PLATFORM="$2" ; shift ;;
-- ) shift; break;;
* ) break;;
esac
shift
done
ARGS=$@
# component-specific vars
export FSROOT=${RDK_FSROOT_PATH}
export PLATFORM_SDK=$RDK_FSROOT_PATH
export NM=${RDK_TOOLCHAIN_PATH}/bin/mipsel-linux-nm
export RANLIB=${RDK_TOOLCHAIN_PATH}/bin/mipsel-linux-ranlib
export PATH="$PREFIX_FOLDER/bin:$PATH"
# functional modules
function configure()
{
echo "Executing configure common code"
true
}
function clean()
{
echo "Start Clean"
cd $RDK_SOURCE_PATH
make clean
}
function build()
{
cd ${RDK_SOURCE_PATH}
echo "Building ledmgr common code"
cd ${RDK_SOURCE_PATH}
make
install
}
function rebuild()
{
clean
configure
build
}
function install()
{
cd ${RDK_SOURCE_PATH}
cp ledmgrmain ledmgrmain_debug
$RDK_DUMP_SYMS ledmgrmain > ledmgrmain.sym
mv *.sym $PLATFORM_SYMBOL_PATH
echo "Debug symbol created for ledmgr"
if [ -f "libledmgr.so" ]; then
cp libledmgr.so ${RDK_FSROOT_PATH}/usr/lib
fi
if [ -f "ledtest" ]; then
cp ledtest ${RDK_FSROOT_PATH}/usr/bin
fi
if [ -f "ledmgrmain" ]; then
cp ledmgrmain ${RDK_FSROOT_PATH}/usr/bin
fi
}
# run the logic
#these args are what left untouched after parse_args
HIT=false
for i in "$@"; do
case $i in
configure) HIT=true; configure ;;
clean) HIT=true; clean ;;
build) HIT=true; build ;;
rebuild) HIT=true; rebuild ;;
install) HIT=true; install ;;
*)
#skip unknown
;;
esac
done
# if not HIT do build by default
if ! $HIT; then
build
fi