Makefile enhancements to optimize local workflows (#363)

- Enhance the Makefile to enable firmware building exclusively for the left side.

To modify the keymap, flashing only the left side's firmware suffices.

This change facilitates the creation of firmware for the left side only,
thereby expediting the build process.

Usage: make left

This update maintains existing functionality. Without specifying the
left target, firmware for both halves will be generated.

- Add separate make targets to clean firmware and docker image

Add targets clean_firmware and clean_image independently while maintaing clean to run both

- Ensure files modified by the build process are reset at the end

The current build process dynamically generates the content of the version macro
in config/version.dtsi to enable users to print out the precise version and commit
the firmware was built on via a keybinding on the keymap.

This change ensurs that the changes to this macro file are reset at the end of the
build process to ensure it isn't shown as modified and added to keymap commit changes.
This commit is contained in:
Thomas Huber
2024-02-05 01:55:24 -08:00
committed by GitHub
parent 0737d53e01
commit cbc0656668
4 changed files with 57 additions and 12 deletions
+24 -5
View File
@@ -35,14 +35,33 @@ Certain ZMK features (e.g. combos) require knowing the exact key positions in th
* Install make using `sudo apt-get install make` inside the WSL2 instance.
* The repository can be cloned directly into the WSL2 instance or accessed through the C: mount point WSL provides by default (`/mnt/c/path-to-repo`).
### Build firmware
#### macOS specific
1. Execute `make`.
2. Check the `firmware` directory for the latest firmware build.
On macOS [brew](https://brew.sh) can be used to install the required components.
* docker
* [colima](https://github.com/abiosoft/colima) can be used as the docker engine
```shell
brew install docker colima
colima start
```
> Note: On Apple Silicon (ARM based) systems you need to make sure to start colima with the correct architecture for the container being used.
> ```
> colima start --arch x86_64
> ```
### Build firmware locally
1. Execute `make` to build firmware for both halves or `make left` to only build firmware for the left hand side.
2. Check the `firmware` directory for the latest firmware build. The first part of the filename is the timestamp when the firmware was built.
### Cleanup
The built docker container and compiled firmware files can be deleted with `make clean`. This might be necessary if you updated your fork from V2.0 to V3.0 and are encountering build failures.
The built docker container and compiled firmware files can be deleted with `make clean`. This might be necessary if you updated your fork from V2.0 to V3.0 and are encountering build failures.
Creating the docker container takes some time. Therefore `make clean_firmware` can be used to only clean firmware without removing the docker container. Similarly `make clean_image` can be used to remove the docker container without removing compiled firmware files.
## Flashing firmware
@@ -116,4 +135,4 @@ Further support resources can be found on Kinesis.com:
* https://kinesis-ergo.com/support/kb360pro/#manuals
In the event of a hardware issue it may be necessary to open a support ticket directly with Kinesis as opposed to a GitHub issue in this repository.
* https://kinesis-ergo.com/support/kb360pro/#ticket
* https://kinesis-ergo.com/support/kb360pro/#ticket