-
Notifications
You must be signed in to change notification settings - Fork 5
/
compile.sh
executable file
·54 lines (40 loc) · 1.14 KB
/
compile.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
#!/bin/bash
TARGET_TYPE=$1
TARGET_PROFILE=$2
ACTION_STAGE=$3
if [ "$TARGET_TYPE" != "kernel" ] && [ "$TARGET_TYPE" != "uboot" ]; then
echo "error: invalid target type"
exit 1
fi
if [ ! -f "./$TARGET_TYPE/profiles/$TARGET_PROFILE" ]; then
echo "error: $TARGET_TYPE profile $TARGET_PROFILE not found"
exit 1
fi
OUTPUT_DIR=$PWD/work/results
mkdir -p $OUTPUT_DIR
set -ex
# load default config
. ./utils/default.sh
# load functions
. ./utils/functions.sh
# load target config
. ./$TARGET_TYPE/profiles/$TARGET_PROFILE
if [ "$ACTION_STAGE" != "compile" ]; then
# prepare stage
sudo apt update
exec_or_override ./utils/prep_install_gcc.sh
exec_or_override ./utils/prep_install_deps.sh
exec_or_override ./utils/prep_config.sh
fi
if [ "$ACTION_STAGE" != "prepare" ]; then
exec_or_override ./utils/compile_env.sh
exec_or_override ./utils/$TARGET_TYPE/clone.sh
WORKROOT=$PWD
pushd work/$TARGET_TYPE
exec_or_override $WORKROOT/utils/$TARGET_TYPE/patch.sh
exec_or_override $WORKROOT/utils/$TARGET_TYPE/config.sh
exec_or_override $WORKROOT/utils/$TARGET_TYPE/compile.sh
popd
exec_or_override ./utils/$TARGET_TYPE/cleanup.sh
tree $OUTPUT_DIR
fi