From 79fd21adb13df79628b19f325f1f501cde8d78db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Go=C5=82a=C5=9B?= Date: Fri, 12 Sep 2025 09:30:16 +0200 Subject: [PATCH] build.sh: Use EDK2_REPO_PATH & EDK_REV vars for easy dev builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filip Gołaś --- build.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index a1dd2c2fceb..fc9a8e9fb6d 100755 --- a/build.sh +++ b/build.sh @@ -40,15 +40,21 @@ usage() { echo -e "\todroid_h4 - build Dasharo compatible with Hardkernel ODROID H4" echo -e "\todroid_h4_netcard - build Dasharo compatible with Hardkernel ODROID H4 for netcard support" echo -e "\tasrock_spc741d8 - build Dasharo compatible with ASRock Rack SPC741D8-2L2T/BCM" + echo + echo "Env vars:" + echo -e "\tEDK2_REPO_PATH - path to local edk2 repo to use for payload" + echo -e "\tEDK2_REV - branch/tag/commit hash from which to build edk2" } DASHARO_SDK=${DASHARO_SDK:-"ghcr.io/dasharo/dasharo-sdk:v1.6.0"} BUILD_TIMELESS=${BUILD_TIMELESS:-0} AIRGAP=${AIRGAP:-0} +EDK2_REPO_MOUNT_CMD="" function sdk_run { docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ -v $HOME/.ssh:/home/coreboot/.ssh \ + $EDK2_REPO_MOUNT_CMD \ -e BUILD_TIMELESS=${BUILD_TIMELESS} \ -w /home/coreboot/coreboot ${DASHARO_SDK} \ "$@" @@ -80,15 +86,23 @@ function build_start { mkdir -p "$TARGET_DIR" chown -R $(id -u):$(id -g) "$TARGET_DIR" chmod -R 755 "$TARGET_DIR" + EDK2_REPO_MOUNT_CMD=${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/coreboot/${TARGET_DIR}} sdk_run --network none \ - ${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/coreboot/${TARGET_DIR}} \ /bin/bash -c "make olddefconfig && make -j$(nproc)" else echo "EDK2_REPO_PATH is not defined in AIRGAP!" exit 1 fi else - sdk_run /bin/bash -c "make olddefconfig && make -j$(nproc)" + sdk_run /bin/bash -c "make olddefconfig" + if [[ -v EDK2_REPO_PATH ]]; then + EDK2_REPO_MOUNT_CMD="-v $EDK2_REPO_PATH:/home/coreboot/edk2" + sed -i 's/^CONFIG_EDK2_REPOSITORY=\"[^"]*"/CONFIG_EDK2_REPOSITORY="\/home\/coreboot\/edk2"/' .config + fi + if [ -v EDK2_REV ]; then + sed -i "s/^CONFIG_EDK2_TAG_OR_REV=\"[^\"]*\"/CONFIG_EDK2_TAG_OR_REV=\"$EDK2_REV\"/" .config + fi + sdk_run /bin/bash -c "make -j$(nproc)" fi }