Last active
February 15, 2022 17:47
-
-
Save DaoWen/d43354353d9890abe97e288a46b7b697 to your computer and use it in GitHub Desktop.
Helper script for compiling Sonix QMK firmware using a Docker container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
if [[ "$1" == --help ]]; then | |
echo 'Usage:' >&2 | |
echo " $0 [KEYBOARD] [KEYMAP]" >&2 | |
exit 0 | |
fi | |
KEYBOARD=${1:-gmmk/full/rev3} | |
KEYMAP=${2:-default} | |
TARGET=${KEYBOARD////_}_${KEYMAP}.bin | |
: ${QMK_FIRMWARE_DIR:=${PWD}/qmk_firmware} | |
if [[ ! -d "${QMK_FIRMWARE_DIR}" ]]; then | |
echo "Missing QMK firmware directory at: ${QMK_FIRMWARE_DIR}" >&2 | |
echo 'You should either `export QMK_FIRMWARE_DIR`, or run this from the parent directory of your clone.' >&2 | |
exit 1 | |
fi | |
docker run \ | |
--rm -it \ | |
--user=$(id -u):$(id -g) \ | |
--volume="${QMK_FIRMWARE_DIR}:/mnt/qmk_firmware" \ | |
--workdir=/mnt/qmk_firmware \ | |
--entrypoint=qmk \ | |
d3xter93/sonix_base_container \ | |
compile --keyboard ${KEYBOARD} --keymap ${KEYMAP} | |
: ${QMK_OUTPUT_DIR:=${PWD}/custom-firmware} | |
if [[ -e "${QMK_OUTPUT_DIR}" ]]; then | |
cp "${QMK_FIRMWARE_DIR}/.build/${TARGET}" "${QMK_OUTPUT_DIR}/" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment