This repository has been archived by the owner on Oct 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathinit.sh
139 lines (118 loc) · 4.59 KB
/
init.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
# Note that this script is supposed to be sourced,
# and only works with bash or zsh, not a vanilla bourne shell
if [ -z "$BASH_VERSION" -a -z "$ZSH_VERSION" ] ; then
echo This script only works with bash or zsh as the interactive shell.
echo Please retry with bash or zsh.
return 1
fi
function setupGitSubmodules() {
local choice=$1
if [[ $2 == "accept-eula" ]] ; then
local eula=true
fi
echo "You selected target $choice"
local targets=(
"dragonboard-410c"
"minnowboard"
"qemux86-64"
"r-car-m3-starter-kit"
"r-car-h3-starter-kit"
"r-car-m3-salvator-x"
"r-car-h3-salvator-x"
"raspberrypi2"
"raspberrypi3"
)
local supported=(
"minnowboard"
"qemux86-64"
"r-car-m3-starter-kit"
"r-car-h3-starter-kit"
"r-car-m3-salvator-x"
"r-car-h3-salvator-x"
"raspberrypi2"
"raspberrypi3")
local modules=()
local target=""
for i in ${targets[@]}
do
if [[ $i == $choice ]]
then
target=$choice
echo "$target is a valid target"
break
fi
done
if test -z "$target" ; then
echo "An invalid or empty target name was given: $choice Available targets are:"
printf '%s\n' "${targets[@]}"
echo -e "\nUsage: source init.sh <target> [accept-eula] [-f]"
return 1
else
if [[ ! ${supported[@]} =~ "$target" ]] && [[ ${!#} != "-f" ]]; then
echo "However currently, only the following targets are officially supported:"
printf '%s\n' "${supported[@]}"
echo "You can try to run it anyway by adding -f flag, or use a supported target"
echo "or check if your hardware was fully supported on an earlier release:"
echo " git checkout origin/gdp-<version> and then re-run"
echo " source init.sh $machine"
return 1
fi
fi
if [[ "$target" == "dragonboard-410c" ]] && test -z "$eula" ; then
echo "Building GDP for DragonBoard 410c requires Qualcomm EULA acceptance."
echo "See http://git.yoctoproject.org/cgit/cgit.cgi/meta-qcom/tree/conf/EULA for details."
echo "Please re-run init.sh with additional 'accept-eula' argument"
return 1
fi
echo "Generating bitbake configuration files for $target"
cp gdp-src-build/conf/templates/${target}.local.conf gdp-src-build/conf/local.conf
cp gdp-src-build/conf/templates/${target}.bblayers.conf gdp-src-build/conf/bblayers.conf
# Accept EULA in local.conf
if [[ $target == "dragonboard-410c" ]] ; then
echo "ACCEPT_EULA_dragonboard-410c = "'"1"'"" >> gdp-src-build/conf/local.conf
fi
echo "Local & bblayers conf set for $target"
# Define hardware-dependent layers.
# Multiple layers can be specified for a target if space-separated.
declare -A bsparr
bsparr["qemux86-64"]=""
bsparr["minnowboard"]="meta-intel"
bsparr["raspberrypi2"]="meta-raspberrypi"
bsparr["raspberrypi3"]="meta-raspberrypi"
bsparr["dragonboard-410c"]="meta-qcom"
bsparr["r-car-m3-starter-kit"]="meta-linaro meta-renesas meta-ivi-renesas"
bsparr["r-car-h3-starter-kit"]="meta-linaro meta-renesas meta-ivi-renesas"
bsparr["r-car-m3-salvator-x"]="meta-linaro meta-renesas meta-ivi-renesas"
bsparr["r-car-h3-salvator-x"]="meta-linaro meta-renesas meta-ivi-renesas"
# This looks somewhat complex but the intention is to clone only needed
# submodules. The module list is calculated as : all the submodules we
# have (as reported by git) *minus* BSP-related layers that are NOT
# relevant for the chosen $target. In other words - loop through all BSP
# layers and delete them from array unless they are the layer (or layers)
# defined for this $target.
modules=($(git submodule | awk '{ print $2 }'))
for i in ${bsparr[@]}; do
local found=false
# Multiple BSP layers per target are supported so loop over them just in case
for bsp in ${bsparr[${target}]} ; do
if [[ $i == $bsp ]] ; then
found=true
fi
done
if ! $found ; then
# This BSP is not for the $target, so delete it from the list
modules=(${modules[@]//*$i*})
fi
done
git submodule init "${modules[@]}"
git submodule sync "${modules[@]}"
git submodule update "${modules[@]}"
return 0
}
if setupGitSubmodules $1 $2 $3 ; then
source poky/oe-init-build-env gdp-src-build
echo
echo "Now run: bitbake genivi-dev-platform"
else
return 1
fi