Skip to content

Commit 14dfd52

Browse files
committed
build.sh: use AIRGAP and DASHARO_SDK to keep backward compatibility
Signed-off-by: Piotr Król <[email protected]>
1 parent 0dc0178 commit 14dfd52

File tree

1 file changed

+82
-42
lines changed

1 file changed

+82
-42
lines changed

build.sh

Lines changed: 82 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -226,37 +226,57 @@ function build_odroid_h4 {
226226
DEFCONFIG="configs/config.hardkernel_odroid_h4"
227227
FW_VERSION=$(cat ${DEFCONFIG} | grep CONFIG_LOCALVERSION | cut -d '=' -f 2 | tr -d '"')
228228

229-
# Without following sequence workspce would be created by docker with root
230-
# privilidges and build will fail.
231-
# Target directory
232-
TARGET_DIR="payloads/external/edk2/workspace/Dasharo"
233-
mkdir -p "$TARGET_DIR"
234-
chown -R $(id -u):$(id -g) "$TARGET_DIR"
235-
chmod -R 755 "$TARGET_DIR"
236-
237229
# checkout several submodules needed by these boards (some others are checked
238230
# out by coreboot's Makefile)
239231
git submodule update --init --force --checkout \
240232
3rdparty/dasharo-blobs
241233

242-
# do not do distclean, because it removes all downloaded artifacts
243-
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
244-
-v $HOME/.ssh:/home/coreboot/.ssh \
245-
--network none \
246-
${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/coreboot/payloads/external/edk2/workspace/Dasharo} \
247-
-w /home/coreboot/coreboot ${DASHARO_SDK} \
248-
/bin/bash -c "make clean"
234+
if [ "${AIRGAP}" -eq 1 ]; then
235+
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
236+
-v $HOME/.ssh:/home/coreboot/.ssh \
237+
-w /home/coreboot/coreboot ${DASHARO_SDK} \
238+
/bin/bash -c "make clean"
239+
else
240+
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
241+
-v $HOME/.ssh:/home/coreboot/.ssh \
242+
-w /home/coreboot/coreboot ${DASHARO_SDK} \
243+
/bin/bash -c "make distclean"
244+
fi
249245

250246
cp $DEFCONFIG .config
251247

252248
echo "Building Dasharo compatbile with Hardkernel ODROID H4 (version $FW_VERSION)"
253249

254-
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
255-
-v $HOME/.ssh:/home/coreboot/.ssh \
256-
--network none \
257-
${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/coreboot/payloads/external/edk2/workspace/Dasharo} \
258-
-w /home/coreboot/coreboot ${DASHARO_SDK} \
259-
/bin/bash -c "make olddefconfig && make -j$(nproc)"
250+
if [ "${AIRGAP}" -eq 1 ]; then
251+
252+
# In this situation we assume that provided repository is ready to be used
253+
# and nothing should be downloaded during build process.
254+
255+
if [ -d "${EDK2_REPO_PATH}" ]; then
256+
# Without following sequence workspce would be created by docker with root
257+
# privilidges and build will fail.
258+
# Target directory
259+
TARGET_DIR="payloads/external/edk2/workspace/Dasharo"
260+
mkdir -p "$TARGET_DIR"
261+
chown -R $(id -u):$(id -g) "$TARGET_DIR"
262+
chmod -R 755 "$TARGET_DIR"
263+
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
264+
-v $HOME/.ssh:/home/coreboot/.ssh \
265+
--network none \
266+
${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/coreboot/payloads/external/edk2/workspace/Dasharo} \
267+
-e BUILD_TIMELESS=${BUILD_TIMELESS} \
268+
-w /home/coreboot/coreboot ${DASHARO_SDK} \
269+
/bin/bash -c "make olddefconfig && make -j$(nproc)"
270+
else
271+
echo "EDK2_REPO_PATH is not defined in AIRGAP!"
272+
exit 1
273+
fi
274+
else
275+
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
276+
-v $HOME/.ssh:/home/coreboot/.ssh \
277+
-w /home/coreboot/coreboot ${DASHARO_SDK} \
278+
/bin/bash -c "make olddefconfig && make -j$(nproc)"
279+
fi
260280

261281
cp build/coreboot.rom hardkernel_odroid_h4_${FW_VERSION}.rom
262282
if [ $? -eq 0 ]; then
@@ -272,37 +292,57 @@ function build_odroid_h4_btg {
272292
DEFCONFIG="configs/config.hardkernel_odroid_h4_btg"
273293
FW_VERSION=$(cat ${DEFCONFIG} | grep CONFIG_LOCALVERSION | cut -d '=' -f 2 | tr -d '"')
274294

275-
# Without following sequence workspce would be created by docker with root
276-
# privilidges and build will fail.
277-
# Target directory
278-
TARGET_DIR="payloads/external/edk2/workspace/Dasharo"
279-
mkdir -p "$TARGET_DIR"
280-
chown -R $(id -u):$(id -g) "$TARGET_DIR"
281-
chmod -R 755 "$TARGET_DIR"
282-
283295
# checkout several submodules needed by these boards (some others are checked
284296
# out by coreboot's Makefile)
285297
git submodule update --init --force --checkout \
286298
3rdparty/dasharo-blobs
287299

288-
# do not do distclean, because it removes all downloaded artifacts
289-
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
290-
-v $HOME/.ssh:/home/coreboot/.ssh \
291-
--network none \
292-
${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/coreboot/payloads/external/edk2/workspace/Dasharo} \
293-
-w /home/coreboot/coreboot ${DASHARO_SDK} \
294-
/bin/bash -c "make clean"
300+
if [ "${AIRGAP}" -eq 1 ]; then
301+
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
302+
-v $HOME/.ssh:/home/coreboot/.ssh \
303+
-w /home/coreboot/coreboot ${DASHARO_SDK} \
304+
/bin/bash -c "make clean"
305+
else
306+
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
307+
-v $HOME/.ssh:/home/coreboot/.ssh \
308+
-w /home/coreboot/coreboot ${DASHARO_SDK} \
309+
/bin/bash -c "make distclean"
310+
fi
295311

296312
cp $DEFCONFIG .config
297313

298314
echo "Building Dasharo compatbile with Hardkernel ODROID H4 (version $FW_VERSION)"
299315

300-
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
301-
-v $HOME/.ssh:/home/coreboot/.ssh \
302-
--network none \
303-
${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/coreboot/payloads/external/edk2/workspace/Dasharo} \
304-
-w /home/coreboot/coreboot ${DASHARO_SDK} \
305-
/bin/bash -c "make olddefconfig && make -j$(nproc)"
316+
if [ "${AIRGAP}" -eq 1 ]; then
317+
318+
# In this situation we assume that provided repository is ready to be used
319+
# and nothing should be downloaded during build process.
320+
321+
if [ -d "${EDK2_REPO_PATH}" ]; then
322+
# Without following sequence workspce would be created by docker with root
323+
# privilidges and build will fail.
324+
# Target directory
325+
TARGET_DIR="payloads/external/edk2/workspace/Dasharo"
326+
mkdir -p "$TARGET_DIR"
327+
chown -R $(id -u):$(id -g) "$TARGET_DIR"
328+
chmod -R 755 "$TARGET_DIR"
329+
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
330+
-v $HOME/.ssh:/home/coreboot/.ssh \
331+
--network none \
332+
${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/coreboot/payloads/external/edk2/workspace/Dasharo} \
333+
-e BUILD_TIMELESS=${BUILD_TIMELESS} \
334+
-w /home/coreboot/coreboot ${DASHARO_SDK} \
335+
/bin/bash -c "make olddefconfig && make -j$(nproc)"
336+
else
337+
echo "EDK2_REPO_PATH is not defined in AIRGAP!"
338+
exit 1
339+
fi
340+
else
341+
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
342+
-v $HOME/.ssh:/home/coreboot/.ssh \
343+
-w /home/coreboot/coreboot ${DASHARO_SDK} \
344+
/bin/bash -c "make olddefconfig && make -j$(nproc)"
345+
fi
306346

307347
cp build/coreboot.rom hardkernel_odroid_h4_${FW_VERSION}.rom
308348
if [ $? -eq 0 ]; then

0 commit comments

Comments
 (0)