Skip to content

Instantly share code, notes, and snippets.

@lightrush
Last active January 29, 2023 23:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lightrush/4c9c964ef81cfa74ae1335475c6454b7 to your computer and use it in GitHub Desktop.
Save lightrush/4c9c964ef81cfa74ae1335475c6454b7 to your computer and use it in GitHub Desktop.
Build images with modified set of packages using OpenWrt's Docker-based Image Builder

Build images with modified set of packages using OpenWrt's Docker-based Image Builder

Possibly the simplest and quickest way to build an image with a modified set of packages is using OpenWrt's Docker imagebuilder container.

Make some workspace dir

mkdir -p openwrt/bin
cd openwrt

Get the Image Builder and run it

sudo docker run --rm -v "$(pwd)"/bin/:/home/build/openwrt/bin -it openwrtorg/imagebuilder:[target]-[subtarget]-[tag]

Concretely OpenWrt 22.03.2 snapshot for Raspberry Pi 4:

sudo docker run --rm -v "$(pwd)"/bin/:/home/build/openwrt/bin -it openwrtorg/imagebuilder:bcm27xx-bcm2711-22.03.2

Build the image

In the container shell, initiate building:

make image

To customize the package set, specify the modifications using the PACKAGES parameter. Listing a package name adds the package. Listing a package name prefixed with - removes that package. This is a concreate example:

make image PACKAGES="-dnsmasq dnsmasq-full python3 python3-distro tailscale tailscaled file luci luci-app-firewall luci-app-opkg luci-base luci-lib-base luci-lib-ip luci-lib-jsonc luci-lib-nixio luci-mod-admin-full luci-mod-network luci-mod-status luci-mod-system luci-proto-ipv6 luci-proto-ppp luci-ssl luci-app-sqm luci-app-ddns ipset luci-app-upnp luci-theme-material prometheus-node-exporter-lua prometheus-node-exporter-lua-openwrt prometheus-node-exporter-lua-wifi kmod-usb-net-rtl8152 luci-app-watchcat irqbalance iptables-nft kmod-usb-net-asix kmod-usb-net-asix-ax88179"

The result will be under the bin directory in the workspace. Locate the set of images and flash away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment