Raspberry Pi's rpi-image-gen Tool Makes it Easy to Roll Your Own Highly-Customized Linux OS Images

A broader successor to pi-gen, the new tool uses a simple text-based configuration file as part of user-definable "profiles."

Gareth Halfacree
3 days agoProductivity

Raspberry Pi is aiming to make it easier to build your own customized Linux distributions for its families of single-board computers and systems-on-modules with rpi-image-gen, a tool for generating images configured using a user-supplied text file.

"If you're building an embedded system or an industrial controller, you'll need complete control over the software resident on the device, and home users may wish to build their own OS and have it pre-configured exactly the way they want," explains Raspberry Pi's Matt Lear. "For developers and organizations that require a custom software image, a flexible and transparent build system is essential; to support these customers, we have created rpi-image-gen, a powerful new tool designed to put you in complete control of your Raspberry Pi images."

The tool builds on concepts from Raspberry Pi's previous pi-gen, which it uses itself to build each new release of the Debian Linux-based Raspberry Pi OS distribution. rpi-image-gen, though, has been written from scratch to offer fine-grained controls of exactly what goes into an operating system image — and, just as importantly, what stays out of it.

The tool, Lear explains, uses a simple text-based configuration file that can be tweaked and configured for particular requirements. "The config file is typically associated with the underlying device hardware and product," he says, "so it can specify applicable attributes accordingly: for example, defining the sizes of individual partition images to match the onboard eMMC size, or using a layout that uses particular mount options for file systems, fine tuning options exposed by lower levels, or selecting a specific Raspberry Pi device class to target.

"Likewise, different derivatives of config files can be used to tailor the installation to the product’s functional requirements. You could, for example, utilize a Bluetooth audio layer to pull in device support; or use a particular layer to add in a minimal Wayland desktop which runs in a kiosk mode, to install a default set of containers, to seed a default environment for distribution to third-party developers, and so on. There is no limit to the possibilities."

The tool's initial public release comes with a number of examples, including one designed to create a "slim" image with a minimal package load and another, which builds an image suitable for a web kiosk system with the Chromium browser on a locked-down Wayland desktop. Each image generation also outputs a software bill of materials (SBOM) for auditing purposes.

rpi-image-gen is available on GitHub now, under the permissive BSD three-clause license.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles