-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_part.sh
More file actions
executable file
·167 lines (143 loc) · 4.59 KB
/
build_part.sh
File metadata and controls
executable file
·167 lines (143 loc) · 4.59 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#! /bin/bash
#
# Build parts of the Strbo distribution.
#
# The parts consist of
# - an image file containing the boot loader and related files;
# - an image file containing the Linux system;
# - package files for the package management system.
#
# Check strbo_build_*/tmp-glibc/deploy/ for results.
#
# Note: The OE script sourced below is a GNU Bash script, so we really need
# that unholy /bin/bash shebang.
#
if test $# -ne 1
then
echo "Usage: $0 (main|recovery|flashimage)"
exit 1
fi
umask 0022
ORIGINAL_SYSTEM_NAME="$1"
SYSTEM_NAME=$(echo -n $ORIGINAL_SYSTEM_NAME | sed 's/-config$//')
if test x"$SYSTEM_NAME" = 'xflashimage'
then
SYSTEM_BUILD_NAME='main'
else
SYSTEM_BUILD_NAME="$SYSTEM_NAME"
fi
case ${SYSTEM_BUILD_NAME}
in
main)
SUBST_DISTRO='s/@DISTRO@/strbo-main/g'
BUILD_DIR='strbo_build_main'
OTHER_BUILD_DIR='strbo_build_recovery'
;;
recovery)
SUBST_DISTRO='s/@DISTRO@/strbo-recovery/g'
BUILD_DIR='strbo_build_recovery'
OTHER_BUILD_DIR='strbo_build_main'
;;
*)
echo "Invalid system name \"$1\"."
exit 1
;;
esac
OTHER_DEPLOY_DIR_IMAGE="${PWD}/${OTHER_BUILD_DIR}/tmp-glibc/deploy/images/raspberrypi"
SUBST_OTHER_DEPLOY_DIR=';s,@OTHER_DEPLOY_DIR_IMAGE@,'"${OTHER_DEPLOY_DIR_IMAGE}"',g'
#
# Previously generated options for the complete build.
#
. build_options.config
#
# Set up environment for BitBake.
#
. yocto/oe-init-build-env "${BUILD_DIR}"
if [ -z "$STRBO_BUILD_CONTINUE_ON_ERROR" ]; then
set -e
fi
rm -f conf/local.conf
if test "x${DISTRO_DATETIME}" = x
then
echo "Variable DISTRO_DATETIME not set."
exit 1
else
SUBST_DATETIME=';s/@DISTRO_DATETIME@/'"${DISTRO_DATETIME}"'/g'
fi
if test "x${DISTRO_GIT_COMMIT}" = x
then
echo "Variable DISTRO_GIT_COMMIT not set."
exit 1
else
SUBST_GITCOMMIT=';s/@DISTRO_GIT_COMMIT@/'"${DISTRO_GIT_COMMIT}"'/g'
fi
SUBST_NIGHTLY_PACKAGES=';s/@WITH_NIGHTLY_PACKAGES@/# /g'
if test "x${RELEASE_VERSION}" = x
then
SUBST_VERSION=';s/@WITH_DISTRO_VERSION@/# /g'
else
SUBST_VERSION=';s/@WITH_DISTRO_VERSION@//g;s/@DISTRO_VERSION@/'"$RELEASE_VERSION"'/g'
if test "x${RELEASE_VERSION}" = 'xnightly' || echo "x${RELEASE_VERSION}" | grep -q '^xnightly-'
then
SUBST_NIGHTLY_PACKAGES=';s/@WITH_NIGHTLY_PACKAGES@//g'
fi
fi
if test "x${RELEASE_LINE}" = x
then
echo "Variable RELEASE_LINE not set."
exit 1
else
SUBST_LINE=';s/@WITH_DISTRO_LINE@//g;s/@DISTRO_LINE@/'"$RELEASE_LINE"'/g'
fi
if test "x${RELEASE_FLAVOR}" = x
then
echo "Variable RELEASE_FLAVOR not set."
exit 1
else
SUBST_FLAVOR=';s/@WITH_DISTRO_FLAVOR@//g;s/@DISTRO_FLAVOR@/'"$RELEASE_FLAVOR"'/g'
fi
set -u
SUBSTS="${SUBST_DISTRO}${SUBST_DATETIME}${SUBST_GITCOMMIT}${SUBST_VERSION}${SUBST_LINE}${SUBST_FLAVOR}${SUBST_OTHER_DEPLOY_DIR}${SUBST_NIGHTLY_PACKAGES}"
#
# We are now in the build directory; the sourced script changed the directory
# for us... Anyway, we may now run bitbake to build parts of our distribution.
#
sed "$SUBSTS" conf/local.conf.in >conf/local.conf
if test "x$SYSTEM_NAME" != "x$ORIGINAL_SYSTEM_NAME"
then
exit 0
fi
case ${SYSTEM_NAME}
in
main)
time (
echo "Running Bitbake to build boot and main partition images..."
time bitbake ${STRBO_BUILD_CONTINUE_ON_ERROR:+-k} strbo-main-image strbo-main-boot-image
echo "Running Bitbake to populate SDK..."
time bitbake ${STRBO_BUILD_CONTINUE_ON_ERROR:+-k} -c populate_sdk strbo-main-image
echo "Creating RPM package index..."
time bitbake ${STRBO_BUILD_CONTINUE_ON_ERROR:+-k} package-index
)
;;
recovery)
time (
# must be built one after the other because dependencies cannot be formulated
# in a way that it actually works
echo "Running Bitbake to build recovery image..."
time bitbake ${STRBO_BUILD_CONTINUE_ON_ERROR:+-k} strbo-recovery-image
echo "Running Bitbake to build recovery boot image..."
time bitbake ${STRBO_BUILD_CONTINUE_ON_ERROR:+-k} strbo-recovery-boot-image
# dito, we need to put image files built by previous recipes into this image
echo "Running Bitbake to build recovery data image..."
time bitbake ${STRBO_BUILD_CONTINUE_ON_ERROR:+-k} strbo-recovery-data-image
)
;;
flashimage)
time (
echo "Running Bitbake to clean state for full disk image..."
time bitbake ${STRBO_BUILD_CONTINUE_ON_ERROR:+-k} -c cleansstate strbo-image
echo "Running Bitbake to build full disk image..."
time bitbake ${STRBO_BUILD_CONTINUE_ON_ERROR:+-k} strbo-image
)
;;
esac