This commit is contained in:
Jeremy Kitchen 2021-12-15 18:25:38 -08:00 committed by GitHub
commit 8db658e220
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 3 deletions

21
docker-compose.yml Normal file
View file

@ -0,0 +1,21 @@
---
version: "3.9"
services:
shell:
ports:
- 3000
build:
context: .devcontainer/
dockerfile: Dockerfile
volumes:
- $PWD:/workspace
- zmk-root-user:/root
- zmk-zephyr:/workspace/zephyr
- zmk-zephyr-modules:/workspace/modules
- zmk-zephyr-tools:/workspace/tools
volumes:
zmk-root-user:
zmk-zephyr:
zmk-zephyr-modules:
zmk-zephyr-tools:

View file

@ -90,7 +90,11 @@ This produces `left` and `right` subfolders under the `build` directory and two
### Building from `zmk-config` Folder
Instead of building .uf2 files using the default keymap and config files, you can build directly from your [`zmk-config` folder](../user-setup.md#github-repo) by adding
Getting your `zmk-config` to be used by your build environment differs based on what type of build environment you are using.
#### Local/Host Build Environment.
Instead of building .uf2 files using the default keymap and config files, you can build directly from your [`zmk-config` folder](../user-setup#github-repo) by adding
`-DZMK_CONFIG="C:/the/absolute/path/config"` to your `west build` command. **Notice that this path should point to the folder labelled `config` within your `zmk-config` folder.**
For instance, building kyria firmware from a user `myUser`'s `zmk-config` folder on Windows 10 may look something like this:
@ -99,6 +103,8 @@ For instance, building kyria firmware from a user `myUser`'s `zmk-config` folder
west build -b nice_nano -- -DSHIELD=kyria_left -DZMK_CONFIG="C:/Users/myUser/Documents/Github/zmk-config/config"
```
#### VSCode Remote Container environnment
In order to make your `zmk-config` folder available when building within the VSCode Remote Container, you need to create a docker volume named `zmk-config`
by binding it to the full path of your config directory. If you have run the VSCode Remote Container before, it is likely that docker has created this
volume automatically -- we need to delete the default volume before binding it to the correct path. Follow the following steps:
@ -114,7 +120,17 @@ docker volume create --driver local -o o=bind -o type=none -o \
device="/full/path/to/your/zmk-config/" zmk-config
```
Now start VSCode and rebuild the container after being prompted. You should be able to see your zmk-config mounted to `/workspaces/zmk-config` inside the container. So you can build your custom firmware with `-DZMK_CONFIG="/workspaces/zmk-config/config"`.
Now start VSCode and rebuild the container after being prompted. You should be able to see your zmk-config mounted to `/workspaces/zmk-config` inside the container. So you can build your custom firmware by adding `-DZMK_CONFIG="/workspaces/zmk-config/config"` to your `west build` command.
#### Docker Compose Build Environment
ATTACHING your `zmk-config` to your docker-compose build environment is done by specifying a volume mount when running the service:
```
docker compose run --rm -v /full/path/to/your/zmk-config:/workspace/zmk-config shell bash
```
Now you can build your custom firmware with `-DZMK_CONFIG=/workspace/zmk-config/config".`
## Flashing

View file

@ -16,6 +16,7 @@ values={[
{label: 'Raspberry OS', value: 'raspberryos'},
{label: 'Fedora', value: 'fedora'},
{label: 'VS Code & Docker', value: 'docker'},
{label: 'Docker Compose', value: 'dockercompose'},
]
}>{props.children}</Tabs>);
@ -195,7 +196,7 @@ This setup leverages the same [image which is used by the GitHub action](https:/
3. Install the [Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
:::info
The docker container includes `west` and the compilation toolchain. If you're using docker and VS Code, you can skip right to [Source Code](#source-code).
The docker container includes `west` and the compilation toolchain. If you're using docker and VS Code, or `docker compose`, you can skip right to [Source Code](#source-code).
:::
</TabItem>
@ -421,6 +422,20 @@ All subsequent steps must be performed from the VS Code terminal _inside_ the co
:::
</TabItem>
<TabItem value="dockercompose">
Open a terminal and `cd` into your `zmk` repository.
Run `docker compose up -d`.
To enter the build environment container, run `docker compose run --rm shell bash`. The zmk repo will be mounted into the `/workspace` directory.
:::caution
All subsequent steps must be performed _inside_ the container.
:::
</TabItem>
</OsTabs>
#### Initialize West