summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@digia.com>2014-09-24 18:18:06 +0300
committerSamuli Piippo <samuli.piippo@digia.com>2014-09-26 11:41:53 +0300
commitc6c57bf35d79a111ffb60cc4912b93c06c1a1afe (patch)
tree96b7ccbec9ff0bb8a5d471abb692135a48fc1f60
parentd5bdc310ef22ebbe336d5b0f8cbd12aeff94be9b (diff)
downloadmeta-boot2qt-c6c57bf35d79a111ffb60cc4912b93c06c1a1afe.tar.gz
New initialization scripts
These initialization script will create a build environment which has only the needed meta layers from upstream. Other repos are ignored and not even downloaded. Google's repo tool is used to fetch upstream repos and it can then be used to manage the repos while developing. This has also support for using local mirror repos. The required repos are defined in the manifest.xml file, which can be overwritten using a machine specific manifest_<device>.xml file. Task-number: QTEE-760 Change-Id: I12ed9a6fddceb4de1217baaebf46277c6ef7224f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@digia.com>
-rwxr-xr-xb2qt-init-build-env181
-rw-r--r--conf/bblayers.conf.sample24
-rw-r--r--scripts/manifest.xml53
-rwxr-xr-xscripts/setup_environment.sh98
4 files changed, 281 insertions, 75 deletions
diff --git a/b2qt-init-build-env b/b2qt-init-build-env
index f1ad0bb..03c6439 100755
--- a/b2qt-init-build-env
+++ b/b2qt-init-build-env
@@ -24,92 +24,147 @@
24set -e 24set -e
25 25
26usage() { 26usage() {
27 echo "Usage: $0 <yocto build directory> [--force] [--reference <other 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"
28} 35}
29 36
30while test -n "$1"; do 37while test -n "$1"; do
31 case "$1" in 38 case "$1" in
32 "--help" | "-h") 39 "help" | "--help" | "-h")
33 usage 40 usage
34 exit 0 41 exit 0
35 ;; 42 ;;
36 "--force" | "-f")
37 FORCE_UPDATE=1
38 ;;
39 "--reference" | "-r") 43 "--reference" | "-r")
40 shift 44 shift
41 REFDIR=$1 45 REFERENCE=$1
46 ;;
47 "--device" | "-d")
48 shift
49 DEVICE=$1
42 ;; 50 ;;
43 *) 51 *)
44 BUILDDIR=$1 52 if [ -n "$COMMAND" ]; then
53 echo "Unknown argument: $1"
54 usage
55 exit 1
56 fi
57 COMMAND=$1
45 ;; 58 ;;
46 esac 59 esac
47 shift 60 shift
48done 61done
49 62
50if [ -z "${BUILDDIR}" ]; then 63if [ -z "${COMMAND}" ]; then
51 usage 64 usage
52 exit 1 65 exit 1
53fi 66fi
54 67
55DIR=$(readlink -f $(dirname $0)) 68DIR=$(readlink -f $(dirname $0))
56BUILDDIR=$(readlink -f $BUILDDIR) 69if [ -n "${REFERENCE}" ]; then
57if [ -n "${REFDIR}" ]; then 70 REFERENCE="--reference $(readlink -f ${REFERENCE})"
58 REFDIR=$(readlink -f ${REFDIR})
59fi 71fi
60 72
61checkout() { 73get_repo() {
62 REPO=$1 74 REPO="./repo"
63 REPODIR=${REPO##*/} 75 if [ -n "$(command -v repo)" ]; then
64 if [ ${REPODIR} != "poky" ]; then 76 REPO="repo"
65 REPODIR="poky/${REPODIR}" 77 elif [ ! -x "./repo" ]; then
66 fi 78 curl -s https://storage.googleapis.com/git-repo-downloads/repo > "./repo"
67 REF=${2%%:*} 79 chmod +x ./repo
68 SHA1=${2##*:} 80 fi
69 mkdir -p ${BUILDDIR}/${REPODIR}
70 cd ${BUILDDIR}/${REPODIR}
71 if [ ! -d ${BUILDDIR}/${REPODIR}/.git ]; then
72 echo "Checking out ${REPODIR}"
73 git init
74 if [ -n "${REFDIR}" ]; then
75 REPOREFDIR=${REFDIR}/${REPODIR}/.git/objects
76 if [ -d ${REPOREFDIR} ]; then
77 echo ${REPOREFDIR} > .git/objects/info/alternates
78 fi
79 fi
80 git remote add origin ${REPO} -f
81 git checkout ${REF}
82 git reset --hard ${SHA1}
83 elif [ -n "${FORCE_UPDATE}" ]; then
84 echo "Updating ${REPODIR}"
85 git fetch origin
86 git reset --hard ${SHA1}
87 fi
88} 81}
89 82
90checkout git://git.yoctoproject.org/poky "daisy:b2f045c400fa8bd20b319c60137b1575f967cef1" 83get_groups() {
91checkout git://git.yoctoproject.org/meta-fsl-arm "daisy:e9bf647e10ff1e31f911d3236dbb22a1ad7ace9f" 84 case ${DEVICE} in
92checkout git://github.com/Freescale/meta-fsl-arm-extra "daisy:e041d9a118c5eecf4010bcb41bb5c554636090ab" 85 apalis-imx6)
93checkout git://github.com/beagleboard/meta-beagleboard "master:b5c709b2b6bd3bf236df923fa8f245a00fbb1b60" 86 GROUPS="toradex"
94checkout git://git.yoctoproject.org/meta-ti "daisy:41457c50e21168faf04f3cdd4168954890d6cdab" 87 ;;
95checkout git://git.yoctoproject.org/meta-raspberrypi "daisy:946b69299737cc2f1378c864f1b9075280db1b53" 88 imx53qsb|imx6qsabresd|nitrogen6x)
96checkout git://git.toradex.com/meta-toradex "V2.2:b47dad6cf9bd5be5287dac3835ea037a2fd30cf7" 89 GROUPS="fsl"
97checkout git://git.openembedded.org/meta-openembedded "daisy:662cf409c1175450699d498085f3c894e0fe81d0" 90 ;;
98 91 beagleboard|am335x-evm)
99if [ ! -d ${BUILDDIR}/poky/meta-b2qt ]; then 92 GROUPS="ti"
100 ln -s ${DIR} ${BUILDDIR}/poky/meta-b2qt 93 ;;
101fi 94 beaglebone)
95 GROUPS="bbb"
96 ;;
97 raspberrypi)
98 GROUPS="rpi"
99 ;;
100 emulator)
101 GROUPS="emulator"
102 ;;
103 *)
104 echo "Unknown device configuration, no matching repo group defined"
105 exit 1
106 ;;
107 esac
108
109 GROUPS="${GROUPS} default"
110}
111
112list_devices() {
113 echo "Available device configurations:"
114 for device in $(ls $DIR/conf/distro/include/*.conf); do
115 echo " $(basename ${device%%.*})"
116 done
117}
118
119mirror() {
120 mkdir -p .repo/manifests
121 cp ${DIR}/scripts/manifest.xml .repo/manifests/
122 MANIFEST="manifest.xml"
123 ${REPO} init -u https://gerrit.googlesource.com/git-repo -m ${MANIFEST} -g all --mirror
124 ${REPO} sync
125}
102 126
103echo 127init() {
104echo "Yocto build system is ready" 128 if [ -z "${DEVICE}" ]; then
105echo "next initialize the build env for your target machine, for example:" 129 echo "device not defined"
106echo 130 usage
107echo "cd ${BUILDDIR}" 131 exit 1
108echo "export TEMPLATECONF=meta-b2qt/conf" 132 fi
109echo "export MACHINE=raspberrypi" 133
110echo ". ./poky/oe-init-build-env build-raspberrypi" 134 get_groups
111echo 135 mkdir -p .repo/manifests
112echo "and build B2Qt image with:" 136 cp ${DIR}/scripts/manifest*.xml .repo/manifests
113echo 137 if [ -f .repo/manifests/manifest_${DEVICE}.xml ]; then
114echo "bitbake b2qt-embedded-image" 138 MANIFEST="manifest_${DEVICE}.xml"
115echo 139 else
140 MANIFEST="manifest.xml"
141 fi
142 ${REPO} init -u https://gerrit.googlesource.com/git-repo -m ${MANIFEST} -g "${GROUPS}" ${REFERENCE}
143 ${REPO} sync
144
145 if [ ! -e "sources/meta-b2qt" ]; then
146 ln -s ${DIR} sources/meta-b2qt
147 fi
148
149 cp ${DIR}/scripts/setup_environment.sh .
150
151}
152
153get_repo
154
155case "$COMMAND" in
156 "init")
157 init
158 ;;
159 "mirror")
160 mirror
161 ;;
162 "list-devices")
163 list_devices
164 ;;
165 *)
166 echo "Unknown command"
167 usage
168 exit 1
169 ;;
170esac
diff --git a/conf/bblayers.conf.sample b/conf/bblayers.conf.sample
index 46e69d8..3636297 100644
--- a/conf/bblayers.conf.sample
+++ b/conf/bblayers.conf.sample
@@ -30,18 +30,18 @@ BBFILES ?= ""
30BBLAYERS ?= " \ 30BBLAYERS ?= " \
31 ##COREBASE##/meta \ 31 ##COREBASE##/meta \
32 ##COREBASE##/meta-yocto \ 32 ##COREBASE##/meta-yocto \
33 ##COREBASE##/meta-fsl-arm \ 33 ##COREBASE##/../meta-fsl-arm \
34 ##COREBASE##/meta-fsl-arm-extra \ 34 ##COREBASE##/../meta-fsl-arm-extra \
35 ##COREBASE##/meta-beagleboard/common-bsp \ 35 ##COREBASE##/../meta-beagleboard/common-bsp \
36 ##COREBASE##/meta-ti \ 36 ##COREBASE##/../meta-ti \
37 ##COREBASE##/meta-raspberrypi \ 37 ##COREBASE##/../meta-raspberrypi \
38 ##COREBASE##/meta-toradex \ 38 ##COREBASE##/../meta-toradex \
39 ##COREBASE##/meta-openembedded/meta-oe \ 39 ##COREBASE##/../meta-openembedded/meta-oe \
40 ##COREBASE##/meta-b2qt \ 40 ##COREBASE##/../meta-b2qt \
41 ##COREBASE##/meta-b2qt/meta-ti-extras \ 41 ##COREBASE##/../meta-b2qt/meta-ti-extras \
42 ##COREBASE##/meta-b2qt/meta-fsl-extras \ 42 ##COREBASE##/../meta-b2qt/meta-fsl-extras \
43 ##COREBASE##/meta-b2qt/meta-beagleboard-extras \ 43 ##COREBASE##/../meta-b2qt/meta-beagleboard-extras \
44 ##COREBASE##/meta-b2qt/meta-toradex-extras \ 44 ##COREBASE##/../meta-b2qt/meta-toradex-extras \
45 " 45 "
46BBLAYERS_NON_REMOVABLE ?= " \ 46BBLAYERS_NON_REMOVABLE ?= " \
47 ##COREBASE##/meta \ 47 ##COREBASE##/meta \
diff --git a/scripts/manifest.xml b/scripts/manifest.xml
new file mode 100644
index 0000000..8f93116
--- /dev/null
+++ b/scripts/manifest.xml
@@ -0,0 +1,53 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<manifest>
3
4 <default sync-j="4" revision="daisy"/>
5
6 <remote fetch="git://git.yoctoproject.org" name="yocto"/>
7 <remote fetch="git://git.openembedded.org" name="oe"/>
8 <remote fetch="git://github.com/Freescale" name="freescale"/>
9 <remote fetch="git://github.com/beagleboard" name="beagleboard"/>
10 <remote fetch="git://git.toradex.com" name="toradex"/>
11
12 <project name="poky"
13 remote="yocto"
14 revision="b2f045c400fa8bd20b319c60137b1575f967cef1"
15 path="sources/poky"/>
16 <project name="meta-openembedded"
17 remote="oe"
18 revision="662cf409c1175450699d498085f3c894e0fe81d0"
19 path="sources/meta-openembedded"/>
20
21 <project name="meta-fsl-arm"
22 remote="yocto"
23 revision="e9bf647e10ff1e31f911d3236dbb22a1ad7ace9f"
24 path="sources/meta-fsl-arm"
25 groups="notdefault,fsl,toradex"/>
26 <project name="meta-ti"
27 remote="yocto"
28 revision="41457c50e21168faf04f3cdd4168954890d6cdab"
29 path="sources/meta-ti"
30 groups="notdefault,ti,bbb"/>
31 <project name="meta-raspberrypi"
32 remote="yocto"
33 revision="946b69299737cc2f1378c864f1b9075280db1b53"
34 path="sources/meta-raspberrypi"
35 groups="notdefault,rpi"/>
36 <project name="meta-fsl-arm-extra"
37 remote="freescale"
38 revision="e041d9a118c5eecf4010bcb41bb5c554636090ab"
39 path="sources/meta-fsl-arm-extra"
40 groups="notdefault,fsl,toradex"/>
41 <project name="meta-beagleboard"
42 remote="beagleboard"
43 revision="b5c709b2b6bd3bf236df923fa8f245a00fbb1b60"
44 path="sources/meta-beagleboard"
45 groups="notdefault,bbb"/>
46 <project name="meta-toradex"
47 remote="toradex"
48 revision="b47dad6cf9bd5be5287dac3835ea037a2fd30cf7"
49 path="sources/meta-toradex"
50 groups="notdefault,toradex"/>
51
52</manifest>
53
diff --git a/scripts/setup_environment.sh b/scripts/setup_environment.sh
new file mode 100755
index 0000000..63f59cf
--- /dev/null
+++ b/scripts/setup_environment.sh
@@ -0,0 +1,98 @@
1#!/bin/sh
2#############################################################################
3##
4## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
5##
6## This file is part of the Qt Enterprise Embedded Scripts of the Qt
7## framework.
8##
9## $QT_BEGIN_LICENSE$
10## Commercial License Usage Only
11## Licensees holding valid commercial Qt license agreements with Digia
12## with an appropriate addendum covering the Qt Enterprise Embedded Scripts,
13## may use this file in accordance with the terms contained in said license
14## agreement.
15##
16## For further information use the contact form at
17## http://qt.digia.com/contact-us.
18##
19##
20## $QT_END_LICENSE$
21##
22#############################################################################
23
24usage() {
25 echo "source setup-environment <build-dir>"
26}
27
28clean() {
29 unset BUILDDIR
30 unset NEWBUILD
31 unset TEMPLATECONF
32}
33
34CWD=`pwd`
35
36while test -n "$1"; do
37 case "$1" in
38 "--help" | "-h")
39 usage
40 return 0
41 ;;
42 *)
43 BUILDDIR=$1
44 ;;
45 esac
46 shift
47done
48
49if [ -z "${BUILDDIR}" ]; then
50 usage
51 return 1
52fi
53
54if [ -z "$MACHINE" ]; then
55 echo "MACHINE environment variable not defined"
56 clean
57 return 1
58fi
59
60if [ ! -d ${CWD}/${BUILDDIR} ]; then
61 NEWBUILD=1
62fi
63
64export TEMPLATECONF=${CWD}/sources/meta-b2qt/conf
65cd sources/poky
66. ./oe-init-build-env ${CWD}/${BUILDDIR}
67
68if [ -n "${NEWBUILD}" ]; then
69 case ${MACHINE} in
70 apalis-imx6)
71 LAYERS="meta-raspberrypi meta-beagleboard meta-ti"
72 ;;
73 imx53qsb|imx6qsabresd|nitrogen6x)
74 LAYERS="meta-raspberrypi meta-beagleboard meta-toradex meta-ti"
75 ;;
76 beagleboard|am335x-evm)
77 LAYERS="meta-raspberrypi meta-beagleboard meta-toradex meta-fsl"
78 ;;
79 beaglebone)
80 LAYERS="meta-raspberrypi meta-toradex meta-fsl"
81 ;;
82 raspberrypi)
83 LAYERS="meta-beagleboard meta-toradex meta-ti meta-fsl"
84 ;;
85 emulator)
86 LAYERS="meta-raspberrypi meta-beagleboard meta-toradex meta-ti meta-fsl"
87 ;;
88 *)
89 echo "Unknown MACHINE, bblayer.conf might need manual editing"
90 ;;
91 esac
92
93 for layer in ${LAYERS}; do
94 sed -i -e "/${layer}/d" conf/bblayers.conf
95 done
96fi
97
98clean