Skip to content

Commit 148e4d5

Browse files
committed
build.sh: Use EDK2_REPO_PATH & EDK_REV vars for easy dev builds
Signed-off-by: Filip Gołaś <[email protected]>
1 parent a72e5ac commit 148e4d5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

build.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,21 @@ usage() {
4040
echo -e "\todroid_h4 - build Dasharo compatible with Hardkernel ODROID H4"
4141
echo -e "\todroid_h4_netcard - build Dasharo compatible with Hardkernel ODROID H4 for netcard support"
4242
echo -e "\tasrock_spc741d8 - build Dasharo compatible with ASRock Rack SPC741D8-2L2T/BCM"
43+
echo
44+
echo "Env vars:"
45+
echo -e "\tEDK2_REPO_PATH - path to local edk2 repo to use for payload"
46+
echo -e "\tEDK2_REV - branch/tag/commit hash from which to build edk2"
4347
}
4448

4549
DASHARO_SDK=${DASHARO_SDK:-"ghcr.io/dasharo/dasharo-sdk:v1.6.0"}
4650
BUILD_TIMELESS=${BUILD_TIMELESS:-0}
4751
AIRGAP=${AIRGAP:-0}
52+
EDK2_REPO_MOUNT_CMD=""
4853

4954
function sdk_run {
5055
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
5156
-v $HOME/.ssh:/home/coreboot/.ssh \
57+
$EDK2_REPO_MOUNT_CMD \
5258
-e BUILD_TIMELESS=${BUILD_TIMELESS} \
5359
-w /home/coreboot/coreboot ${DASHARO_SDK} \
5460
"$@"
@@ -80,15 +86,23 @@ function build_start {
8086
mkdir -p "$TARGET_DIR"
8187
chown -R $(id -u):$(id -g) "$TARGET_DIR"
8288
chmod -R 755 "$TARGET_DIR"
89+
EDK2_REPO_MOUNT_CMD=${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/coreboot/${TARGET_DIR}}
8390
sdk_run --network none \
84-
${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/coreboot/${TARGET_DIR}} \
8591
/bin/bash -c "make olddefconfig && make -j$(nproc)"
8692
else
8793
echo "EDK2_REPO_PATH is not defined in AIRGAP!"
8894
exit 1
8995
fi
9096
else
91-
sdk_run /bin/bash -c "make olddefconfig && make -j$(nproc)"
97+
sdk_run /bin/bash -c "make olddefconfig"
98+
if [[ -v EDK2_REPO_PATH ]]; then
99+
EDK2_REPO_MOUNT_CMD="-v $EDK2_REPO_PATH:/home/coreboot/edk2"
100+
sed -i 's/^CONFIG_EDK2_REPOSITORY=\"[^"]*"/CONFIG_EDK2_REPOSITORY="\/home\/coreboot\/edk2"/' .config
101+
fi
102+
if [ -v EDK2_REV ]; then
103+
sed -i "s/^CONFIG_EDK2_TAG_OR_REV=\"[^\"]*\"/CONFIG_EDK2_TAG_OR_REV=\"$EDK2_REV\"/" .config
104+
fi
105+
sdk_run /bin/bash -c "make -j$(nproc)"
92106
fi
93107
}
94108

0 commit comments

Comments
 (0)