Skip to content

Commit a23aa00

Browse files
authored
Add ZMK_BOARD_COMPAT symbol, that we can enable for our ZMK variants (#3265)
feat: Add ZMK_BOARD_COMPAT Kconfig symbol, and check for it To properly detect users selecting a base board ID, when a ZMK variant is available, add a ZMK_BOARD_COMPAT Kconfig symbol that the ZMK variants will enable, allowing us to detect using the bare varand and warn/error in CI so users don't end up with passing CI that results in an unusable firmware due to missing ZMK enablement for keyboard name, settings storage, etc. refactor(boards): Add ZMK_BOARD_COMPAT to ZMK board variants To clearly indicate the ZMK board variants are set up for ZMK usage, select the ZMK_BOARD_COMPAT symbols for them. fix(boards): Fix pillbug board.yml to report extension Properly not the ZMK variant is part of an extension of the existing pillbug board.
1 parent 2a9ac3b commit a23aa00

39 files changed

Lines changed: 155 additions & 12 deletions

File tree

.github/workflows/build-user-config.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,24 @@ jobs:
147147
echo "See also the [list of released versions](https://github.com/zmkfirmware/zmk/releases)." >> $GITHUB_STEP_SUMMARY
148148
echo "If you wish to stay on main, check the most recent pending release PR for breaking changes. [Our blog](https://zmk.dev/blog) may have upgrade information if breaking changes are significant." >> $GITHUB_STEP_SUMMARY
149149
150+
- name: Check if building a board without explicit ZMK compat
151+
if: always()
152+
working-directory: ${{ env.base_dir }}/zmk/app
153+
run: |
154+
if ! (grep "CONFIG_ZMK_BOARD_COMPAT=y" "${{ env.build_dir }}/zephyr/.config" > /dev/null)
155+
then
156+
original_board=$(echo "${{ matrix.board }}" | sed -e 's$/.*$$')
157+
west boards --board-root module --board-root . --board "${original_board}" --format "{qualifiers}" | grep "zmk" > /dev/null
158+
159+
if [ $? -ne 0 ]
160+
then
161+
echo "::warning file=build/zephyr/.config,title=Missing ZMK Compat::The selected board does not report explicit ZMK compat. Please verify you've selected the correct board and ZMK variant if one exists"
162+
else
163+
echo "::error file=build/zephyr/.config,title=Missing ZMK Compat::The selected board is not set up for ZMK and there is a ZMK variant available. See https://zmk.dev/blog/2025/12/09/zephyr-4-1#zmk-board-variant."
164+
exit 1
165+
fi
166+
fi
167+
150168
- name: ${{ env.display_name }} Kconfig file
151169
run: |
152170
if [ -f "${{ env.build_dir }}/zephyr/.config" ]

app/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ mainmenu "ZMK Firmware"
55

66
menu "ZMK"
77

8+
config ZMK_BOARD_COMPAT
9+
bool
10+
help
11+
Hidden symbol used to hint that a board has been specifically
12+
set up with various ZMK requirements in mind, e.g. settings
13+
storage, bootloader integration, etc.
14+
15+
Failure to set this will warn users they may want to verify they
16+
used a ZMK variant of an upstream board, or are using a board
17+
properly migrated to a newer ZMK version.
18+
819
menu "Basic Keyboard Setup"
920

1021
config ZMK_KEYBOARD_NAME
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2026 The ZMK Contributors
2+
# SPDX-License-Identifier: MIT
3+
4+
config BOARD_ADAFRUIT_KB2040
5+
select ZMK_BOARD_COMPAT if BOARD_ADAFRUIT_KB2040_RP2040_ZMK
6+
imply RETAINED_MEM if BOARD_ADAFRUIT_KB2040_RP2040_ZMK
7+
imply RETENTION if BOARD_ADAFRUIT_KB2040_RP2040_ZMK
8+
imply RETENTION_BOOT_MODE if BOARD_ADAFRUIT_KB2040_RP2040_ZMK
9+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2026 The ZMK Contributors
2+
# SPDX-License-Identifier: MIT
3+
4+
config BOARD_ADAFRUIT_QT_PY_RP2040
5+
select ZMK_BOARD_COMPAT if BOARD_ADAFRUIT_QT_PY_RP2040_RP2040_ZMK
6+
imply RETAINED_MEM if BOARD_ADAFRUIT_QT_PY_RP2040_RP2040_ZMK
7+
imply RETENTION if BOARD_ADAFRUIT_QT_PY_RP2040_RP2040_ZMK
8+
imply RETENTION_BOOT_MODE if BOARD_ADAFRUIT_QT_PY_RP2040_RP2040_ZMK
9+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2026 Pete Johanson
2+
# SPDX-License-Identifier: MIT
3+
4+
config BOARD_BOARDSOURCE_BLOK
5+
select ZMK_BOARD_COMPAT if BOARD_BOARDSOURCE_BLOK_RP2040_ZMK
6+
imply RETAINED_MEM if BOARD_BOARDSOURCE_BLOK_RP2040_ZMK
7+
imply RETENTION if BOARD_BOARDSOURCE_BLOK_RP2040_ZMK
8+
imply RETENTION_BOOT_MODE if BOARD_BOARDSOURCE_BLOK_RP2040_ZMK
9+

app/boards/joric/nrfmicro/Kconfig.nrfmicro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ config BOARD_NRFMICRO
77
select SOC_NRF52840_QIAA if BOARD_NRFMICRO_NRF52840_ZMK
88
select SOC_NRF52840_QIAA if BOARD_NRFMICRO_NRF52840_FLIPPED_ZMK
99
select SOC_NRF52833_QIAA if BOARD_NRFMICRO_NRF52833_ZMK
10+
select ZMK_BOARD_COMPAT if BOARD_NRFMICRO_NRF52840_ZMK || BOARD_NRFMICRO_NRF52840_FLIPPED_ZMK || BOARD_NRFMICRO_NRF52833_ZMK
1011
imply RETAINED_MEM if BOARD_NRFMICRO_NRF52840_ZMK || BOARD_NRFMICRO_NRF52840_FLIPPED_ZMK || BOARD_NRFMICRO_NRF52833_ZMK
1112
imply RETENTION if BOARD_NRFMICRO_NRF52840_ZMK || BOARD_NRFMICRO_NRF52840_FLIPPED_ZMK || BOARD_NRFMICRO_NRF52833_ZMK
1213
imply RETENTION_BOOT_MODE if BOARD_NRFMICRO_NRF52840_ZMK || BOARD_NRFMICRO_NRF52840_FLIPPED_ZMK || BOARD_NRFMICRO_NRF52833_ZMK

app/boards/jpconstantineau/bluemicro840/Kconfig.bluemicro840

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
config BOARD_BLUEMICRO840
55
select SOC_NRF52840_QIAA
6+
select ZMK_BOARD_COMPAT if BOARD_BLUEMICRO840_NRF52840_ZMK
67
imply RETAINED_MEM if BOARD_BLUEMICRO840_NRF52840_ZMK
78
imply RETENTION if BOARD_BLUEMICRO840_NRF52840_ZMK
89
imply RETENTION_BOOT_MODE if BOARD_BLUEMICRO840_NRF52840_ZMK

app/boards/kbdfans/tofu65/Kconfig.tofu65

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
config BOARD_TOFU65
55
select SOC_RP2040
6+
select ZMK_BOARD_COMPAT
67
imply RETAINED_MEM
78
imply RETENTION
89
imply RETENTION_BOOT_MODE

app/boards/keebio/bdn9/Kconfig.bdn9

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33

44
config BOARD_BDN9
55
select SOC_STM32F072XB
6+
select ZMK_BOARD_COMPAT

app/boards/keycapsss/puchi_ble/Kconfig.puchi_ble

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
config BOARD_PUCHI_BLE
77
select SOC_NRF52840_QIAA
8+
select ZMK_BOARD_COMPAT if BOARD_PUCHI_BLE_NRF52840_ZMK
89
imply RETAINED_MEM if BOARD_PUCHI_BLE_NRF52840_ZMK
910
imply RETENTION if BOARD_PUCHI_BLE_NRF52840_ZMK
1011
imply RETENTION_BOOT_MODE if BOARD_PUCHI_BLE_NRF52840_ZMK

0 commit comments

Comments
 (0)