Architecture · Chapter 9
Updates
The disk has two system slots. An update writes the slot that does not run, and the Pi tries it once before it keeps it.
autoboot.txt and tryboot.9.1 The image and the slots
Each slot has a boot partition (FAT) and a root file system (EROFS, read-only). The data partition (ext4) is a writable layer over /etc, /var, /home and /root. It keeps the identity, the history and the settings of the deck across updates. The deck looks for a new GitHub release one minute after the start, and then once a day. Machine, Software update on the touch screen installs it. The page /system also accepts an update bundle.
9.2 The steps
- The system helper checks the Ed25519 signature of
SHA256SUMS, and then the SHA-256 of each file of the bundle. - It writes the other slot.
- With no print, the Pi restarts with
trybootinto the new slot, one time. - When Klipper and the touch screen start,
printdeck-commitchangesautoboot.txt, and the new slot becomes the default. - When they fail, the next restart starts the old slot again.
panic=10restarts the Pi after a kernel panic.
9.3 An update during a print
An install during a print does not stop the print. The helper writes the other slot at 4 MB a second, with nice 19 and the idle I/O class, because Klipper reads the G-code from the same SD card. The update is then staged: /run/printdeck-update/staged.json names it, and its root file system is mounted read-only at /run/printdeck-next. autoboot.txt does not change.
The deck restarts into the new slot when the printer is idle after the print. Idle means no print, no heater with a target, no touch for 2 minutes, and the bed at 35 °C or cooler. After 30 minutes, a warm bed does not stop the restart.
Restart the screen now. During the print, this key runs the deck program of the update in place of the old one. First the deck checks that the new program has the same interface version as the running Klipper host. Then it writes the time lapse frames and the state of the share link to RAM, and ends. The new program reads them, so the time lapse and the share link continue. The screen is dark for a few seconds, and Klipper keeps the print. After the print, the Pi restarts into the new slot, and Klipper then updates too.
On resindeck, the ChiTu board prints a file from its own storage, after the deck sent it. The deck reads the progress over UDP.