Firmware, installer and updates¶
Three things put OpenCreator on a printer and keep it current: Kalico's update maker builds the firmware for the four boards, the USB installer puts everything on a stock printer, and the OpenCreator updater on the printer follows opencreator-fs from then on. This page covers how each works. For using them, see OpenCreator Installer and Making the configs yours.
MCU firmware¶
All four boards run Kalico firmware: the mainboard (mainBoardGD), the
eBoard, the heaterBoard and the levelBoard. One run of Kalico's
scripts/build_c5_update.py all builds all four from one clean, committed
checkout, checks each build, and writes:
- Stock-style update packages, one per printer model (Creator 5 and
Creator 5 Pro): FlashForge's encrypted USB update format, with the stock
MCU images replaced by these builds, each with a
.sha256and a.manifest.json. The installer flashes these, and tunneled printers can install them from USB the stock way. live/: the four.hexfiles exactly as packaged, theirSHA256SUMS, andVERSION, themcu_versionthe boards will report. This goes into opencreator-fsmcu-firmware/, where the updater picks it up.
The version the boards report is the commit hash of the build. The installer and updater recognise boards that are already current by the first 8 characters of that hash, so a release is built from a checkout without tags.
The build also checks each board's command set against what that board must
and mustn't have. For the mainboard that means the config_mclib command
family and none of the stock library's commands (see
MCLib and motor control).
Three ways onto the boards¶
| Path | Used by | How |
|---|---|---|
| During the install | The installer's 95-flash-mcu-firmware.sh |
Decrypts the package for the printer's model, checks its files, and flashes each board with FlashForge's own tools. Skipped when all four boards already report the package's commit. On FlashForge kernel 2.0.8 it queues the flash for the next power-on instead. |
| Live | The updater, on OpenCreator's kernel | oc-mcu-flash flashes the boards while the printer runs, with no USB stick and no power cycle |
| At power-on | The updater on FlashForge's kernels, the installer on 2.0.8, and any live flash that failed | startup.sh runs mcu-flash-pending/flash.sh before anything wakes the boards |
All three use FlashForge's flashing tools from the stock control package
(/usr/prog/PROGRAM/control/<version>/): ISPCommand for the mainboard and
IAPCommand for the other three. The UARTs are fixed by the wiring:
| Board | UART | Tool | How it gets into its bootloader |
|---|---|---|---|
| mainboard | /dev/ttyS2 |
ISPCommand |
GPIO 50 (BOOT0) high and a reset pulse on GPIO 49, into the chip's ROM bootloader. Afterwards BOOT0 goes low and another reset boots the new firmware. |
| eBoard | /dev/ttyS5 |
IAPCommand |
Live: C5_MCU_BOOTLOADER resets it so FlashForge's boot stage stays resident, as after power-on |
| heaterBoard | /dev/ttyS4 |
IAPCommand |
Same as the eBoard |
| levelboard | /dev/ttyS7 |
IAPCommand |
Its boot stage stays resident after every reset |
The mainboard's bootloader is in ROM and can't be overwritten, and a flash never touches the other boards' boot stage, so a failed flash can be retried.
Flashing live¶
oc-mcu-flash DIR flashes the boards that have a file in DIR:
- Pauses
08-mcu-wake.sh, or it would release the boards from their boot stage. - Sends
C5_MCU_BOOTLOADERthrough Moonraker for the IAP boards; Klipper shuts down. - Pauses Klippy so it leaves the UARTs alone, and saves each port's settings.
- Runs
IAPCommandfor each board (3 tries), thenISPCommandfor the mainboard. - Restores the ports, kills Klippy (
10-klipper.shstarts it again) and resumes the wake script. A trap does this on any exit.
It needs board firmware that has c5_reset_bootloader (flashed once from
USB first) and [c5_mcu_flash] in the config. It logs to
/usr/data/logs/oc-mcu-flash.log.
Flashing at power-on¶
FlashForge's kernels can't flash the boards while Klipper runs. There, and
after a live flash fails, the updater copies the out-of-date boards' files
and the stock tools into /usr/data/opencreator/mcu-flash-pending/ with a
flash.sh, and tells you in the console to power the printer off and on.
At the next power-on, startup.sh (or tunneled.sh) runs it before
anything talks to the boards. It checks the files against SHA256SUMS,
tries each board up to 3 times, and removes the folder once all boards
flashed. It gives up after 3 boots, so a board that never takes it can't
stall every start. Log: /usr/data/logs/oc-mcu-flash-pending.log.
While a flash is queued, the updater doesn't flash live: the queued flash owns the boards.
The installer¶
The OpenCreator Installer is an LVGL touchscreen app on a
USB drive. Stock's app_startup.sh runs runFirmwareExe.sh from the root of
a USB drive at boot, as it would for a FlashForge update; that starts the
installer instead of the normal boot. The app drives scripts/install.sh,
which does the work and reports STAGE, WARN, PROGRESS and ERROR
lines back to the screen.
Checks first¶
Before you choose anything, install.sh check reports:
- the printer model and PID, from the stock boot script (Creator 5 is PID 0028, Creator 5 Pro is 0029);
- the FlashForge kernel package, recognised by its build banner in
/proc/versionthe same way01-fixnan.shdoes it. An unknown kernel blocks the install, because its legacy NaN address isn't known; - the MCU firmware on the drive and what the boards last got;
- the previous install from
install.json, free space (a new install needs 2 GB free on/usr/data; 256 MB free gives a warning), the network, other custom firmware or old Moonraker copies that will be backed up and removed, and whetherfirmwareExewent back to stock since the last install.
The install¶
- Checks the choices, the tools it needs, the kernel and the space.
- Faster storage for the install: raises the eMMC clock to 100 MHz
with the same
emmc_clock.pythe boot uses, and remounts/usr/dataand/usr/progwithout the stocksyncoption, so package installs don't wait for the flash on every write. The option comes back when the installer exits, however it exits. - Backup to the USB drive: FlashForge's
firmwareExe,/usr/prog/moonraker,/usr/data/opencreator, the web UIs, nginx, the tunnel bridge, the boot logo,app_startup.shand the stock timelapse frames, each as a tar archive. Folders that weren't there are listed, so a restore removes them again. Install without backup skips this, but other custom firmware, old Moonraker copies and old FlashForge versions are still archived before they're removed. - Runs the payload steps for the chosen mode, in order. Any failure stops the
install. After every step, and on a failure,
recover-app-startup.shmakes sure stock'sapp_startup.shis still there and executable, so the printer can always boot. - Writes
/usr/data/opencreator/install.json.
The payload steps:
| Step | SoC | Tunnel | What it does |
|---|---|---|---|
01-install-entware.sh |
Yes | Yes | Entware in /usr/data/bin/opt, bind-mounted at /opt, plus the packages the mode needs (below) |
02-install-loopscript.sh |
Yes | Yes | The opencreator-fs startup system: firmwareExe launcher, startup.sh and the scripts |
05-install-python.sh |
Yes | Yes | The hard-float Python in /usr/data/python-hf (an opencreator-fs release asset); skipped when that release is already there |
10-install-stack.sh |
Yes | Kalico in /usr/data/opencreator/klipper/klipper with a virtualenv on the hard-float Python, and the opencreator-fs printer config in klipper/config. A first install imports the printer's input shaper and hotend and bed PID from FlashForge's config. |
|
10-install-tunnel.sh |
Yes | The socat MCU bridge in /usr/prog/c5-tunnel-socat |
|
15-install-moonraker.sh |
Yes | Current Moonraker in /usr/prog/moonraker/moonraker with a virtualenv on the hard-float Python |
|
17-install-timelapse.sh |
Yes | moonraker-timelapse: the Moonraker component and Klipper macros, linked from a clone Moonraker's update manager keeps current | |
20-install-web.sh |
Yes | The latest Mainsail and Fluidd, with nginx serving the chosen one on port 80 | |
30-install-grumpyscreen.sh, 31-install-helixscreen.sh |
Yes | Yes | The chosen touchscreen UI |
85-enable-root.sh, 86-enable-sftp.sh |
Yes | Yes | The root login and SFTP |
88-detect-dryer.sh |
Yes | Turns on printer.dryer.cfg only when a VDS dryer answers on /dev/ttyS3 |
|
90-activate-loopscript.sh |
Yes | Yes | Last: switches to OpenCreator's firmwareExe, the early boot hook and the OpenCreator boot logo. Earlier failures leave the stock ones. |
95-flash-mcu-firmware.sh |
Yes | Yes | Flashes the four boards (above) |
96-flash-camera-firmware.sh |
Yes | Yes | Updates the camera to FlashForge's camera firmware 1226. A camera problem is only a warning. |
Over an existing install the same steps update in place and keep your files and configs; the web UIs are left to Moonraker's update manager. Update Configs compares your choices with the install record and only applies what differs, without a backup.
Entware¶
Entware gives the later steps git, curl, gcc and Python. install.sh puts
/opt/bin ahead of the system's tools only while Entware works
(use_entware): entware_ok checks that opkg runs and that any Entware
tar, grep, find, xz or curl answers --version. A broken one would
otherwise shadow the system's tool and stop the installer before the Entware
step could repair it.
The Entware step repairs what it can:
- An Entware whose
opkgcan't run (half-installed, damaged or the wrong architecture) is moved aside to/usr/data/bin/opt.brokenand installed again. Entware's server sometimes answers busy, so it tries up to five times. - Damaged packages (from an interrupted download, for example) are reinstalled, and gcc is reinstalled if it can't compile a test program.
- At the end it runs the same
--versioncheck asentware_ok. A failing tool owned by a package gets that package reinstalled; a failing file no package owns is moved to/opt/bin/<tool>.broken, so the system's tool is used. Without this, later steps would lose Entware and fail atgit clone, since stock firmware has no git.
Restore and rollback¶
| Action | What it does |
|---|---|
| Restore backup | Unpacks the newest backup from the USB drive and removes folders that didn't exist before. MCU firmware isn't rolled back, and Entware stays. |
| Rollback to stock | Puts only FlashForge's firmwareExe back and removes the early boot hook and login hook. Everything OpenCreator runs is started by its firmwareExe, so the printer boots as stock; OpenCreator's files stay for a reinstall. |
| Full stock reset | Downloads FlashForge's firmwareExe and newest control package (MCU firmware) for the model, checks each against its git blob hash, and leaves the control package where a FlashForge update would, with its update flag, so stock's startup flashes the boards at the next boot. |
The updater¶
opencreator_updater.py runs on the printer from 99-opencreator-updater.sh
(on the hard-float Python). It watches the opencreator-fs checkout
(/usr/data/opencreator/opencreator-fs) every 60 s. That checkout is what
Moonraker's update manager pulls when you update opencreator in Fluidd or
Mainsail. For each new commit it:
- Merges the config templates (every
.cfgunderfs/usr/data/config/) into the live config with a three-way merge against the last version it applied, keeping your edits and theSAVE_CONFIGblock. A conflict leaves your file untouched and writes the attempt beside it as<file>.conflict. A commit marked--urgenttakes the new template for a file that would conflict, and saves yours as<file>.mine. The user view is in Making the configs yours. - Updates OpenCreator's own folders:
startup,firmware,tunneled,moonraker,fluidd,plugin-managerandmcu-flash. Each is copied next to the live folder, the new files laid over the copy, files an older version installed and the new one dropped are removed unless you changed them, and the copy is swapped in. It also updates the nginx snippets, GrumpyScreen's translations, the early boot hook and/usr/prog/PROGRAM/software/firmwareExe(only while that is OpenCreator's launcher, so a rollback to stock stays). - Brings Kalico to the newest commit of its branch, so a config that needs newer Kalico doesn't arrive without it. Not while printing, and not over a checkout with local changes.
- Flashes the MCU firmware when
mcu-firmware/changed (above), only after Moonraker confirms the printer is idle.
It doesn't restart Klipper: restart it yourself to load new configs and
code. New startup scripts run from the next boot. When an update replaces
the updater itself, it restarts within a minute. It logs to
/tmp/opencreator-updater.log. Tunnel SBCs run an identical copy of the
updater, from opencreator-tunnel.
Release channel¶
- opencreator-fs. Every push to
maingets one GitHub release and tag, numbered0.1.xin order, with notes listing every change. A push whose newest commit has-nover(or--nover) in its message as a word of its own gets no release; its commits are listed in the next one. Printers follow themainbranch through Moonraker's update manager, so every commit reaches them, released or not. - Kalico. The updater follows the branch the printer's Kalico checkout is on.
- MCU firmware. Arrives with opencreator-fs in
mcu-firmware/, built bybuild_c5_update.py. - Installer. A separate download (see
OpenCreator Installer); the version that
installed a printer is saved in
install.json.
Moonraker's update manager also lists Kalico, Moonraker, Mainsail and Fluidd, and plugins add their own entries.