PRINTDECKDOCS

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.

PRINTDECKFAT: autoboot.txtboot AFATboot BFATroot AEROFS, read-onlyroot BEROFS, read-onlydataext4: /etc, /varThe SD card. Example: the system runs from slot A, and the update goes to slot B.Bundledownload or/system uploadCheckEd25519 signatureof SHA256SUMSWritethe other slottrybootrestart one timeinto the new slotStart OK?Klipper andthe screen startCommitprintdeck-commitnew default slotyesDuring a print: stagedwritten slowly in the backgroundrestart when idle, or Restart nowa print runsidleOld slotthe Pi starts it againno
Figure 25. The A/B update. The firmware of the Pi selects the slot with 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

  1. The system helper checks the Ed25519 signature of SHA256SUMS, and then the SHA-256 of each file of the bundle.
  2. It writes the other slot.
  3. With no print, the Pi restarts with tryboot into the new slot, one time.
  4. When Klipper and the touch screen start, printdeck-commit changes autoboot.txt, and the new slot becomes the default.
  5. When they fail, the next restart starts the old slot again. panic=10 restarts 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.

Back: 8 The appsContentsNext: A API routes