| title | Building from Source |
|---|
The custom firmware uses an overlay system to modify the base Snapmaker firmware. Overlays are modular modifications that:
- Add patches to modify existing firmware files
- Copy additional files to the firmware root filesystem
- Run build-time scripts to install components
- Enable features without changing the base firmware source
Each overlay is self-contained and numbered to control application order. This modular approach makes it easy to:
- Enable/disable features by including/excluding overlays
- Maintain different firmware profiles (basic vs extended)
- Add custom modifications without conflicts
- Docker installed on your system
The ./dev.sh script automatically sets up a Debian Trixie ARM64 environment with all required dependencies.
Build tools and download firmware:
./dev.sh make tools
./dev.sh make firmwareBuild basic firmware:
./dev.sh make build PROFILE=basic OUTPUT_FILE=firmware/U1_basic.binBuild extended firmware:
./dev.sh make build PROFILE=extended OUTPUT_FILE=firmware/U1_extended.binOpen a shell in the development environment:
./dev.sh bashThe build system supports two profiles:
basic- simple modifications not changing key components of the firmwareextended- extensive modifications changing key components of the firmware
Overlays are organized into categories based on their scope and build profile. Each overlay is numbered to indicate its application order within its category.
- common/ - Core modifications applied to all firmware profiles (basic and extended)
- firmware-basic/ - Modifications specific to the basic firmware profile
- firmware-extended/ - Modifications specific to the extended firmware profile
- devel/ - Development tools and utilities (only included with DEVEL=1 flag)
- staging/ - Disabled overlays kept for potential future use
basic-develorextended-devel- Add development overlays fromoverlays/devel/to the selected profile- e.g.
./dev.sh make build PROFILE=extended DEVEL=1
- e.g.
When running firmware built with the -devel profile, additional development tools are available:
Entware Package Manager
The Entware is considered highly untrusted component, and might be removed at any point in the future without notice.
The devel profile includes Entware support for installing additional packages. After booting the devel firmware, initialize Entware:
entware-ctrl initThis sets up the Entware environment in /userdata/extended/entware and installs the bootstrap packages.
Other entware-ctrl commands:
entware-ctrl start- Activate Entware (mount /opt)entware-ctrl stop- Deactivate Entware (unmount /opt)entware-ctrl nuke- Remove Entware installation completely
Once initialized, use opkg to install packages from the Entware repository.
├── common/ Core overlays applied to all profiles
├── devel/ Devel overlays applied to all profiles when `-devel`
└── firmware-${profile}/ Profile-specific firmware overlays
Each overlay directory can contain:
patches/- Patch files applied to extracted firmwareroot/- Files copied to firmware root filesystemscripts/- Build-time scripts executed during firmware buildpre-scripts/- Scripts executed before main build process
Overlays are applied in the following order:
- All overlays from
common/(in numeric order) - Profile-specific overlays from
firmware-${profile}/(in numeric order)
The 20-klipper-patches overlay in firmware-extended/ backports upstream Klipper commits. To add new patches:
-
Download the commit as a patch from GitHub:
wget https://github.com/Klipper3d/klipper/commit/16fc46fe5.patch -O 01_16fc46fe5.patch
GitHub serves any commit as a patch by appending
.patchto the commit URL. -
Name with order prefix and commit hash:
01_16fc46fe5.patch 02_6d1256ddc.patch 03_16b4b6b30.patch -
Place in the target path within the overlay:
overlays/firmware-extended/20-klipper-patches/patches/home/lava/klipper/The
patches/directory maps to the firmware root, sopatches/home/lava/klipper/applies patches to/home/lava/klipper/where Klipper is installed. -
Edit the patch to remove irrelevant hunks: Upstream commits often include
docs/and config changes that don't apply. Remove those hunks, keeping only the Python code changes inklippy/. -
Document in the overlay README: Update
20-klipper-patches/README.mdwith links to the upstream commits.
.
├── .github/ Automated release builds
├── overlays/ Profile overlay directories
│ ├── common/ Core overlays for all profiles
│ ├── devel/ Devel overlays for all profiles
│ └── firmware-${profile}/ Profile-specific firmware overlays
├── firmware/ Downloaded and generated firmware files
├── scripts/ Build and modification scripts
├── tmp/ Temporary build artifacts
├── tools/ Firmware manipulation tools
│ ├── rk2918_tools/ Rockchip image tools
│ └── upfile/ Firmware unpacking tool
├── Makefile Build configuration
└── vars.mk Firmware version and kernel configuration
Edit vars.mk to configure base firmware and kernel.
To extract and examine the base firmware:
./dev.sh make extractOutput: tmp/extracted/
To build and deploy firmware directly to a connected printer:
./dev.sh ./scripts/dev/upgrade-firmware.sh root@<printer-ip> <profile>Example:
./dev.sh ./scripts/dev/upgrade-firmware.sh root@192.168.1.100 extendedBy default, the script uses snapmaker as the SSH password. To use a different password:
PASSWORD=mypassword ./dev.sh ./scripts/dev/upgrade-firmware.sh root@192.168.1.100 extendedThe project uses GitHub Actions for automated releases:
- Changes pushed to
maintrigger a pre-release build - Both basic and extended firmwares are built
- Version is auto-incremented using
scripts/next_version.sh - Release artifacts are published to GitHub Releases
afptool- Android firmware package toolimg_maker- Create Rockchip imagesimg_unpack- Unpack Rockchip imagesmkkrnlimg- Create kernel images
Firmware unpacking utility for Snapmaker update files.