Upgrading Snagboot to a fully-fledged factory flashing tool

Snagboot is a fully open-source and vendor-agnostic recovery and flashing tool released by Bootlin in 2023. It is composed of snagrecover and snagflash, which respectively run U-Boot on a target platform using USB recovery mode and flash non-volatile storage devices using USB gadgets exposed by U-Boot.

While the combination of snagrecover and snagflash allows to reflash a board during development, it doesn’t fully address the needs of factory flashing: fast processing of multiple boards in parallel, monitoring of individual board statuses during the flashing process, and compatibility with Windows, which is the most often used operating system on factory floors.

Back in March 2024, Texas Instruments contacted Bootlin with a project request: to grow Snagboot into an efficient factory flashing tool. The goal was for factory operators to have a way of efficiently flashing groups of devices using a single user-friendly interface.

While this project could have been executed internally by engineers at Texas Instruments, the team at TI realized the importance of keeping this work agnostic to TI and driving this truly as an Open Source project. We thank TI for partnering with us and sponsoring us to deliver this tool that will cater to the flash writing needs of a variety of small and medium sized manufacturing houses & industry in general.

Consequently, Bootlin is proud to release the 2.0 version of Snagboot, which includes a factory flashing tool that runs on both Windows and Linux!

This tool supports a wide range of platforms from different vendors. All boards using supported SoCs are themselves supported without any extra effort, provided proper U-Boot support exists and USB recovery ports are routed in hardware.

For example, the TI AM62 and AM64 SoCs are fully supported by Snagboot. Thus, all boards using those platforms are supported, including the TI evaluation boards for those processors as well as the popular open-hardware BeaglePlay platform.

Groups of devices can be recovered and flashed in parallel, and the flashing process can be monitored from  a convenient GUI:

This tool is called Snagfactory. It is fully integrated into the Snagboot package. As an added bonus, the snagrecover and snagflash commands now work on Windows as well!

An efficient and standardized factory flashing procedure is a valuable asset for device manufacturers. Not only does it affect unit production rates, it also increases reliability by removing variability from the flashing process.

A tool like Snagboot also provides better accountability, by storing detailed logs of each and every factory flashing operation. This facilitates auditing of these operations, as well as post-incident analysis. Snagfactory configuration files lend themselves well to versioning, which means that each flashing operation can be tied back to a specific configuration.

Moreover, the open-source and vendor-agnostic nature of Snagfactory will make it possible for bug fixes and new features to travel across company boundaries, thereby lending a competitive advantage to those companies who chose to participate in its development.

Features supported by Snagfactory include:

  • Ordered pipelines of factory flashing tasks.
  • GPT partitioning.
  • Flashing huge image files (larger than the Fastboot RAM buffer).
  • Flashing bmap sparse images.
  • eMMC hardware partitioning.
  • Prompting for operator action at a specific step in the factory flashing process.
  • Storing factory flashing results as detailed log files for accountability and troubleshooting purposes.

Installation instructions are available for Linux and Windows in the Snagboot documentation, which also includes a user manual for Snagfactory.

The configuration file format allows users to design pipelines of flashing tasks, to be applied in order to each device.

The following flashing tasks are currently supported:

  • gpt: write a GPT partition table to an eMMC or SD card
  • flash: write a binary image to a storage device or partition; supports specifying an offset, flashing bmap sparse files, and flashing huge images (larger than RAM buffer size)
  • mtd-parts: write an MTD logical partition scheme to the U-Boot environment; this allows targeting MTD partitions by name in the « flash » command
  • emmc-hwpart: burn an MMC hardware partition configuration; this is an irreversible operation; General Purpose partitions and EUDA are supported
  • prompt-operator: pause the factory flashing process for the board and prompt the operator to complete an action before resuming the pipeline
  • reset: runs a soft reset on the target and recovers the board
  • run: runs a Fastboot command on the target; arbitrary U-Boot commands can also be executed using oem_run

A special thanks goes out to Texas Instruments for funding and supporting this awesome project! We plan to continue growing Snagfactory alongside the original Snagboot tools, so don’t hesitate to contribute if you are so inclined.