diff options
Diffstat (limited to 'b2qt-init-build-env')
-rwxr-xr-x | b2qt-init-build-env | 181 |
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 @@ | |||
24 | set -e | 24 | set -e |
25 | 25 | ||
26 | usage() { | 26 | usage() { |
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 | ||
30 | while test -n "$1"; do | 37 | while 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 |
48 | done | 61 | done |
49 | 62 | ||
50 | if [ -z "${BUILDDIR}" ]; then | 63 | if [ -z "${COMMAND}" ]; then |
51 | usage | 64 | usage |
52 | exit 1 | 65 | exit 1 |
53 | fi | 66 | fi |
54 | 67 | ||
55 | DIR=$(readlink -f $(dirname $0)) | 68 | DIR=$(readlink -f $(dirname $0)) |
56 | BUILDDIR=$(readlink -f $BUILDDIR) | 69 | if [ -n "${REFERENCE}" ]; then |
57 | if [ -n "${REFDIR}" ]; then | 70 | REFERENCE="--reference $(readlink -f ${REFERENCE})" |
58 | REFDIR=$(readlink -f ${REFDIR}) | ||
59 | fi | 71 | fi |
60 | 72 | ||
61 | checkout() { | 73 | get_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 | ||
90 | checkout git://git.yoctoproject.org/poky "daisy:b2f045c400fa8bd20b319c60137b1575f967cef1" | 83 | get_groups() { |
91 | checkout git://git.yoctoproject.org/meta-fsl-arm "daisy:e9bf647e10ff1e31f911d3236dbb22a1ad7ace9f" | 84 | case ${DEVICE} in |
92 | checkout git://github.com/Freescale/meta-fsl-arm-extra "daisy:e041d9a118c5eecf4010bcb41bb5c554636090ab" | 85 | apalis-imx6) |
93 | checkout git://github.com/beagleboard/meta-beagleboard "master:b5c709b2b6bd3bf236df923fa8f245a00fbb1b60" | 86 | GROUPS="toradex" |
94 | checkout git://git.yoctoproject.org/meta-ti "daisy:41457c50e21168faf04f3cdd4168954890d6cdab" | 87 | ;; |
95 | checkout git://git.yoctoproject.org/meta-raspberrypi "daisy:946b69299737cc2f1378c864f1b9075280db1b53" | 88 | imx53qsb|imx6qsabresd|nitrogen6x) |
96 | checkout git://git.toradex.com/meta-toradex "V2.2:b47dad6cf9bd5be5287dac3835ea037a2fd30cf7" | 89 | GROUPS="fsl" |
97 | checkout git://git.openembedded.org/meta-openembedded "daisy:662cf409c1175450699d498085f3c894e0fe81d0" | 90 | ;; |
98 | 91 | beagleboard|am335x-evm) | |
99 | if [ ! -d ${BUILDDIR}/poky/meta-b2qt ]; then | 92 | GROUPS="ti" |
100 | ln -s ${DIR} ${BUILDDIR}/poky/meta-b2qt | 93 | ;; |
101 | fi | 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 | |||
112 | list_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 | |||
119 | mirror() { | ||
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 | ||
103 | echo | 127 | init() { |
104 | echo "Yocto build system is ready" | 128 | if [ -z "${DEVICE}" ]; then |
105 | echo "next initialize the build env for your target machine, for example:" | 129 | echo "device not defined" |
106 | echo | 130 | usage |
107 | echo "cd ${BUILDDIR}" | 131 | exit 1 |
108 | echo "export TEMPLATECONF=meta-b2qt/conf" | 132 | fi |
109 | echo "export MACHINE=raspberrypi" | 133 | |
110 | echo ". ./poky/oe-init-build-env build-raspberrypi" | 134 | get_groups |
111 | echo | 135 | mkdir -p .repo/manifests |
112 | echo "and build B2Qt image with:" | 136 | cp ${DIR}/scripts/manifest*.xml .repo/manifests |
113 | echo | 137 | if [ -f .repo/manifests/manifest_${DEVICE}.xml ]; then |
114 | echo "bitbake b2qt-embedded-image" | 138 | MANIFEST="manifest_${DEVICE}.xml" |
115 | echo | 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 | |||
153 | get_repo | ||
154 | |||
155 | case "$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 | ;; | ||
170 | esac | ||