Skip to content

Commit 463d406

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 463d406

File tree

1 file changed

+54
-36
lines changed

1 file changed

+54
-36
lines changed

build.sh

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -226,37 +226,46 @@ 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
243234
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
244235
-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} \
247236
-w /home/coreboot/coreboot ${DASHARO_SDK} \
248-
/bin/bash -c "make clean"
237+
/bin/bash -c "make distclean"
249238

250239
cp $DEFCONFIG .config
251240

252241
echo "Building Dasharo compatbile with Hardkernel ODROID H4 (version $FW_VERSION)"
253242

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)"
243+
if [ -z ${AIRGAP} ]; then
244+
245+
# In this situation we assume that provided repository is ready to be used
246+
# and nothing should be downloaded during build process.
247+
248+
# Without following sequence workspce would be created by docker with root
249+
# privilidges and build will fail.
250+
# Target directory
251+
TARGET_DIR="payloads/external/edk2/workspace/Dasharo"
252+
mkdir -p "$TARGET_DIR"
253+
chown -R $(id -u):$(id -g) "$TARGET_DIR"
254+
chmod -R 755 "$TARGET_DIR"
255+
256+
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
257+
-v $HOME/.ssh:/home/coreboot/.ssh \
258+
--network none \
259+
${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/coreboot/payloads/external/edk2/workspace/Dasharo} \
260+
-e BUILD_TIMELESS=${BUILD_TIMELESS}
261+
-w /home/coreboot/coreboot ${DASHARO_SDK} \
262+
/bin/bash -c "echo $BUILD_TIMELESS && make olddefconfig && make -j$(nproc)"
263+
else
264+
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
265+
-v $HOME/.ssh:/home/coreboot/.ssh \
266+
-w /home/coreboot/coreboot ${DASHARO_SDK} \
267+
/bin/bash -c "make olddefconfig && make -j$(nproc)"
268+
fi
260269

261270
cp build/coreboot.rom hardkernel_odroid_h4_${FW_VERSION}.rom
262271
if [ $? -eq 0 ]; then
@@ -272,37 +281,46 @@ function build_odroid_h4_btg {
272281
DEFCONFIG="configs/config.hardkernel_odroid_h4_btg"
273282
FW_VERSION=$(cat ${DEFCONFIG} | grep CONFIG_LOCALVERSION | cut -d '=' -f 2 | tr -d '"')
274283

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-
283284
# checkout several submodules needed by these boards (some others are checked
284285
# out by coreboot's Makefile)
285286
git submodule update --init --force --checkout \
286287
3rdparty/dasharo-blobs
287288

288-
# do not do distclean, because it removes all downloaded artifacts
289289
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
290290
-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} \
293291
-w /home/coreboot/coreboot ${DASHARO_SDK} \
294-
/bin/bash -c "make clean"
292+
/bin/bash -c "make distclean"
295293

296294
cp $DEFCONFIG .config
297295

298296
echo "Building Dasharo compatbile with Hardkernel ODROID H4 (version $FW_VERSION)"
299297

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)"
298+
if [ -z ${AIRGAP} ]; then
299+
300+
# In this situation we assume that provided repository is ready to be used
301+
# and nothing should be downloaded during build process.
302+
303+
# Without following sequence workspce would be created by docker with root
304+
# privilidges and build will fail.
305+
# Target directory
306+
TARGET_DIR="payloads/external/edk2/workspace/Dasharo"
307+
mkdir -p "$TARGET_DIR"
308+
chown -R $(id -u):$(id -g) "$TARGET_DIR"
309+
chmod -R 755 "$TARGET_DIR"
310+
311+
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
312+
-v $HOME/.ssh:/home/coreboot/.ssh \
313+
--network none \
314+
${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/coreboot/payloads/external/edk2/workspace/Dasharo} \
315+
-e BUILD_TIMELESS=${BUILD_TIMELESS}
316+
-w /home/coreboot/coreboot ${DASHARO_SDK} \
317+
/bin/bash -c "echo $BUILD_TIMELESS && make olddefconfig && make -j$(nproc)"
318+
else
319+
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
320+
-v $HOME/.ssh:/home/coreboot/.ssh \
321+
-w /home/coreboot/coreboot ${DASHARO_SDK} \
322+
/bin/bash -c "make olddefconfig && make -j$(nproc)"
323+
fi
306324

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

0 commit comments

Comments
 (0)