This repository has been archived by the owner on Dec 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
freedesktop-sdk-build-yocto
executable file
·109 lines (93 loc) · 3.23 KB
/
freedesktop-sdk-build-yocto
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# Copyright (C) 2015 Alexander Larsson <[email protected]>
# Copyright (C) 2012 Colin Walters <[email protected]>
# Copyright (C) 2012 Adrian Perez <[email protected]>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
set -e
umask 022
die () {
echo "$*" 1>&2
exit 1
}
usage () {
echo "$0: SRCDIR WORKDIR ARCHITECTURE"
}
srcdir=$1
test -n "${srcdir}" || (usage; exit 1)
workdir=$2
test -n "${workdir}" || (usage; exit 1)
architecture=$3
test -n "${architecture}" || (usage; exit 1)
HASH=$4
test -n "${HASH}" || (usage; exit 1)
VERSION=$5
test -n "${VERSION}" || (usage; exit 1)
IMAGEDIR=${srcdir}/images/${architecture}
mkdir -p $IMAGEDIR
. "${srcdir}/yocto/oe-init-build-env" "${workdir}/${architecture}"
LAYERNAMES=$(cat ${srcdir}/LAYERS)
LAYERS=""
for layername in ${LAYERNAMES}; do
LAYERS="${LAYERS} \${OSTREE_SRCDIR}/${layername}"
done
SSTATE_DIR="${workdir}/sstate-cache"
DL_DIR="${workdir}/downloads"
cat > ${workdir}/${architecture}/conf/bblayers.conf <<EOF
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "6"
BBPATH = "\${TOPDIR}"
BBFILES ?= ""
OSTREE_SRCDIR = "${srcdir}"
BBLAYERS ?= "${LAYERS}"
EOF
EXTRA=
case "$architecture" in
i386) MACHINE="qemux86";;
x86_64) MACHINE="qemux86-64"; EXTRA='DEFAULTTUNE = "x86-64"';;
arm) MACHINE="qemuarmv7a";;
aarch64) MACHINE="qemuarm64";;
*) echo "Error: Unhandled architecture '$architecture'"; exit 1;;
esac
mkdir -p ${workdir}/${architecture}/conf
localconf=${workdir}/${architecture}/conf/local.conf
if ! grep -q "BUILDTAG2" ${localconf}; then
numcpus=$(( $(getconf _NPROCESSORS_ONLN) / 2 + 1 ))
cat > ${localconf}.tmp <<EOF
# BUILDTAG2
PARALLEL_MAKE = "-j ${numcpus}"
BB_NUMBER_THREADS = "${numcpus}"
LAYER_CONF_VERSION = "6"
CONF_VERSION = "1"
MACHINE = "${MACHINE}"
DISTRO = "freedesktop"
USER_CLASSES = "image-prelink"
PACKAGE_CLASSES = "package_rpm"
PATCHRESOLVE = "noop"
SSTATE_DIR = "${SSTATE_DIR}"
DL_DIR = "${DL_DIR}"
INHERIT += "rm_work"
${EXTRA}
EOF
mv ${localconf}.tmp ${localconf}
fi
bitbake freedesktop-contents-{sdk,platform}
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
for basetype in sdk platform; do
cp -f ${workdir}/${architecture}/tmp-glibc/deploy/images/${MACHINE}/freedesktop-contents-${basetype}-${MACHINE}.tar.gz $IMAGEDIR/freedesktop-contents-${basetype}-${VERSION}-${architecture}-${HASH}.tar.gz
cp -f ${workdir}/${architecture}/tmp-glibc/deploy/images/${MACHINE}/freedesktop-contents-${basetype}-${MACHINE}.manifest $IMAGEDIR/freedesktop-contents-${basetype}-${VERSION}-${architecture}-${HASH}.manifest
done