Skip to content

Commit b736bdf

Browse files
committed
Update build files
1 parent e63586b commit b736bdf

4 files changed

Lines changed: 21 additions & 13 deletions

File tree

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ WORKDIR /app
1515

1616
COPY config/west.yml config/west.yml
1717

18-
RUN west init -l config \
18+
RUN mkdir -p build \
19+
&& west init -l config \
1920
&& west update \
2021
&& west zephyr-export
2122

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ DOCKER := $(shell { command -v podman || command -v docker; })
33
.PHONY: all clean distclean
44

55
all:
6-
$(DOCKER) zmk_build --tag zmk-config --build-arg USER_ID=$(shell id -u) .
7-
$(DOCKER) volume create zmk_app
8-
$(DOCKER) run --rm -it --name zmk-config -u zmk \
9-
-v zmk_app:/app \
6+
$(DOCKER) build --tag zmk-build-user-config --build-arg USER_ID=$(shell id -u) .
7+
$(DOCKER) volume create zmk_build
8+
$(DOCKER) run --rm -it --name zmk-build-user-config -u zmk \
9+
-v zmk_build:/app/build \
1010
-v $(PWD)/build.yaml:/app/build.yaml:ro \
1111
-v $(PWD)/config:/app/config:ro \
1212
-v $(PWD)/firmware:/app/firmware \
1313
-e OUTPUT_ZMK_CONFIG=$(OUTPUT_ZMK_CONFIG) \
14-
zmk-config
14+
zmk-build-user-config
1515

1616
clean:
1717
rm -rf firmware/[^.]*
18-
-$(DOCKER) volume rm build config firmware
19-
-$(DOCKER) volume rm zmk_app
18+
-$(DOCKER) volume rm zmk_build
2019

2120
distclean: clean
22-
-$(DOCKER) image rm zmk-config
21+
-$(DOCKER) image rm zmk-build-user-config
22+
-$(DOCKER) system prune

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ OUTPUT_ZMK_CONFIG=1 make
4848
The configs with then be outputted to the `firmware` directory along with the firmware files.
4949

5050
#### Build Cache
51-
A docker volume is used to cache the build artifacts, this allows subsequent builds to compile faster.
51+
A docker volume is used to cache the build artifacts, allowing subsequent builds to compile faster.
5252

5353
### Cleanup
5454

bin/build.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ timestamp=$(date -u +"%Y%m%d%H%M%S")
66
while IFS=$',' read -r board shield; do
77
extra_cmake_args=${shield:+-DSHIELD="$shield"}
88
artifact_name=${shield:+${shield// /-}-}${board}-zmk
9-
filename="firmware/${timestamp}-${artifact_name}"
10-
build_dir="build/${artifact_name}"
9+
filename="${PWD}/firmware/${timestamp}-${artifact_name}"
10+
build_dir="${PWD}/build/${artifact_name}"
1111

1212
echo ""
1313
echo "-----------------"
@@ -30,7 +30,14 @@ while IFS=$',' read -r board shield; do
3030
| sort > "${filename}.config"
3131
fi
3232

33-
cp ${build_dir}/zephyr/zmk.uf2 "${filename}.uf2"
33+
extensions="uf2 hex bin"
34+
for extension in $extensions; do
35+
artifact=${build_dir}/zephyr/zmk.$extension
36+
if [[ -f $artifact ]]; then
37+
cp $artifact "${filename}.$extension"
38+
break
39+
fi
40+
done
3441
done < <(yq '
3542
[{"board": .board[], "shield": .shield[] // ""}] + .include
3643
| filter(.board)

0 commit comments

Comments
 (0)