-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathedge-setup-release.sh
executable file
·230 lines (196 loc) · 7.12 KB
/
edge-setup-release.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
#!/bin/sh
#
# i.MX Yocto Project Build Environment Setup Script
#
# Copyright (C) 2011-2016 Freescale Semiconductor
# Copyright 2017 NXP
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
. sources/meta-imx/tools/setup-utils.sh
CWD=`pwd`
PROGNAME="setup-environment"
exit_message ()
{
echo "To return to this build environment later please run:"
echo " source setup-environment <build_dir>"
}
usage()
{
echo -e "\nUsage: source imx-setup-release.sh
Optional parameters: [-b build-dir] [-h]"
echo "
* [-b build-dir]: Build directory, if unspecified script uses 'build' as output directory
* [-h]: help
"
}
clean_up()
{
unset CWD BUILD_DIR FSLDISTRO
unset fsl_setup_help fsl_setup_error fsl_setup_flag
unset usage clean_up
unset ARM_DIR META_FSL_BSP_RELEASE
exit_message clean_up
}
# get command line options
OLD_OPTIND=$OPTIND
unset FSLDISTRO
while getopts "k:r:t:b:e:gh" fsl_setup_flag
do
case $fsl_setup_flag in
b) BUILD_DIR="$OPTARG";
echo -e "\n Build directory is " $BUILD_DIR
;;
h) fsl_setup_help='true';
;;
\?) fsl_setup_error='true';
;;
esac
done
shift $((OPTIND-1))
if [ $# -ne 0 ]; then
fsl_setup_error=true
echo -e "Invalid command line ending: '$@'"
fi
OPTIND=$OLD_OPTIND
if test $fsl_setup_help; then
usage && clean_up && return 1
elif test $fsl_setup_error; then
clean_up && return 1
fi
if [ -z "$DISTRO" ]; then
if [ -z "$FSLDISTRO" ]; then
FSLDISTRO='fsl-imx-xwayland'
fi
else
FSLDISTRO="$DISTRO"
fi
if [ -z "$BUILD_DIR" ]; then
BUILD_DIR='build'
fi
if [ -z "$MACHINE" ]; then
echo setting to default machine
MACHINE='imx6qpsabresd'
fi
case $MACHINE in
imx8*)
case $DISTRO in
*wayland)
: ok
;;
*)
echo -e "\n ERROR - Only Wayland distros are supported for i.MX 8 or i.MX 8M"
echo -e "\n"
return 1
;;
esac
;;
*)
: ok
;;
esac
# Cleanup previous meta-freescale/EULA overrides
cd $CWD/sources/meta-freescale
if [ -h EULA ]; then
echo Cleanup meta-freescale/EULA...
git checkout -- EULA
fi
if [ ! -f classes/fsl-eula-unpack.bbclass ]; then
echo Cleanup meta-freescale/classes/fsl-eula-unpack.bbclass...
git checkout -- classes/fsl-eula-unpack.bbclass
fi
cd -
# Override the click-through in meta-freescale/EULA
FSL_EULA_FILE=$CWD/sources/meta-imx/EULA.txt
# Set up the basic yocto environment
if [ -z "$DISTRO" ]; then
DISTRO=$FSLDISTRO MACHINE=$MACHINE . ./$PROGNAME $BUILD_DIR
else
MACHINE=$MACHINE . ./$PROGNAME $BUILD_DIR
fi
# Point to the current directory since the last command changed the directory to $BUILD_DIR
BUILD_DIR=.
if [ ! -e $BUILD_DIR/conf/local.conf ]; then
echo -e "\n ERROR - No build directory is set yet. Run the 'setup-environment' script before running this script to create " $BUILD_DIR
echo -e "\n"
return 1
fi
# On the first script run, backup the local.conf file
# Consecutive runs, it restores the backup and changes are appended on this one.
if [ ! -e $BUILD_DIR/conf/local.conf.org ]; then
cp $BUILD_DIR/conf/local.conf $BUILD_DIR/conf/local.conf.org
else
cp $BUILD_DIR/conf/local.conf.org $BUILD_DIR/conf/local.conf
fi
echo >> conf/local.conf
# Mecha config changes
echo "MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT = \"0\" " >> conf/local.conf
echo "PACKAGECONFIG:append:pn-mesa = \" etnaviv\" " >> conf/local.conf
echo "PACKAGECONFIG:append:pn-libdrm = \" etnaviv\" " >> conf/local.conf
echo "PARALLEL_MAKE = \"-j 25\"" >> conf/local.conf
echo "BB_NUMBER_THREADS = \"25\"" >> conf/local.conf
echo "LICENSE_FLAGS_ACCEPTED=\"commercial\" " >> conf/local.conf
echo "# Switch to Debian packaging and include package-management in the image" >> conf/local.conf
echo "PACKAGE_CLASSES = \"package_deb\"" >> conf/local.conf
echo "DDRSIZE = \"1\"" >> conf/local.conf
# if [ "$LPDDR_VER" = "4gb" ] || [ "$LPDDR_VER" = "4GB" ]; then
# echo "DDRSIZE = \"1\"" >> conf/local.conf
# else
# echo "DDRSIZE = \"0\"" >> conf/local.conf
# fi
if [ ! -e $BUILD_DIR/conf/bblayers.conf.org ]; then
cp $BUILD_DIR/conf/bblayers.conf $BUILD_DIR/conf/bblayers.conf.org
else
cp $BUILD_DIR/conf/bblayers.conf.org $BUILD_DIR/conf/bblayers.conf
fi
META_FSL_BSP_RELEASE="${CWD}/sources/meta-imx/meta-bsp"
echo "" >> $BUILD_DIR/conf/bblayers.conf
echo "# i.MX Yocto Project Release layers" >> $BUILD_DIR/conf/bblayers.conf
hook_in_layer meta-imx/meta-bsp
hook_in_layer meta-imx/meta-sdk
#hook_in_layer meta-imx/meta-ml
#hook_in_layer meta-imx/meta-v2x
# ADD space
echo "" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \"\${BSPDIR}/sources/meta-openembedded/meta-gnome\"" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \"\${BSPDIR}/sources/meta-openembedded/meta-networking\"" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \"\${BSPDIR}/sources/meta-openembedded/meta-filesystems\"" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \"\${BSPDIR}/sources/meta-openembedded/meta-perl\"" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \"\${BSPDIR}/sources/meta-openembedded/meta-xfce\"" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \"\${BSPDIR}/sources/meta-openembedded/meta-initramfs\"" >> $BUILD_DIR/conf/bblayers.conf
echo "" >> $BUILD_DIR/conf/bblayers.conf
# Adding Mecha layers
echo "BBLAYERS += \"\${BSPDIR}/sources/meta-mecha-imx\"" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \"\${BSPDIR}/sources/meta-mecha\"" >> $BUILD_DIR/conf/bblayers.conf
echo "" >> $BUILD_DIR/conf/bblayers.conf
# Enable docker for mx8 machines
echo "BBLAYERS += \"\${BSPDIR}/sources/meta-virtualization\"" >> conf/bblayers.conf
echo "BBLAYERS += \"\${BSPDIR}/sources/meta-rust\"" >> conf/bblayers.conf
echo "BBLAYERS += \"\${BSPDIR}/sources/meta-clang\"" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \"\${BSPDIR}/sources/meta-webkit\"" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += \"\${BSPDIR}/sources/meta-browser/meta-chromium\"" >> $BUILD_DIR/conf/bblayers.conf
echo "#BBLAYERS += \"\${BSPDIR}/sources/meta-qt6\"" >> $BUILD_DIR/conf/bblayers.conf
echo "#BBLAYERS += \"\${BSPDIR}/sources/meta-rauc\"" >> $BUILD_DIR/conf/bblayers.conf
echo BSPDIR=$BSPDIR
echo BUILD_DIR=$BUILD_DIR
# Support integrating community meta-freescale instead of meta-fsl-arm
if [ -d ../sources/meta-freescale ]; then
echo meta-freescale directory found
# Change settings according to environment
sed -e "s,meta-fsl-arm\s,meta-freescale ,g" -i conf/bblayers.conf
sed -e "s,\$.BSPDIR./sources/meta-fsl-arm-extra\s,,g" -i conf/bblayers.conf
fi
cd $BUILD_DIR
clean_up
unset FSLDISTRO