summaryrefslogtreecommitdiffstats
path: root/b2qt-init-build-env
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 /b2qt-init-build-env
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>
Diffstat (limited to 'b2qt-init-build-env')
-rwxr-xr-xb2qt-init-build-env181
1 files changed, 118 insertions, 63 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