updated for newer zephyr sdk

This commit is contained in:
Rudis Muiznieks 2022-08-28 10:06:40 -05:00
parent 9cdac705bd
commit 5fb6d19ec2
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
12 changed files with 3415 additions and 46 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
zmk/

30
Dockerfile Normal file
View File

@ -0,0 +1,30 @@
from ubuntu:22.04
env ZSDK_VERSION=0.13.2
run apt update
run apt install -y \
git \
wget \
autoconf \
automake \
build-essential \
bzip2 \
ccache \
device-tree-compiler \
dfu-util \
g++ \
gcc \
libtool \
make \
ninja-build \
cmake \
python3-dev \
python3-pip \
python3-setuptools \
xz-utils
run groupadd -g 1000 builder
run useradd -m -u 1000 -g 1000 -s /bin/bash builder
user builder
workdir /home/builder

9
README.md Normal file
View File

@ -0,0 +1,9 @@
1. Run `build-env.sh`
- checks out a fresh `zmk` and applies patches
- creates and initializes a `zmk` docker image to use for builds
2. Run `build-zmk.sh`
- uses the `zmk` image to build left and right binaries
3. Run `flash.sh`
- flashes the binaries

26
build-env.sh Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
rm -rf zmk
docker build -t zmk .
git clone https://github.com/zmkfirmware/zmk.git
for p in ./patches/*.patch; do
patch -d zmk/ -p1 < "$p"
done
docker run -it --rm -d --name zmk \
-v "$(pwd)/zmk:/home/builder/zmk" \
-v "$(pwd)/zmk-config:/home/builder/zmk-config" \
zmk
docker exec -it zmk \
bash -c 'export PATH=~/.local/bin:$PATH && \
pip3 install -U west pyelftools && \
wget "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_VERSION}/zephyr-toolchain-arm-${ZSDK_VERSION}-linux-x86_64-setup.run" && \
sh "zephyr-toolchain-arm-${ZSDK_VERSION}-linux-x86_64-setup.run" --quiet -- -d ~/.local/zephyr-sdk-${ZSDK_VERSION} && \
rm "zephyr-toolchain-arm-${ZSDK_VERSION}-linux-x86_64-setup.run" && \
cd /home/builder/zmk && west init -l app/ && west update && \
west zephyr-export && pip3 install --user -r zephyr/scripts/requirements-base.txt'
docker commit zmk zmk
docker rm -vf zmk

View File

@ -1,36 +0,0 @@
from ubuntu:20.04
run apt update
run DEBIAN_FRONTEND=noninteractive TZ=America/Chicago apt install -y \
git \
wget \
autoconf \
automake \
build-essential \
bzip2 \
ccache \
device-tree-compiler \
dfu-util \
g++ \
gcc \
libtool \
make \
ninja-build \
cmake \
python3-dev \
python3-pip \
python3-setuptools \
xz-utils
run useradd -m rudism
user rudism
workdir /home/rudism
run pip3 install --user -U west
run echo 'export PATH=~/.local/bin:"$PATH"' >> ~/.bashrc
env ZSDK_VERSION=0.12.4
run wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_VERSION}/zephyr-toolchain-arm-${ZSDK_VERSION}-x86_64-linux-setup.run" && \
sh "zephyr-toolchain-arm-${ZSDK_VERSION}-x86_64-linux-setup.run" --quiet -- -d ~/.local/zephyr-sdk-${ZSDK_VERSION} && \
rm "zephyr-toolchain-arm-${ZSDK_VERSION}-x86_64-linux-setup.run"
copy requirements.txt .
run pip3 install --user -r requirements.txt
run echo source zmk/zephyr/zephyr-env.sh >> ~/.bashrc
entrypoint bash

View File

@ -1,7 +0,0 @@
#!/usr/bin/env bash
cd /home/rudism/zmk/app || exit
west build --pristine -b nice_nano_v2 -- -DZMK_CONFIG=/home/rudism/zmk-config/config -DSHIELD=corne_left
cp /home/rudism/zmk/app/build/zephyr/zmk.uf2 /home/rudism/out/corne_left.uf2
west build --pristine -b nice_nano_v2 -- -DZMK_CONFIG=/home/rudism/zmk-config/config -DSHIELD=corne_right
cp /home/rudism/zmk/app/build/zephyr/zmk.uf2 /home/rudism/out/corne_right.uf2

View File

@ -1,3 +0,0 @@
#!/bin/sh
docker run -it --rm -v `pwd`/build:/home/rudism/build -v `pwd`/out:/home/rudism/out -v `pwd`/zmk:/home/rudism/zmk -v `pwd`/zmk-config:/home/rudism/zmk-config zmk

13
build-zmk.sh Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
docker run -it --rm \
-v "$(pwd)/zmk:/home/builder/zmk" \
-v "$(pwd)/zmk-config:/home/builder/zmk-config" \
-v "$(pwd)/out:/home/builder/out" \
zmk bash -c 'export PATH="~/.local/bin:$PATH" && \
source /home/builder/zmk/zephyr/zephyr-env.sh && \
cd /home/builder/zmk/app && \
west build --pristine -b nice_nano_v2 -- -DZMK_CONFIG=/home/builder/zmk-config -DSHIELD=corne_left && \
cp build/zephyr/zmk.uf2 ~/out/corne_left.uf2 && \
west build --pristine -b nice_nano_v2 -- -DZMK_CONFIG=/home/builder/zmk-config -DSHIELD=corne_right && \
cp build/zephyr/zmk.uf2 ~/out/corne_right.uf2'

BIN
out/corne_left.uf2 Normal file

Binary file not shown.

BIN
out/corne_right.uf2 Normal file

Binary file not shown.

3336
patches/mouse-keys.patch Normal file

File diff suppressed because it is too large Load Diff