-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·160 lines (139 loc) · 4.5 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·160 lines (139 loc) · 4.5 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
#!/bin/bash
MACHINE=sparrow-hawk
SCRIPT_DIR=$(cd `dirname $0` && pwd)
mkdir -p ${SCRIPT_DIR}/build
cd ${SCRIPT_DIR}/build
export WORK=`pwd`
TARGET_IMAGE=core-image-minimal
USE_SSTATE_MIRROR=no
BUILD_SBOM=no
BUILD_ROOTFS_ONLY=no
REMOVE_WORKDIR=no
IS_BUILD_INSIDE_REPO=yes
IS_BUILD_SDK=no
IS_QUIET_BUILD=no
TEMPLATE_POSTFIX=""
KERNEL_VERSION=""
FETCHALL_OPT=""
Usage () {
echo "Usage:"
echo " $0 <image_option> <options>"
echo "image option:"
echo " --console: Use CLI(default)"
echo " --weston: Use GUI"
echo "options:"
echo " -h | --help: Show this help"
echo " -s | --sdk: Build Yocto SDK"
echo " -q | --quiet: Pass -q option to bitbake command"
echo " | --sbom: Build SBOM files"
echo " | --sstate-mirror: Use sstate mirror server. This may decrease build time."
echo " | --rm-work: Remove working directory while building to reduce storage space."
echo " | --fetchall: Download source code only"
exit
}
while [[ $# -gt 0 ]]; do
case "$1" in
--console)
TEMPLATE_POSTFIX=""
TARGET_IMAGE=core-image-minimal ;;
--weston)
TEMPLATE_POSTFIX="-weston"
TARGET_IMAGE=core-image-weston ;;
-h|--help)
Usage; exit 0 ;;
-s|--sdk)
IS_BUILD_SDK=yes ;;
-q|--quiet)
IS_QUIET_BUILD=yes ;;
--sbom)
BUILD_SBOM=yes ;;
--rm-work)
REMOVE_WORKDIR=yes ;;
--sstate-mirror)
USE_SSTATE_MIRROR=yes ;;
--kernel-version)
KERNEL_VERSION=$2
shift ;;
--fetchall)
FETCHALL_OPT=" --runall=fetch -k" ;;
*) ;; # Ignore unknown option
esac
shift
done
if [[ "$(cat ${SCRIPT_DIR}/conf/layer.conf 2>&1 | grep LAYERDEPENDS_sparrow-hawk )" != "" ]] ;then
IS_BUILD_INSIDE_REPO=yes
else
IS_BUILD_INSIDE_REPO=no
fi
cd $WORK
git clone https://git.yoctoproject.org/poky
git clone https://git.openembedded.org/meta-openembedded
if [[ "${IS_BUILD_INSIDE_REPO}" == "yes" ]]; then
rm -f meta-sparrow-hawk
ln -sfd ${SCRIPT_DIR} meta-sparrow-hawk
else
git clone https://github.com/rcar-community/meta-sparrow-hawk.git
fi
git -C poky checkout -B scarthgap da5493bf86b3e75bbae4c5789fdfaca67b6f6a65
git -C meta-openembedded checkout -B scarthgap 06f846a325fde423bb0a6d49d771d8c1e144d7eb
if [[ "${IS_BUILD_INSIDE_REPO}" == "no" ]]; then
git -C meta-sparrow-hawk checkout -B scarthgap v2026-04-13
fi
cd $WORK
rm -rf build-$MACHINE/conf
TEMPLATECONF=${WORK}/meta-sparrow-hawk/conf/templates/$MACHINE${TEMPLATE_POSTFIX} \
. poky/oe-init-build-env build-$MACHINE
if [[ "${USE_SSTATE_MIRROR}" == "yes" ]]; then
cat << EOS >> conf/local.conf
BB_HASHSERVE_UPSTREAM = "wss://hashserv.yoctoproject.org/ws"
SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH"
BB_HASHSERVE = "auto"
BB_SIGNATURE_HANDLER = "OEEquivHash"
EOS
fi
if [[ "${BUILD_SBOM}" == "yes" ]]; then
cat << EOS >> conf/local.conf
# added for SBOM
# required. enable to generate spdx files.
INHERIT += "create-spdx"
# optional. if "1", output spdx files will be formatted.
SPDX_PRETTY = "1"
# optional. if "1", output spdx files includes [file-information section](https://spdx.github.io/spdx-spec/v2.3/file-information/).
SPDX_INCLUDE_SOURCES = "1"
# optional. if "1", bitbake will create source files archive for each package.
SPDX_ARCHIVE_SOURCES = "1"
# optional. if "1", bitbake will create output binary archive for each package.
SPDX_ARCHIVE_PACKAGED = "1"
EOS
else # Disable SBOM build to reduce build time
cat << EOS >> conf/local.conf
# Disable create-spdx
INHERIT:remove = "create-spdx"
EOS
fi
if [[ "${KERNEL_VERSION}" == "dummy" ]]; then
cat << EOS >> conf/local.conf
# Disable kernel building
PREFERRED_PROVIDER_virtual/kernel = "linux-dummy"
EOS
elif [[ "${KERNEL_VERSION}" != "" ]]; then
cat << EOS >> conf/local.conf
PREFERRED_VERSION_linux-renesas = "${KERNEL_VERSION}%"
LINUXLIBCVERSION = "${KERNEL_VERSION}%"
EOS
fi
if [[ "${REMOVE_WORKDIR}" == "yes" ]]; then
echo 'INHERIT += "rm_work"' >> conf/local.conf
fi
QUIET_FLAG=""
if [[ "${IS_QUIET_BUILD}" == "yes" ]]; then
QUIET_FLAG="-q"
fi
bitbake ${QUIET_FLAG} ${TARGET_IMAGE} ${FETCHALL_OPT}
if [[ "${IS_BUILD_SDK}" == "yes" ]]; then
bitbake ${QUIET_FLAG} ${TARGET_IMAGE}-sdk -c populate_sdk ${FETCHALL_OPT}
fi
# Cleanup symbolic link
if [[ "${IS_BUILD_INSIDE_REPO}" == "yes" ]]; then
rm -f ${WORK}/meta-sparrow-hawk
fi