-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup_profile.sh
executable file
·79 lines (58 loc) · 1.5 KB
/
setup_profile.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
#!/bin/bash
set -euxo pipefail
SCRIPTDIR=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
LAYERS=""
setup_profile() {
(
PROFILE=$1
PROFILEFILE=${SCRIPTDIR}/profiles/$(basename ${PROFILE} .conf).conf
PROFILENAME=$(basename ${PROFILEFILE} .conf)
CMD=""
DISTRO="poky"
. ${PROFILEFILE}
set +u
. ${SCRIPTDIR}/src/poky/oe-init-build-env ${SCRIPTDIR}-build-${PROFILENAME}
set -u
cat >bbwrapper.conf <<EOF
# this file is generated by setup_profile.sh, changes to this file will be overwritten
${CONFIG:-}
MACHINE="${MACHINE}"
DISTRO="${DISTRO}"
EOF
cat >yoctoenv.sh <<EOF
#!/bin/bash
# this file is generated by setup_profile.sh, changes to this file will be overwritten
export MACHINE=${MACHINE}
export DISTRO=${DISTRO}
. ${SCRIPTDIR}/src/poky/oe-init-build-env ${SCRIPTDIR}-build-${PROFILENAME}
cd \$OLDPWD
set -x
exec "\$@"
EOF
chmod +x yoctoenv.sh
cat >bbwrapper.sh <<EOF
#!/bin/bash
# this file is generated by setup_profile.sh, changes to this file will be overwritten
. ${SCRIPTDIR}/src/poky/oe-init-build-env ${SCRIPTDIR}-build-${PROFILENAME}
cd \$OLDPWD
set -x
exec bitbake -r ${PWD}/bbwrapper.conf "\$@"
EOF
chmod +x bbwrapper.sh
if [[ ! -e "downloads" ]]; then
ln -sf $HOME/.yoctocache/downloads
fi
if [[ ! -e "sstate-cache" ]]; then
ln -sf $HOME/.yoctocache/sstate-cache
fi
#echo $LAYERS
#cd ${SCRIPTDIR}/src
#ls
#echo $LAYERS | xargs -n1 readlink -f
#exit
if [[ "$LAYERS" ]]; then
bitbake-layers add-layer --force $(cd ${SCRIPTDIR}/src; echo $LAYERS | xargs readlink -f)
fi
)
}
setup_profile test-genericx86-64.conf