Merge pull request #29 from joshfrench/makefile

Reusable Docker image
This commit is contained in:
ReFil
2022-10-23 17:51:39 +00:00
committed by GitHub
6 changed files with 30 additions and 24 deletions
-3
View File
@@ -1,7 +1,5 @@
FROM zmkfirmware/zmk-build-arm:stable
RUN mkdir -p /app/firmware
WORKDIR /app
COPY config/west.yml config/west.yml
@@ -13,7 +11,6 @@ RUN west update
# West Zephyr export
RUN west zephyr-export
COPY config config
COPY bin/build.sh ./
CMD ["./build.sh"]
+20
View File
@@ -0,0 +1,20 @@
TIMESTAMP := $(shell date -u +"%Y%m%d%H%M%S")
.PHONY: clean setup
all: setup build
build: firmware/$$(TIMESTAMP)-left.uf2 firmware/$$(TIMESTAMP)-right.uf2
clean:
rm ./firmware/*.uf2
firmware/%-left.uf2 firmware/%-right.uf2: config/adv360.keymap
docker run --rm -it --name zmk \
-v $(PWD)/firmware:/app/firmware \
-v $(PWD)/config:/app/config:ro \
-e TIMESTAMP=$(TIMESTAMP) \
zmk
setup: Dockerfile bin/build.sh config/west.yml
docker build --tag zmk --file Dockerfile .
+8 -6
View File
@@ -14,15 +14,17 @@
## To build Firmware locally using Docker
### Setup
### First run
1. Execute `setup.sh`.
### Build firmware
1. Execute `run.sh`
1. Execute `make all`.
2. Check the `firmware` directory for the latest firmware build.
### Subsequent runs
If the only file you have changed is `config/adv360.keymap`, execute `make build` and check the `firmware` directory for the latest firmware build.
If you have changed other files in the `config` directory (such as `config/west.yml`) you will need to execute `make all` to rebuild the Docker image as well as the firmware.
### Flash firmware
Resources can be found on Kinesis.com
+2 -2
View File
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
set -e
set -eu
PWD=$(pwd)
TIMESTAMP=$(date -u +"%Y%m%d%H%M%S")
TIMESTAMP="${TIMESTAMP:-$(date -u +"%Y%m%d%H%M%S")}"
# West Build (left)
west build -s zmk/app -d build/left -b adv360_left -- -DZMK_CONFIG="${PWD}/config"
-8
View File
@@ -1,8 +0,0 @@
#!/usr/bin/env bash
set -e
docker run -it --name zmk zmk
docker cp zmk:/app/firmware/ ./
docker stop zmk
docker rm zmk
-5
View File
@@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -e
docker build --tag zmk .