UNIT 15 · BUILDING RELIABLE SYSTEMS
Firmware Updates and Security
Ship new firmware without bricking the device or trusting strangers.
A device in the field will need new firmware: a bug fix, a new feature, a security patch. Updating it means replacing the program that is running, possibly over an unreliable link, possibly with the power failing halfway, and possibly with someone else trying to slip in firmware of their own. This unit is about doing that safely.
The unit in six ideas
- 1A bootloader that runs at every reset and is never replaced during an update makes field updates possible; the application moves to a slot of its own.
- 2A CRC catches random corruption well, but it is public and linear: anyone who changes an image can fix its CRC.
- 3Download into the secondary slot first; the running image is untouched until the bootloader installs the new one.
- 4Secure boot is a chain: each stage verifies the next, and the chain rests on an immutable first stage and root-of-trust public key.
- 5Assume anything stored in a device can be extracted; count how many devices one extraction exposes.
- 6MCUboot compares major, minor and revision in order; the build number counts only with
MCUBOOT_VERSION_CMP_USE_BUILD_NUMBER.
Lessons
Application Images and Bootloaders
What has to be on the device from the day it ships so that new firmware can be installed, and so that a failed installation can still be recovered?
Image Integrity and Authenticity
Which checks answer which question, and what must stay secret for the answer to hold?
Safe Updates, Rollback, and Recovery
And if the new image boots but crashes a second later, does it stay crashed forever?
Secure Boot and the Root of Trust
Where does the chain of “who checks whom” have to end for any of it to mean something?
Protecting Keys, Debug Ports, and Device Identity
So where do the keys actually live, who can read them, and what does an attacker gain by buying one of your devices, opening it and extracting everything inside?
Versioning, Diagnostics, and Field Maintenance
And when you ship the next release, how do you find out it is failing before it reaches everyone?