Skip to content

Commit 59f5b12

Browse files
committed
docker: fix NRF_SDK download and subsequent build.sh
The upstream NRF-SDK download url and zip archive filename changed, which was fixed with #2270 But the archive contents stayed the same, with the "old" folder name. After #2270 we have basically the same docker-container as before the PR, but the `GetNrfSdk` function of the `build.sh` script is called again during firmware build time as the expected foldername for the SDK isn't the same as the zip filename: ```sh [ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ] && GetNrfSdk ``` Then during the build the `buils.sh` script tries to execute `GetNrfSdk` again, which fails as the files already exist resulting in the following error: ``` replace /opt/nRF5_SDK_15.3.0_59ac345/components/802_15_4/api/HAL/hal_atomic.h? [y]es, [n]o, [A]ll, [N]one, [r]ename: NULL ``` Fix this by reverting the `NRF_SDK_VER` to the folder name in the zip archive and by some character replacement generate the download URL from the above (the download is in lower-case without the `_` and `.` characters). Furthermore add safeguards to check after the `GetNrfSdk` call if the expected folder is really created. Then we have an error early during container image creation if the contents of the zip-archive are unexpected.
1 parent 9fb35cc commit 59f5b12

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

docker/build.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export npm_config_cache="${NPM_DIR}"
1717

1818
export BUILD_TYPE=${BUILD_TYPE:=Release}
1919
export GCC_ARM_VER=${GCC_ARM_VER:="10.3-2021.10"}
20-
export NRF_SDK_VER=${NRF_SDK_VER:="nrf5sdk153059ac345"}
20+
export NRF_SDK_VER=${NRF_SDK_VER:="nRF5_SDK_15.3.0_59ac345"}
21+
NRF_SDK_VER_SLUG=${NRF_SDK_VER,,}
22+
export NRF_SDK_VER_SLUG=${NRF_SDK_VER_SLUG//[_.]/}
2123

2224
MACHINE="$(uname -m)"
2325
[ "$MACHINE" = "arm64" ] && MACHINE="aarch64"
@@ -30,8 +32,20 @@ main() {
3032
mkdir -p "$TOOLS_DIR"
3133

3234
[ ! -d "$TOOLS_DIR/$GCC_ARM_PATH" ] && GetGcc
35+
if [ ! -d "$TOOLS_DIR/$GCC_ARM_PATH" ]; then
36+
echo "missing GCC path: $TOOLS_DIR/$GCC_ARM_PATH"
37+
return 1
38+
fi
3339
[ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ] && GetNrfSdk
40+
if [ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ]; then
41+
echo "missing NRF_SDK path: $TOOLS_DIR/$NRF_SDK_VER"
42+
return 1
43+
fi
3444
[ ! -d "$TOOLS_DIR/mcuboot" ] && GetMcuBoot
45+
if [ ! -d "$TOOLS_DIR/mcuboot" ]; then
46+
echo "missing mcuboot path: $TOOLS_DIR/mcuboot"
47+
return 1
48+
fi
3549

3650
mkdir -p "$BUILD_DIR"
3751

@@ -55,7 +69,7 @@ GetMcuBoot() {
5569
}
5670

5771
GetNrfSdk() {
58-
wget -q "https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/sdks/nrf5/binaries/$NRF_SDK_VER.zip" -O /tmp/$NRF_SDK_VER
72+
wget -q "https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/sdks/nrf5/binaries/$NRF_SDK_VER_SLUG.zip" -O /tmp/$NRF_SDK_VER
5973
unzip -q /tmp/$NRF_SDK_VER -d "$TOOLS_DIR/"
6074
rm /tmp/$NRF_SDK_VER
6175
}

0 commit comments

Comments
 (0)