summaryrefslogtreecommitdiffstats
path: root/b2qt-init-build-env
diff options
context:
space:
mode:
Diffstat (limited to 'b2qt-init-build-env')
-rwxr-xr-xb2qt-init-build-env196
1 files changed, 153 insertions, 43 deletions
diff --git a/b2qt-init-build-env b/b2qt-init-build-env
index 76e2b7c..ddc12d3 100755
--- a/b2qt-init-build-env
+++ b/b2qt-init-build-env
@@ -23,57 +23,167 @@
23 23
24set -e 24set -e
25 25
26if [ $# -ne 1 ]; then 26usage() {
27 echo "Usage: $0 <yocto build directory>" 27 echo "Usage: $(basename $0) COMMAND [ARGS]"
28 echo
29 echo "Initialize build environment:"
30 echo " $(basename $0) init --device <name> [--reference <mirror path>]"
31 echo "Initialize local mirror:"
32 echo " $(basename $0) mirror"
33 echo "List available devices:"
34 echo " $(basename $0) list-devices"
35}
36
37while test -n "$1"; do
38 case "$1" in
39 "help" | "--help" | "-h")
40 usage
41 exit 0
42 ;;
43 "--reference" | "-r")
44 shift
45 REFERENCE=$1
46 ;;
47 "--device" | "-d")
48 shift
49 DEVICE=$1
50 ;;
51 *)
52 if [ -n "$COMMAND" ]; then
53 echo "Unknown argument: $1"
54 usage
55 exit 1
56 fi
57 COMMAND=$1
58 ;;
59 esac
60 shift
61done
62
63if [ -z "${COMMAND}" ]; then
64 usage
28 exit 1 65 exit 1
29fi 66fi
30 67
31mkdir -p ${1}
32
33DIR=$(readlink -f $(dirname $0)) 68DIR=$(readlink -f $(dirname $0))
34BUILDDIR=$(readlink -f $1) 69if [ -n "${REFERENCE}" ]; then
70 REFERENCE="--reference $(readlink -f ${REFERENCE})"
71fi
72
73get_repo() {
74 REPO="./repo"
75 if [ -n "$(command -v repo)" ]; then
76 REPO="repo"
77 elif [ ! -x "./repo" ]; then
78 curl -s https://storage.googleapis.com/git-repo-downloads/repo > "./repo"
79 chmod +x ./repo
80 fi
81}
82
83get_groups() {
84 case ${DEVICE} in
85 apalis-imx6|colibri-vf)
86 PROJECT_GROUPS="toradex"
87 ;;
88 imx53qsb|imx6qsabresd|nitrogen6x)
89 PROJECT_GROUPS="fsl"
90 ;;
91 tibidabo)
92 PROJECT_GROUPS="architech"
93 ;;
94 beagleboard|am335x-evm)
95 PROJECT_GROUPS="ti"
96 ;;
97 beaglebone)
98 PROJECT_GROUPS="bbb"
99 ;;
100 raspberrypi)
101 PROJECT_GROUPS="rpi"
102 ;;
103 emulator)
104 PROJECT_GROUPS="emulator"
105 ;;
106 *)
107 echo "Unknown device configuration, including all meta layers"
108 PROJECT_GROUPS="all"
109 ;;
110 esac
111
112 PROJECT_GROUPS="${PROJECT_GROUPS} default"
113}
114
115list_devices() {
116 echo "Available device configurations:"
117 for device in $(ls $DIR/conf/distro/include/*.conf); do
118 echo " $(basename ${device%%.*})"
119 done
120}
35 121
36checkout() { 122mirror() {
37 REPO=$1 123 mkdir -p .repo/manifests
38 REPODIR=${REPO##*/} 124 cp ${DIR}/scripts/manifest.xml .repo/manifests/
39 if [ ${REPODIR} != "poky" ]; then 125 MANIFEST="manifest.xml"
40 REPODIR="poky/${REPODIR}" 126 ${REPO} init -u ${PWD}/.repo/repo -b default -m ${MANIFEST} -g all --mirror
127 ${REPO} sync
128}
129
130patch_poky() {
131 cd sources/poky
132 found=$(git rev-list --grep="bitbake: cooker: add support for using % as a wildcard in bbappend filename" HEAD)
133 if [ -z "$found" ]; then
134 git cherry-pick 381d5920188398bc53b2454843054c8690bca243 > /dev/null
41 fi 135 fi
42 REF=${2%%:*} 136
43 SHA1=${2##*:} 137 found=$(git rev-list --grep="bitbake: cooker: Fix support for wildcards in bbappend filenames" HEAD)
44 if [ ! -d ${BUILDDIR}/${REPODIR} ]; then 138 if [ -z "$found" ]; then
45 mkdir ${BUILDDIR}/${REPODIR} 139 git cherry-pick f91a3f46a1ee586e330be0868e8fbc4d2e78d361 > /dev/null
46 cd ${BUILDDIR}/${REPODIR}
47 git init
48 git remote add origin ${REPO} -f
49 git checkout ${REF}
50 git reset --hard ${SHA1}
51 cd -
52 fi 140 fi
141 cd -
53} 142}
54 143
55checkout git://git.yoctoproject.org/poky "daisy:b0ce70ffa820c8b4069bdb413f7aa9db668b9428" 144init() {
56checkout git://git.yoctoproject.org/meta-fsl-arm "daisy:f5bf277a5a5fba2c3b64ed7d2dbec1903d96386b" 145 if [ -z "${DEVICE}" ]; then
57checkout git://github.com/Freescale/meta-fsl-arm-extra "daisy:456c27085a70bb1385a4c2e28ba80ac74d6f533e" 146 echo "device not defined"
58checkout git://git.yoctoproject.org/meta-ti "daisy:5dad1bc02dd922a6c4fa4d68f6ea9ec779cf5e66" 147 usage
59checkout git://git.yoctoproject.org/meta-raspberrypi "daisy:cc74bf6c1f9ab9beea52c4c75797f3ad51f72c55" 148 exit 1
60checkout git://git.toradex.com/meta-toradex "V2.2:371ea626f29a2a12294ab6ea30e36743a9e2f78f" 149 fi
61checkout git://git.openembedded.org/meta-openembedded "daisy:a6dcf6265822ca1484d991d10a3042e04a960cdb"
62 150
63if [ ! -d ${BUILDDIR}/poky/meta-b2qt ]; then 151 get_groups
64 ln -s ${DIR} ${BUILDDIR}/poky/meta-b2qt 152 mkdir -p .repo/manifests
65fi 153 cp ${DIR}/scripts/manifest*.xml .repo/manifests
154 if [ -f .repo/manifests/manifest_${DEVICE}.xml ]; then
155 MANIFEST="manifest_${DEVICE}.xml"
156 else
157 MANIFEST="manifest.xml"
158 fi
159 ${REPO} init -u ${PWD}/.repo/repo -b default -m ${MANIFEST} -g "${PROJECT_GROUPS}" ${REFERENCE}
160 ${REPO} sync
161
162 patch_poky
66 163
67echo 164 if [ ! -e "sources/meta-b2qt" ]; then
68echo "Yocto build system is ready" 165 ln -s ${DIR} sources/meta-b2qt
69echo "next initialize the build env for your target machine, for example:" 166 fi
70echo 167
71echo "cd ${BUILDDIR}" 168 cp ${DIR}/scripts/setup-environment.sh .
72echo "export TEMPLATECONF=meta-b2qt/conf" 169
73echo "export MACHINE=raspberrypi" 170}
74echo ". ./poky/oe-init-build-env build-raspberrypi" 171
75echo 172get_repo
76echo "and build B2Qt image with:" 173
77echo 174case "$COMMAND" in
78echo "bitbake b2qt-embedded-image" 175 "init")
79echo 176 init
177 ;;
178 "mirror")
179 mirror
180 ;;
181 "list-devices")
182 list_devices
183 ;;
184 *)
185 echo "Unknown command"
186 usage
187 exit 1
188 ;;
189esac