Custom wlan slovenija Firmware
When building firmware images for wlan slovenija nodes using nodewatcher firmware is automatically built for you based on the community-made firmware. But sometimes you need more than what is available through nodewatcher:
- maybe there is an OpenWrt package you want to use and it is not available through nodewatcher
- maybe you want support for a new device or even architecture
- maybe you want to fix a bug in the firmware (found in OpenWrt itself, or in our packages)
- maybe you want to test configuration not possible through nodewatcher
In general, to get those changes included into the community-made firmware, you should:
- make sure OpenWrt works with your changes/on your new device by flashing it with stock OpenWrt firmware
- adapt our version of OpenWrt firmware with your changes/support for your new device
- change firmware-core repository so that our firmware builders can build firmware
- if changes require changes to OpenWrt, send changes upstream, but also include your changes as patches under patches directory in the firmare-core repository
- if adding a new device, add a device descriptor to nodewatcher so that nodewatcher can correctly configure the device
- test that your local instance of nodewatcher can now build working firmware and test the firmware
- make pull requests: against firmware-core and, if adding a new device, against nodewatcher
This wiki page deals with step 2. – how to build wlan slovenija firmware image with changes, without using nodewatcher. When nodewatcher is generating firmware images, it specifies the profile, packages, and configuration files automatically. You will have to do all this now manually.
This process is more or less the same as normal OpenWrt firmware building, so consult OpenWrt wiki and forums as well. We use helper scripts to make it easier, but they are not doing anything special.
Required development tools
To compile custom firmware you need to have running Linux of your choice, virtual machine or VPS is also an option if you don't have it running as your desktop. Check OpenWrt wiki for tools and packages that need to be installed when creating custom OpenWrt firmware images.
Building custom firmware
Here are step-by-step instructions of building custom wlan slovenija firmware with few additional packages for TP-Link WR1043ND, as an example. Moreover, we use this git commit hash version of OpenWrt Chaos Calmer branch as a base of this example custom firmware.
git clone https://github.com/wlanslovenija/firmware-core.git cd firmware-core/ ./openwrt/scripts/prepare chaos_calmer 15.05/openwrt.git 88ef6c4258fe7201678c3862d9a4f0da391a5155 && \ ./openwrt/scripts/configure-platform ar71xx && \ ./openwrt/scripts/build-toolchain && \ ./openwrt/scripts/build-imagebuilder
This will take quite a while (hours) and consume a lot of space (20 GB). After it is done, you will have OpenWrt toolchain and OpenWrt image builder available. Furthermore, you will find OpenWrt firmware images with default set of packages and configuration in the ./build/openwrt/bin/ar71xx/ directory (they are very similar to stock OpenWrt firmware images).
Using OpenWrt image builder (generator)
In the previous step we built also OpenWrt image builder (also known as OpenWrt image generator) (not to be confused with nodewatcher image generator). We can use it to generate custom firmware images with custom sets of packages and configuration baked-in. (This is used internally by nodewatcher to quickly build custom firmware images for nodes.) But only those packages which were specified during the prepare process can be used.
cd ./build/release/ && \ mkdir imagebuilder && \ tar xf imagebuilder.tar.bz2 -C imagebuilder --strip-components 1 && \ cd imagebuilder make image PROFILE="TLWR1043" PACKAGES="wireless-tools wpad-mini kmod-netem kmod-pktgen ntpclient qos-scripts iperf horst wireless-info cronscripts iwinfo nodewatcher-agent nodewatcher-agent-mod-general nodewatcher-agent-mod-resources nodewatcher-agent-mod-interfaces nodewatcher-agent-mod-wireless nodewatcher-agent-mod-keys_ssh nodewatcher-agent-mod-clients uhttpd ip-full"
This extract the image builder and builds firmware image with a custom set of packages. The resulting file or files will be made in the ./build/release/imagebuilder/bin/ar71xx/ directory.
If you want to base your firmware of different version of OpenWrt, specify it as arguments to the prepare script.
If you want to add new architecture, which is otherwise supported by OpenWrt, to wlan slovenija firmware, add it to the ./openwrt/architectures file before you run prepare script.
If you want to add custom changes on top of OpenWrt, add patches to ./openwrt/patches/ directory before running prepare script.
If you want to have additional packages available to the OpenWrt image builder, add them to the ./openwrt/packages file before you run prepare script. You should not add packages through OpenWrt config (you can do that for testing, but not for inclusion into nodewatcher firmware image). We want packages to be configured through nodewatcher at the image generation stage.
For more information how to modify what is built see documentation on modifying firmware builders. Configuration is the same, even if you do not use Docker to build firmware builders, but OpenWrt toolchain directly.