openwrt-build

The openwrt-build script builds an OpenWrt disk image from a JSON-encoded definition. See definitions/example.json for one such definition.

Aside from example.json, you can provide openwrt-build with a diffconfig definition and one or more directory structures which openwrt-build will add to the disk image. For example,

./openwrt-build -c example.json files/

where files/ contains

etc/dropbear/authorized_keys

will produce an OpenWrt image to which the owner of the public key in authorized_keys can connect using SSH.

You can also specify a post-install script using the ‘-p’ option. The openwrt-build script will arrange for this script to run the first time a VM boots the image.

The default diffconfig causes openwrt-build to build an x86_64 image. You can provide an alternative diffconfig using the ‘-d’ option. See diffconfig/example.

The openwrt-build script also generates a file named vm-[NAME].cfg which defines a Xen domain which will boot the generated disk image. For quick tests, you might also want to run the disk image using QEMU; you can do this by executing:

qemu-system-x86_64 -hda [IMAGE.img] -net nic -net user -m 512 -localtime

The openwrt-build project is available as a Git repository. To clone the repository, execute

git clone https://www.flyn.org/git/openwrt-build