TLTR: Unofficial support of Makerbase MKS PI and MKS SKIPR and other boards. Contains mkspi
board declaration and related kernel and u-boot patches.
Please note, result Armbian image is not full replacement for mks distributed image. You have to do yourself all OS configuration and and Klipper components installation.
WIP, absolutely no guarantees, you do everything at your own risk.
The MKS-PI ads look good, especially considering the price and the display (e.g. the size fits the Ghost Flying Bear printer). However, the software and support from the manufacturer is terrible.
There is no source code (yeah, GPL license, of course), no answer to questions, etc. They provide preconfigured Armbian+Klipper, but the image contains random/outdated components and I have problems with WIFI adapters. And who knows what else is hidden in there.
So the idea was to build a normal Armbian image using the available information (provided patches, circuitry and information from the native image).
Make Armbian build with current
and edge
kernels.
Please note:
current
and edge
kernels). Feel free to open PRs if you would need non LTS Ubuntu or Debian images.Supported boards:
MKS IPS50 LCD - works starting from 0.3.1-24.2.0-trunk
version.
A build-essential
and kernel header packages are preinstalled starting from 0.3.2-24.2.0-trunk
version. It should simplify Klipper installation and building custom kernel modules (e.g. WIFI modules like RTL8188GU (RTL8710B) one).
Images should be ready for a daily usage. Everything seem to be workes, however please pay attantion:
TLTR: Do not forget about klipper_mcu installation.
Full version:
ls -al /dev/spi*
should show /dev/spidev0.2
device filecd ~
git clone https://github.com/th33xitus/kiauh.git
./kiauh/kiauh.sh
, then 1, 1, 1 and so on.
Step 2: Build and install klipper_mcu
service
# Build and install klipper_mcu binary
cd ~/klipper/
# In the menu, set "Microcontroller Architecture" to "Linux process," then save and exit.
make menuconfig
# Preapre klipper-mcu service
sudo ln -s $PWD/scripts/klipper-mcu.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable klipper-mcu.service
# Stop klipper service and install klipper-mcu binary file
sudo service klipper stop
make flash
# Start klipper_mcu and klipper
sudo systemctl start klipper-mcu klipper-mcu
# Ensure everything is up and running
sudo systemctl status klipper-mcu klipper
printer.cfg
Please double check kernel packages were freezed before running apt update
command. E.g. run sudo armbian-config
and check System
-> Freeze - Disable Armbian kernel updates
item.
Sometimes you need to rotate the image on the screen, for example, when upgrading Flying Bear Ghost 5 printer. To do this you need to change value for rotate
parameter under spi_for_lcd@0
section (configuration for the display) and use touchscreen-inverted-x = <0x01>
and/or touchscreen-inverted-y = <0x01>
parameters for spi_for_touch@1
section (configuration for touchscreen) in /boot/dtb/rockchip/rk3328-roc-cc.dtb
file. Please note, value for touchscreen-inverted-x = <0x01>
or touchscreen-inverted-y = <0x01>
does not affect anything. To disable e.g. y-inversion, whole parameter should be commented out (# touchscreen-inverted-y = <0x01>;
). There are few examples:
rotate = <270>;
(or rotate = <0x10e>;
and touchscreen-inverted-y = <0x01>
rotate = <90>;
and touchscreen-inverted-x = <0x01>
Following commands may be used to perform this configuration:
# Backup
sudo cp /boot/dtb/rockchip/rk3328-roc-cc.dtb /boot/dtb/rockchip/rk3328-roc-cc.dtb.$(date +"%Y%m%d_%H%M%S").bak
# Unpack DTB file
sudo dtc -I dtb -O dts -o rk3328-roc-cc.dts /boot/dtb/rockchip/rk3328-roc-cc.dtb
#Make a copy to work with
sudo cp rk3328-roc-cc.dts rk3328-roc-cc-rotated.dts
# Find `rotate = <SOME_VALUE>` and change to `rotate = <NEW_VALUE>`, where NEW_VALUE is a rotation angle, e.g. `rotate = <90>` or `rotate = <270>`
# Then find `touchscreen-inverted-y` attribute and add or replace `touchscreen-inverted-x` one
nano rk3328-roc-cc-rotated.dts
# Or sed -i -e "s/<0x10e>/<90>/g" rk3328-roc-cc-rotated.dts
# and sed -i -e "s/touchscreen-inverted-y/touchscreen-inverted-x/g" rk3328-roc-cc-rotated.dts
# Double check
less rk3328-roc-cc-rotated.dts | grep rotate
less rk3328-roc-cc-rotated.dts | grep touchscreen-inverted
# Pack DTS to DTB
dtc -I dts -O dtb -o rk3328-roc-cc-rotated.dtb rk3328-roc-cc-rotated.dts
# Update rk3328-roc-cc.dtb with new version
sudo cp rk3328-roc-cc-rotated.dtb /boot/dtb/rockchip/rk3328-roc-cc.dtb
# Reboot
sudo reboot
There are two non obvious points which you should be aware to successfully configure CAN bus:
ifconfig
command out of the box, so Klipper documentation -- USB to CAN bus bridge mode will not properly work.Steps to configure CAN bus:
Configure can0
interface on MKSPI:
cat <<-'EOF' | sudo tee -a /etc/network/interfaces.d/can0
allow-hotplug can0
iface can0 can static
bitrate 1000000 # Ensure it's the same as selected for MCU firmware.
# up ifconfig $IFACE txqueuelen 128 # It will not work because no ifconfig installed by default...
up ip link set $IFACE txqueuelen 128 # ... please use this version instead.
#up ip link set $IFACE txqueuelen 1024 restart-ms 200 # Bit more aggressive configuration
EOF
~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
and follow Klipper documentation -- USB to CAN bus bridge mode for the rest of configuration.In case of MCU 'mcu' shutdown: Timer too close
, b'Got error -1 in can write: (105)No buffer space available'
or similar troubles, please try following steps:
Step 1. Use ip -s link show can0
or/and Moonraker -> Settings -> MCU status to ensure no error/invalid AND no retransmit packages. In case of error/invalid packages please see Step 2
. In case of no error but increasing retransmit packages please refer Step 3
.
Step 2: double check wiring and terminal resistor. A twisted pair for data signals (CAN_L & CAN_H) is almost required for line longer that 20cm.
Step 3. Ensure sudo systemctl --failed
does not show failed units. Otherwice doble check /etc/network/interfaces.d/can0
and ensure that ifconfig
command (from the Klipper documentation) is not used. if@can0
unit must start without any issues.
By default UART2 is used for the kernel debug output (ttyS2, USB Type C connection). Please disable kernel console and double check device file permissions if you need the ttyS2 for any other purposes:
# Or just add console=none to /boot/armbianEnv.txt manually.
echo 'console=none' > sudo tee -a /boot/armbianEnv.txt
# Grant user permissions and prevent getty from taking over the port
echo 'KERNEL=="ttyS2",MODE="0660"' > /etc/udev/rules.d/99-ttyS2.rules
systemctl mask serial-getty@ttyS2.service
A mkspi-uart1
overlay may be used to disable LCD and Touchscreen intefraces and freeup UART1/ttyS1 for custom purposes. e.g. by adding overlays=mkspi-uart1
string to /boot/armbianEnv.txt
file.
This solution was tested on QIDI X-7 (Q1 Pro mainboard) and X-6 printers. Please see Disable kernel console debug messages for ttyS2 #31 for more details.
The new mkspi
board was declared. Now has support only for current
and edge
kernels and Ubuntu Jammy (22.04) and Noble (24.04) OS (CLI and desktop editions). Build process is pretty usual for Armbain build.
I would advice to read official documentation, however it's short version:
cd armbian-mkspi
./compile.sh
and follow instructions... Please do not forget about BSPFREEZE=yes
build arg (or freezing kernel updates via sudo armbian-config
right after the first login). A few ready to use commands:
./compile.sh BOARD=mkspi BRANCH=current RELEASE=jammy BSPFREEZE=yes BUILD_DESKTOP=no BUILD_MINIMAL=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img INSTALL_HEADERS=yes BUILD_KSRC=yes INSTALL_KSRC=yes
./compile.sh BOARD=mkspi BRANCH=edge RELEASE=jammy BSPFREEZE=yes BUILD_DESKTOP=no BUILD_MINIMAL=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img INSTALL_HEADERS=yes BUILD_KSRC=yes INSTALL_KSRC=yes
./compile.sh BOARD=mkspi BRANCH=current RELEASE=noble BSPFREEZE=yes BUILD_DESKTOP=no BUILD_MINIMAL=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img INSTALL_HEADERS=yes BUILD_KSRC=yes INSTALL_KSRC=yes
./compile.sh BOARD=mkspi BRANCH=edge RELEASE=noble BSPFREEZE=yes BUILD_DESKTOP=no BUILD_MINIMAL=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img INSTALL_HEADERS=yes BUILD_KSRC=yes INSTALL_KSRC=yes
./compile.sh BOARD=mkspi BRANCH=current RELEASE=bullseye BSPFREEZE=yes BUILD_DESKTOP=no BUILD_MINIMAL=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img INSTALL_HEADERS=yes BUILD_KSRC=yes INSTALL_KSRC=yes
./compile.sh BOARD=mkspi BRANCH=edge RELEASE=bullseye BSPFREEZE=yes BUILD_DESKTOP=no BUILD_MINIMAL=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img INSTALL_HEADERS=yes BUILD_KSRC=yes INSTALL_KSRC=yes
./compile.sh BOARD=mkspi BRANCH=current RELEASE=bookworm BSPFREEZE=yes BUILD_DESKTOP=no BUILD_MINIMAL=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img INSTALL_HEADERS=yes BUILD_KSRC=yes INSTALL_KSRC=yes
./compile.sh BOARD=mkspi BRANCH=edge RELEASE=bookworm BSPFREEZE=yes BUILD_DESKTOP=no BUILD_MINIMAL=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img INSTALL_HEADERS=yes BUILD_KSRC=yes INSTALL_KSRC=yes
INSTALL_HEADERS=yes BUILD_KSRC=yes INSTALL_KSRC=yes
and BSFREEZE=yes
flags if you will need kernel headers, e.g. to compile custom WiFi drivers./compile.sh BOARD=mkspi BRANCH=current RELEASE=jammy BSPFREEZE=yes BUILD_DESKTOP=no BUILD_MINIMAL=no KERNEL_CONFIGURE=no COMPRESS_OUTPUTIMAGE=sha,gpg,img kernel-patch
output\images\
directoryOrigina Image:
# PLEASE DO NOT EDIT THIS FILE
BOARD=mkspi
BOARD_NAME="mkspi"
BOARDFAMILY=rockchip64
BUILD_REPOSITORY_URL=https://github.com/armbian/build.git
BUILD_REPOSITORY_COMMIT=ed589b248-dirty
VERSION=22.05.0-trunk
LINUXFAMILY=rockchip64
ARCH=arm64
IMAGE_TYPE=user-built
BOARD_TYPE=conf
INITRD_ARCH=arm64
KERNEL_IMAGE_TYPE=Image
BRANCH=edge
/etc/armbian-release (END)
https://github.com/makerbase-mks/armbian-build repo contains random crap (half worked patches for legacy 4.4 Kernel and non full armbian integration)
In generally it's not clear what was changed, however looks like MKS guys were not too creative and almost copy rockchip64/Renegade board. Patches include:
/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts
( redeclaring a few pins, disabling some features and declaring new ones. mostly for MKSPI-TS35 screen)fbtft/fb_ili9341
driver. Basically redefining screen resolution./drivers/gpu/drm/drm_edid.c
and /drivers/gpu/drm/rockchip/inno_hdmi.c
files). However I have no idea what this about and how to apply this patches to new kernel sources.For stable branch use --branch=v24.08
apt-get -y install git
git clone --depth=1 --branch=main https://github.com/armbian/build
cd build
./compile.sh
Show work-in-progress areas in interactive mode:
./compile.sh EXPERT="yes"
Build minimal CLI Armbian Jammy for Bananapi M5 with LTS kernel:
./compile.sh \
BOARD=bananapim5 \
BRANCH=current \
RELEASE=jammy \
BUILD_MINIMAL=yes \
BUILD_DESKTOP=no \
KERNEL_CONFIGURE=no
Build with GitHub actions: (advanced version)
name: "Build Armbian"
on:
workflow_dispatch:
jobs:
build-armbian:
runs-on: ubuntu-latest
steps:
- uses: armbian/build@main
with:
armbian_token: "${{ secrets.GITHUB_TOKEN }}" # GitHub token
armbian_release: "jammy" # userspace
armbian_target: "build" # build=image, kernel=kernel
armbian_board: "bananapim5" # build target
Generated image will be uploaded to your repository release. Note: GitHub upload file limit is 2Gb.
We always need those volunteering positions:
Just apply and follow!
For commercial or prioritized assistance:
Free support:
Find free support via general project search engine, documentation, community forums or IRC/Discord. Remember that our awesome community members mainly provide this in a best-effort manner, so there are no guaranteed solutions.
#armbian
on Libera.chat / oftc.netThank you to all the people who already contributed to Armbian!
Armbian's partnership program helps to support Armbian and the Armbian community! Please take a moment to familiarize yourself with our Partners:
This software is published under the GPL-2.0 License license.