Compare commits
5 Commits
415c9757a6
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 556163a92b | |||
| cf2ea7f478 | |||
| 5b8566e69c | |||
| 72175f4fdb | |||
| 7a5e040c38 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.tmp/
|
||||||
262
docs/00-series-overview.md
Normal file
262
docs/00-series-overview.md
Normal file
@@ -0,0 +1,262 @@
|
|||||||
|
# OTA Reference Design
|
||||||
|
|
||||||
|
> A practical guide to designing reliable, secure, and maintainable over-the-air (OTA) update systems for embedded Linux devices.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## About This Repository
|
||||||
|
|
||||||
|
This repository presents a practical reference design for building over-the-air (OTA) update systems for embedded Linux devices.
|
||||||
|
|
||||||
|
Rather than documenting a particular framework or vendor-specific solution, it focuses on the engineering principles that make OTA systems reliable, secure, and maintainable.
|
||||||
|
|
||||||
|
The goal is to explain **why** modern OTA systems are designed the way they are, what problems they solve, and what trade-offs different approaches involve.
|
||||||
|
|
||||||
|
Although many examples use Raspberry Pi as a demonstration platform, the concepts are applicable to a wide range of embedded Linux systems.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Why This Repository Exists
|
||||||
|
|
||||||
|
There is no shortage of documentation for OTA frameworks.
|
||||||
|
|
||||||
|
You can easily find documentation for tools such as:
|
||||||
|
|
||||||
|
- Mender
|
||||||
|
- RAUC
|
||||||
|
- SWUpdate
|
||||||
|
- OSTree
|
||||||
|
- A/B Updates
|
||||||
|
|
||||||
|
However, these resources usually explain **how to use a particular tool**, not **why OTA systems are designed this way**.
|
||||||
|
|
||||||
|
Questions like these are often left unanswered:
|
||||||
|
|
||||||
|
- Why do many devices use A/B partitions?
|
||||||
|
- Why are bootloaders involved in the update process?
|
||||||
|
- Why is rollback necessary?
|
||||||
|
- What happens if power is lost during an update?
|
||||||
|
- Why are update images signed?
|
||||||
|
- Why are atomic updates important?
|
||||||
|
- How do production devices remain recoverable after failures?
|
||||||
|
|
||||||
|
This repository attempts to answer those engineering questions.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## What You'll Learn
|
||||||
|
|
||||||
|
Throughout this series we will explore topics including:
|
||||||
|
|
||||||
|
- OTA architecture
|
||||||
|
- Boot process
|
||||||
|
- Update strategies
|
||||||
|
- Full-image vs package updates
|
||||||
|
- A/B partition layouts
|
||||||
|
- Bootloader interaction
|
||||||
|
- Rollback mechanisms
|
||||||
|
- Atomic updates
|
||||||
|
- Image verification
|
||||||
|
- Digital signatures
|
||||||
|
- Secure Boot
|
||||||
|
- Failure recovery
|
||||||
|
- Delta updates
|
||||||
|
- Version management
|
||||||
|
- Testing strategies
|
||||||
|
- Production deployment considerations
|
||||||
|
|
||||||
|
The emphasis is always on understanding the underlying design rather than memorizing a particular implementation.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Repository Structure
|
||||||
|
|
||||||
|
```text
|
||||||
|
ota-reference-design/
|
||||||
|
│
|
||||||
|
├── docs/
|
||||||
|
│ ├── 00-series-overview.md
|
||||||
|
│ ├── 01-ota-introduction.md
|
||||||
|
│ ├── 02-update-strategies.md
|
||||||
|
│ ├── ...
|
||||||
|
│
|
||||||
|
├── diagrams/
|
||||||
|
│ └── plantuml/
|
||||||
|
│
|
||||||
|
├── examples/
|
||||||
|
│ ├── raspberry-pi/
|
||||||
|
│ ├── qemu/
|
||||||
|
│ └── simulations/
|
||||||
|
│
|
||||||
|
├── adr/
|
||||||
|
│ ├── ADR-001-repository-name.md
|
||||||
|
│ ├── ADR-002-license.md
|
||||||
|
│ └── ADR-003-reference-design.md
|
||||||
|
│
|
||||||
|
└── README.md
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Learning Path
|
||||||
|
|
||||||
|
The chapters are designed to build on each other.
|
||||||
|
|
||||||
|
```text
|
||||||
|
Introduction
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
Update Strategies
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
System Architecture
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
Boot Process
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
Storage Layout
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
Atomic Updates
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
Rollback
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
Security
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
Testing
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
Production Deployment
|
||||||
|
```
|
||||||
|
|
||||||
|
While each chapter can be read independently, following the series in order provides a much deeper understanding of the complete system.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Engineering Philosophy
|
||||||
|
|
||||||
|
This repository is intentionally different from product documentation.
|
||||||
|
|
||||||
|
Instead of presenting a single "correct" solution, every topic discusses:
|
||||||
|
|
||||||
|
- why a particular design exists;
|
||||||
|
- which problem it solves;
|
||||||
|
- what alternatives are available;
|
||||||
|
- what trade-offs each approach introduces;
|
||||||
|
- when another solution may be more appropriate.
|
||||||
|
|
||||||
|
Real-world engineering is rarely about choosing the only correct answer.
|
||||||
|
|
||||||
|
It is about understanding constraints and making informed decisions.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## The Reference Design
|
||||||
|
|
||||||
|
The architecture presented throughout this repository is a coherent reference design.
|
||||||
|
|
||||||
|
Real products may use different technologies or frameworks while following the same architectural principles.
|
||||||
|
|
||||||
|
For example, one project may use RAUC, another SWUpdate, and another a completely custom implementation.
|
||||||
|
|
||||||
|
The implementation details may differ.
|
||||||
|
|
||||||
|
The underlying engineering principles usually do not.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Practical Examples
|
||||||
|
|
||||||
|
Where possible, theoretical discussions are accompanied by practical material, including:
|
||||||
|
|
||||||
|
- architecture diagrams
|
||||||
|
- boot sequence walkthroughs
|
||||||
|
- storage layout examples
|
||||||
|
- failure scenarios
|
||||||
|
- Raspberry Pi demonstrations
|
||||||
|
- QEMU-based experiments
|
||||||
|
- implementation notes
|
||||||
|
|
||||||
|
The objective is to connect high-level architecture with practical implementation.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Intended Audience
|
||||||
|
|
||||||
|
This repository is intended for:
|
||||||
|
|
||||||
|
- Embedded Linux developers
|
||||||
|
- Firmware engineers
|
||||||
|
- Embedded software engineers
|
||||||
|
- System architects
|
||||||
|
- Students learning embedded systems
|
||||||
|
- Engineers preparing for technical interviews
|
||||||
|
- Anyone interested in understanding OTA system design
|
||||||
|
|
||||||
|
No prior experience with OTA frameworks is assumed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## How to Read This Repository
|
||||||
|
|
||||||
|
If you are new to OTA systems, simply start with Chapter 1 and continue in order.
|
||||||
|
|
||||||
|
If you already have embedded Linux experience, feel free to jump directly to topics that interest you.
|
||||||
|
|
||||||
|
If you are looking for implementation details, the accompanying examples provide practical demonstrations of the concepts discussed in the documentation.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## OTA at a Glance
|
||||||
|
|
||||||
|
The following diagram illustrates the overall update lifecycle that will be explored throughout this repository.
|
||||||
|
|
||||||
|
```text
|
||||||
|
OTA Server
|
||||||
|
│
|
||||||
|
Signed Update
|
||||||
|
│
|
||||||
|
┌───────────▼───────────┐
|
||||||
|
│ Download Manager │
|
||||||
|
└───────────┬───────────┘
|
||||||
|
│
|
||||||
|
Verify Signature
|
||||||
|
│
|
||||||
|
Verify Integrity
|
||||||
|
│
|
||||||
|
Install Update
|
||||||
|
│
|
||||||
|
Mark Boot Target
|
||||||
|
│
|
||||||
|
Reboot Device
|
||||||
|
│
|
||||||
|
Bootloader Decision
|
||||||
|
┌─────────┴─────────┐
|
||||||
|
│ │
|
||||||
|
Boot Success Boot Failure
|
||||||
|
│ │
|
||||||
|
▼ ▼
|
||||||
|
Commit Update Rollback
|
||||||
|
```
|
||||||
|
|
||||||
|
Each stage of this process will be examined in detail in the chapters that follow.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Contributions, suggestions, and discussions are welcome.
|
||||||
|
|
||||||
|
If you have ideas for improvements, additional examples, or alternative approaches, feel free to open an issue or submit a pull request.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This repository is released under the MIT License.
|
||||||
|
|
||||||
|
See the LICENSE file for details.
|
||||||
227
docs/01-what-is-an-ota-update.md
Normal file
227
docs/01-what-is-an-ota-update.md
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
# What Is an OTA Update?
|
||||||
|
|
||||||
|
> **Series:** OTA Reference Design
|
||||||
|
>
|
||||||
|
> This article is the first chapter of a practical reference design describing how reliable and secure over-the-air software updates are built for embedded Linux devices.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Introduction
|
||||||
|
|
||||||
|
Almost every modern connected device receives software updates remotely.
|
||||||
|
|
||||||
|
Phones do it.
|
||||||
|
|
||||||
|
Cars do it.
|
||||||
|
|
||||||
|
Industrial controllers do it.
|
||||||
|
|
||||||
|
Medical devices do it.
|
||||||
|
|
||||||
|
Consumer electronics quietly update themselves while nobody is watching.
|
||||||
|
|
||||||
|
This process is commonly known as an **Over-the-Air (OTA) update**.
|
||||||
|
|
||||||
|
At first glance, the idea seems simple:
|
||||||
|
|
||||||
|
> Download new software and install it.
|
||||||
|
|
||||||
|
In reality, OTA is one of the most challenging reliability problems in embedded systems.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Why OTA Is Different
|
||||||
|
|
||||||
|
Updating software on a desktop computer is usually forgiving.
|
||||||
|
|
||||||
|
If something goes wrong, the user can often retry the installation, download the package again, or reinstall the operating system.
|
||||||
|
|
||||||
|
Embedded devices rarely have that luxury.
|
||||||
|
|
||||||
|
Imagine a device installed:
|
||||||
|
|
||||||
|
- on the roof of a building;
|
||||||
|
- inside industrial equipment;
|
||||||
|
- on a remote oil pipeline;
|
||||||
|
- in a laboratory instrument;
|
||||||
|
- in an autonomous vehicle.
|
||||||
|
|
||||||
|
A failed update may leave the device completely unreachable.
|
||||||
|
|
||||||
|
Nobody may be available to reconnect a keyboard, attach a monitor, or reflash storage.
|
||||||
|
|
||||||
|
For embedded systems, software updates must be designed with failure as an expected condition rather than an exceptional one.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# The Real Problem
|
||||||
|
|
||||||
|
The primary goal of an OTA system is surprisingly simple:
|
||||||
|
|
||||||
|
> **Replace the software while always preserving a path to recovery.**
|
||||||
|
|
||||||
|
Everything else exists to support this objective.
|
||||||
|
|
||||||
|
Notice that this definition says nothing about how the update is delivered or installed.
|
||||||
|
|
||||||
|
The engineering problem remains the same regardless of the implementation.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Many Ways to Solve the Same Problem
|
||||||
|
|
||||||
|
Different products solve OTA updates in different ways.
|
||||||
|
|
||||||
|
An update may be based on:
|
||||||
|
|
||||||
|
- complete system images;
|
||||||
|
- software packages;
|
||||||
|
- application bundles;
|
||||||
|
- containers;
|
||||||
|
- custom update formats.
|
||||||
|
|
||||||
|
These are implementation choices.
|
||||||
|
|
||||||
|
Each approach has its own strengths, weaknesses, and trade-offs.
|
||||||
|
|
||||||
|
Throughout this series we will explore these options and discuss where each of them makes sense.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Typical Failure Scenarios
|
||||||
|
|
||||||
|
A robust OTA implementation assumes that failures are inevitable.
|
||||||
|
|
||||||
|
Examples include:
|
||||||
|
|
||||||
|
- power loss during installation;
|
||||||
|
- interrupted network connection;
|
||||||
|
- corrupted download;
|
||||||
|
- damaged storage;
|
||||||
|
- software crash during the first boot;
|
||||||
|
- incompatible configuration;
|
||||||
|
- interrupted filesystem writes;
|
||||||
|
- unexpected reboot.
|
||||||
|
|
||||||
|
None of these situations is unusual.
|
||||||
|
|
||||||
|
If enough devices are deployed, every one of them will eventually happen.
|
||||||
|
|
||||||
|
The question is never **if**.
|
||||||
|
|
||||||
|
Only **when**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# OTA Is a System, Not a Feature
|
||||||
|
|
||||||
|
OTA is often imagined as a single application responsible for installing updates.
|
||||||
|
|
||||||
|
In practice, it is an entire system composed of multiple cooperating components.
|
||||||
|
|
||||||
|
A typical embedded Linux solution may include:
|
||||||
|
|
||||||
|
- bootloader;
|
||||||
|
- Linux kernel;
|
||||||
|
- root filesystem;
|
||||||
|
- update agent;
|
||||||
|
- storage layout;
|
||||||
|
- cryptographic verification;
|
||||||
|
- backend services;
|
||||||
|
- device identity;
|
||||||
|
- rollback mechanism;
|
||||||
|
- health monitoring.
|
||||||
|
|
||||||
|
Each component has a specific responsibility.
|
||||||
|
|
||||||
|
Only together do they provide a reliable update process.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# A Better Mental Model
|
||||||
|
|
||||||
|
Instead of thinking:
|
||||||
|
|
||||||
|
```
|
||||||
|
download
|
||||||
|
↓
|
||||||
|
install
|
||||||
|
```
|
||||||
|
|
||||||
|
think:
|
||||||
|
|
||||||
|
```
|
||||||
|
prepare
|
||||||
|
↓
|
||||||
|
verify
|
||||||
|
↓
|
||||||
|
store safely
|
||||||
|
↓
|
||||||
|
activate
|
||||||
|
↓
|
||||||
|
boot
|
||||||
|
↓
|
||||||
|
health check
|
||||||
|
↓
|
||||||
|
commit
|
||||||
|
│
|
||||||
|
└── rollback if necessary
|
||||||
|
```
|
||||||
|
|
||||||
|
Almost every production OTA solution follows some variation of this workflow.
|
||||||
|
|
||||||
|
The individual technologies may differ.
|
||||||
|
|
||||||
|
The underlying principles remain remarkably similar.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# What This Series Covers
|
||||||
|
|
||||||
|
Rather than focusing on a particular framework or vendor, this repository explains the engineering principles behind reliable OTA systems.
|
||||||
|
|
||||||
|
Topics include:
|
||||||
|
|
||||||
|
- OTA architectures;
|
||||||
|
- update strategies;
|
||||||
|
- boot process;
|
||||||
|
- storage layouts;
|
||||||
|
- A/B partitioning;
|
||||||
|
- rollback mechanisms;
|
||||||
|
- image verification;
|
||||||
|
- cryptographic signatures;
|
||||||
|
- update servers;
|
||||||
|
- recovery strategies;
|
||||||
|
- production considerations.
|
||||||
|
|
||||||
|
Examples will use embedded Linux running on Raspberry Pi, but the concepts apply to many embedded platforms.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
|
||||||
|
OTA updates are often described as "remote software updates."
|
||||||
|
|
||||||
|
While technically correct, this definition misses the real engineering challenge.
|
||||||
|
|
||||||
|
The true objective is ensuring that **the device remains recoverable after every possible failure during the update process.**
|
||||||
|
|
||||||
|
Everything else—from storage layouts to cryptographic signatures—exists to support that goal.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Key Takeaways
|
||||||
|
|
||||||
|
- OTA is fundamentally a reliability problem.
|
||||||
|
- Failures must be expected, not treated as exceptions.
|
||||||
|
- Multiple implementation strategies exist for OTA systems.
|
||||||
|
- The core objective is always safe recovery.
|
||||||
|
- Technologies change, but the engineering principles remain the same.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Next Article
|
||||||
|
|
||||||
|
The next chapter explores the first major architectural decision in any OTA system:
|
||||||
|
|
||||||
|
> **Update Strategies: Full Images, Packages, or Something Else?**
|
||||||
27
readme.md
27
readme.md
@@ -1,5 +1,28 @@
|
|||||||
# ota-reference-design
|
# ota-reference-design
|
||||||
|
|
||||||
A practical reference design for reliable and secure over-the-air updates on embedded Linux
|
A practical reference design for reliable and secure over-the-air updates on embedded Linux.
|
||||||
|
|
||||||
This repository is intended as an educational reference design. It demonstrates one possible approach to building a reliable OTA update system for embedded Linux. It is not intended to be a production-ready framework.
|
This repository is intended as an educational reference design. It demonstrates one possible approach to designing and implementing a reliable OTA update system for embedded Linux.
|
||||||
|
|
||||||
|
The project focuses on the engineering decisions behind OTA systems, including:
|
||||||
|
|
||||||
|
* update strategies;
|
||||||
|
* system and storage architecture;
|
||||||
|
* bootloader interaction;
|
||||||
|
* atomic updates;
|
||||||
|
* rollback and recovery;
|
||||||
|
* integrity verification and signing;
|
||||||
|
* testing and failure handling.
|
||||||
|
|
||||||
|
It is not tied to a specific OTA framework, hardware platform, or cloud provider.
|
||||||
|
|
||||||
|
Raspberry Pi may be used for practical demonstrations, but the underlying concepts are applicable to a broader range of embedded Linux devices.
|
||||||
|
|
||||||
|
This repository is not intended to be a production-ready framework. Instead, it is designed to explain the architectural principles, trade-offs, and failure scenarios that should be considered when building a real OTA system.
|
||||||
|
|
||||||
|
The repository is being developed incrementally as a structured series of articles, diagrams, architecture decisions, and practical examples.
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
|
||||||
|
|||||||
Reference in New Issue
Block a user