54 lines
2.2 KiB
Markdown
54 lines
2.2 KiB
Markdown
<!-- #build 0 -->
|
|
# QMK Firmware Compiler
|
|
|
|
Compile your QMK firmware easily with Docker. This setup allows you to compile firmware from a directory of source files at runtime, ensuring flexibility for various keyboard and keymap compilations.
|
|
|
|
## Docker Run
|
|
|
|
To compile your QMK firmware using the `docker run` command, set up your environment by specifying the source directory and output path:
|
|
|
|
1. **Compile Firmware from a Single Source Directory:**
|
|
|
|
```bash
|
|
docker run -v $(pwd)/data:/usr/src/app/data -v $(pwd)/bin:/usr/src/app/bin qmk-compiler
|
|
```
|
|
|
|
This command mounts your local `data` directory containing the QMK source files to the container's `/usr/src/app/data` directory and outputs the compiled firmware to your local `bin` directory.
|
|
|
|
## Docker Compose
|
|
|
|
To integrate this process with Docker Compose, you can define a service in your `docker-compose.yml` file. This approach allows you to specify volume mounts and environment variables for a more automated and repeatable compilation process.
|
|
|
|
Example `docker-compose.yml` file for QMK firmware compilation:
|
|
|
|
```yaml
|
|
version: '3'
|
|
|
|
services:
|
|
qmk-compiler:
|
|
image: qmk-compiler
|
|
volumes:
|
|
- ./data:/usr/src/app/data # Mount the source directory
|
|
- ./bin:/usr/src/app/bin # Mount the output directory
|
|
environment:
|
|
- KEYBOARD=example_keyboard # Specify the keyboard name (optional)
|
|
- KEYMAP=default # Specify the keymap name (optional)
|
|
```
|
|
|
|
Run the service defined in the `docker-compose.yml` file with:
|
|
|
|
```bash
|
|
docker-compose up
|
|
```
|
|
|
|
## Customizing the Configuration
|
|
|
|
To customize your firmware compilation, you can adjust the following environment variables and volume mounts:
|
|
|
|
- **Volumes:**
|
|
- Mount your source directory to `/usr/src/app/data` to provide the firmware source files.
|
|
- Mount your output directory to `/usr/src/app/bin` to retrieve the compiled firmware.
|
|
|
|
- **Environment Variables (Optional):**
|
|
- `KEYBOARD`: Specify the keyboard for which the firmware is being compiled. This variable can be used in your `compile_firmware.sh` script to dynamically select the keyboard.
|
|
- `KEYMAP`: Specify the keymap to be compiled. Similar to `KEYBOARD`, this can be used in the script to select the appropriate keymap. |