To generate a flashable firmare of OnionWall you need to setup the OpenWrt buildroot on a compatible OS and filesystem (case sensitive).
This Vagrant environment makes the process very easy on just about every platform.
$ git clone --recursive https://gitlab.com/valldrac/onionwall-vagrant.git
$ cd onionwall-vagrant
$ vagrant up
The buildroot will be available in the VM path /onionwall
when the provisioning script is complete.
To proceed and build the firmware run this single command. It will SSH for you into the buildroot and will make all the magic:
$ make firmware
When finished, check out the image file with suffix squashfs-sysupgrade.bin
in the host directory firmware/bin/targets
and refer to https://gitlab.com/valldrac/onionwall/wikis/Flashing how-to.
If the build fails, re-run make with V=s for debugging output.
The directory with the source code is configured as rsynced shared folder. It is synchronized automatically to the buildroot by the Makefile. This way lets you to edit the sources directly in the host while being completely isolated from the build process.
If you want to customize the image through menuconfig try:
$ make menuconfig
The above executes menuconfig in the buildroot and copies the config file back into the source tree. This file includes only the changes compared to the default configuration of OpenWrt.
Follow https://openwrt.org/docs/guide-developer/build-system/use-patches-with-buildsystem:
$ vagrant ssh
$ cd /onionwall
$ make package/kernel/mac80211/{clean,prepare} V=s QUILT=1
$ cd build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_generic/compat-wireless-2017-01-31
$ quilt push -a
$ quilt new 999-ath9k_random_mac_address.patch
$ quilt edit drivers/net/wireless/ath/ath9k/hw.c
$ quilt refresh
$ cd /onionwall
$ make package/kernel/mac80211/update V=s
$ make package/kernel/mac80211/{clean,compile} package/index V=s
Copy patch file back to the source tree:
$ vagrant scp default:/onionwall/package/kernel/mac80211/patches/999-ath9k_random_mac_address.patch onionwall/package/kernel/mac80211/patches
$ make clean
Cleans the directory firmware
and dot-files generated by Makefile, but it avoids touching the buildroot.
Additional targets to clean up the mess:
make dirclean
runsmake clean
both in the host and in the buildroot.make distclean
runsmake clean
and deletes the buildroot completely in the VM.
Remember you can recreate the Vagrant box at any time with make clean && vagrant destroy && vagrant up
.