Auracaster System - Buildroot with SWUpdate A/B System
This project implements a Buildroot-based system for Raspberry Pi 3 with SWUpdate A/B partitioning for robust over-the-air updates.
Overview
The Auracaster System provides a complete solution for creating a robust embedded Linux system with A/B partition updates using the SWUpdate framework. This allows for safe, reliable updates with automatic rollback capability if an update fails.
Key Features
- A/B Partition System: Two rootfs partitions (A and B) for failsafe updates
- SWUpdate Integration: Web interface for uploading and applying updates
- Automatic Fallback: If an update fails to boot, the system reverts to the previous partition
- Raspberry Pi 3 Support: Optimized for Raspberry Pi 3 hardware
- BR2_EXTERNAL Structure: Follows Buildroot's recommended external tree pattern
Directory Structure
auracaster-system/
├── Config.in # Main config file for BR2_EXTERNAL
├── external.desc # BR2_EXTERNAL description file
├── configs/ # Custom defconfigs
│ └── raspberrypi3_swupdate_defconfig
├── board/ # Board-specific files
│ └── raspberrypi3_swupdate/ # Configuration for RPi3 with SWUpdate
├── package/ # Custom packages
│ └── swupdate-scripts/ # Custom scripts for SWUpdate
├── example/ # Example update package
│ └── create-update-package.sh # Script to create a sample update
└── flash_sdcard.sh # Script to flash SD card
Building the System
Prerequisites
- Buildroot checkout (in
../buildrootrelative to this repository) - Build dependencies for Buildroot (see Buildroot documentation)
- At least 10GB of free disk space
- Root/sudo access (for SD card flashing)
Build Steps
- Configure Buildroot to use this external tree:
cd ../buildroot
make BR2_EXTERNAL=../auracaster-system raspberrypi3_swupdate_defconfig
- Build the system:
make
The build process will take some time (30-60 minutes depending on your system). Once complete, the output images will be in ../buildroot/output/images/.
Flashing to SD Card
Use the provided script to flash the image to your SD card:
sudo ./flash_sdcard.sh
Follow the on-screen prompts to select the correct device and confirm the flashing operation.
Partition Layout
The system uses the following partition layout on the SD card:
- Boot Partition (64MB): Contains bootloader, kernel, and boot configuration
- RootFS A (512MB): First root filesystem partition
- RootFS B (512MB): Second root filesystem partition
- Data Partition (Remaining Space): For persistent data storage
Update Process
Creating an Update Package
Use the provided example script to create an update package:
cd example
./create-update-package.sh
This creates an auracaster-update.swu file that can be applied through the web interface.
Applying an Update via Web Interface
- Boot the Raspberry Pi with the flashed SD card
- Connect to the same network as the Raspberry Pi
- Access the web interface at
http://<raspberry-pi-ip>:8080 - Upload the
.swufile through the web interface - Once the update is complete, reboot the device
- The system will boot from the updated partition
Update Verification
The system will track boot attempts. If the updated system fails to boot properly (as determined by the boot counter mechanism), it will automatically fall back to the previous working partition.
U-Boot Environment
The U-Boot environment manages the A/B boot selection. Key variables include:
active_part: Current active partition (A or B)inactive_part: Partition that will receive updatesbootcount: Number of boot attempts for the current partitionbootlimit: Maximum allowed boot attempts before fallback
Troubleshooting
System Won't Boot
If the system fails to boot completely:
- Connect a monitor to the Raspberry Pi to view boot messages
- If the system is falling back to the previous partition, check the logs for errors
- You can manually force a boot from a specific partition by editing the U-Boot environment
Update Fails
If an update fails to apply:
- Check network connectivity
- Verify the SWUpdate web server is running (port 8080)
- Examine the update package format and contents
License
This project is distributed under the terms of the GPL v2 license.