Creating a deployable "gold build"

Hi,

I'm having some trouble creating a repeatable "gold build" for 4 OpenWRT boxes.

The aim:
Have a custom firmware .bin with various packages pre installed, including python-pip packages that deploys to the emmc chip.

Basically. I want to mirror the entirety of my current / and deploy it as a binary to the other boxes.

Where I'm at:
I have one of the boxes working great with all of my packages and tools installed. The box has an 8GB emmc chip on board and the internal flash memory is 128mb.

I have a script in my binary which runs at boot and installs what I need onto the emmc. This works fine providing the box has internet connectivity when the binary is installed. The script also configures the emmc as the root partition.

Where I'd like to be:
I'd love to have a binary file which installs everything I need in one go and works offline. This may be impossible as I don't see a way to partition the emmc during binary deployment.

As a second best I'd like to flash a binary which configures the emmc and then extracts a full / backup with everything I need.

Is this a sensible way to do things or is there a better way that I'm missing? I'm new to openwrt development so I'm thinking I have missed something!

Thanks all

Are all 4 boxes the same or different devices?

You can use the ./files directory to place configuration files in as you would on device, and they will be placed baked in the image (eg: ./files/etc/config, ./files/etc/init.d/).

You could probably make a config backup on the device you have and pull out the configurations that won't interfere/conflict with each other (like hard-setting IP address that would set all 4 devices to the same IP)

3 Likes

wiki about that:

You could compile a build with all needed packages installed and then have a run-once "uci-defaults" script that expands the emmc partition.

Note that the advice about /rom may not quite apply to memory card systems, as you need the static ROM + overlay file system approach.

1 Like

If you manage to produce the kind of image you need using the Image Builder, also take a look at tools like https://johannes.truschnigg.info/code/openwrt_autobuild/ - it can help you keep your devices updated without much effort, and encourages you to have all important configuration and deployment magic in one properly structured place.

Alternatively, change the few items that you want to be different per device.

I have a whole pile of OpenWRT+OpenVPN bridges that are used to support engineering tasks at work. I have a "golden" config set from a known-good device, when provisioning a new device, I take that config set, and edit:
All instances of the IP address
The hostname
Re-tar it

Then I load that config file into the new device

files/ in my build has a minimal subset of that config set that makes the device come connect to a specific SSID on an IP address that is reserved for "provisioning new bridge" tasks so I can enter the admin interface and load a more complete config. (I keep what is in files/ minimal to minimize chances of an incompatibility doing something weird in a new build)

What is a challenge right now is propagating a change made on one device to all other devices without manually saving/editing an entire config set.

1 Like