OpenWrt composer: a new firmware building and configuration tool

I had an itch to scratch over the weekend after about the 50th time reminding myself how to use the OpenWRT image builder tool. So I created a little tool to help.

OpenWRT composer takes a YAML manifest which specifies firmware images to build, including what packages to add/remove from the firmware, and how to configure the firmware. The idea is that the firmware image is regarded as immutable; any change in configuration is achieved by producing a new firmware image and loading that onto the device.

Configuration is specified in the YAML manifest, and leverages the NetJSONConfig package to create valid configuration files which are then baked into the firmware image.

Building of the image itself is done inside a container. Currently the Podman container runtime is used, but adding Docker support is on the TODO list, and wouldn't require much work at all.

If you're interested, the code is available here: https://github.com/jonathanunderwood/openwrt-composer

It's early days, the code is rough, but it works. PRs, feature requests, critique are all welcome.

5 Likes

Very keen to work on making Podman a first class deployment methodology.

1 Like

Cool stuff, i already like LinuxKit so this is very similar.
Btw is there a way to manipulate the .config values? So stuff like this can be injected/changed from a defconfig via yaml?

CONFIG_BUSYBOX_CUSTOM=y
# CONFIG_BUSYBOX_CONFIG_BRCTL is not set
CONFIG_BUSYBOX_CONFIG_FEATURE_IP_RARE_PROTOCOLS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_IP_TUNNEL=y
CONFIG_BUSYBOX_CONFIG_FEATURE_NAMEIF_EXTENDED=y
# CONFIG_SAMBA4_SERVER_AVAHI is not set
# CONFIG_SAMBA4_SERVER_NETBIOS is not set
# CONFIG_SAMBA4_SERVER_VFS is not set

So, what this tool is doing is using the OpenWRT ImageBuilder for the target to build images from the compiled packages. It's not recompiling anything, so I don't think it would fit your use case @Andy2244.

@wunderspud this is a pretty incredible endeavor... i'm trying to achieve something similar but on a much simpler scale (i already have a bunch of crude shell scripts to compile my firmware) - what i'm struggling/unclear on is (and i'm asking you since your project does this eventually after the fancy config-generation), once you have the files/configs/customizations ready (i would just rsync them down from the device to bake them into the next version) where/how exactly do you get them baked into the built image during a compilation (relative to the openwrt git source tree?)..

i also saw you're doing something with sysupgrade (but that's not a mechanism i'm very familiar with), not sure how that fits in and if the custom configs are related to that ?