Make sure you have the prereq pkgs for the Openwrt Image Builder
To use this part of the git repo you will need the following pkgs:
- git >= 1.8.2
- git-lfs
- gomplate >= 3.2.0
- Docker (Optional)
Installation of gomplate
is a little bit tricky since it doesnt come in a .deb
:
sudo -i
cd /usr/local/bin/
curl -O https://github.com/hairyhenderson/gomplate/releases/download/<version>/gomplate_linux-amd64 -L
mv gomplate_linux-amd64 gomplate
You can build these openwrt images inside a docker container. This makes it easy to has a consistent build environment for all members of the tech team.
To start building:
docker pull sarcasticadmin/openwrt-build:2aea1a2
# Make sure to mount the git root inside this container
docker run -v $(git rev-parse --show-toplevel):/home/openwrt/scale-network --rm -it sarcasticadmin/openwrt-build:2aea1a2 /bin/bash
cd /home/openwrt/scale-network
There is no latest tag so make sure to specify the version (short commit hash) The docker mount only works in linux, on OSX you'll get: "Build dependency: OpenWrt can only be built on a case-sensitive filesystem"
Then continue onto whichever image you'd like to build.
Build are done per arch with TARGET
environment variable (defaults to TARGET=ar71xx
:
cd ./openwrt
make build-img
This requires an internet connection since it downloads the Openwrt src github.com and uses some openwrt mirrors.
You will find the images in ./build/source-<commit>/bin/targets/<target>/generic/
The *sysupgrade.bin
and *factory.img
files match the AP models
To get the configuration thats used at scale the templates need to be baked into the image.
Copy over the default secrets:
cp ./facts/secrets/openwrt-example.yaml ./facts/secrets/openwrt.yaml
If needed update the defaults in
openwrt.yaml
to represent actual values
Generate and update the root password hash in openwrt.yaml
:
openssl passwd -1 secretpassword
Compile the templates:
cd ./openwrt/
make templates
This will populate the templates with the necessary values and prep them in the build dir. To validate the templates check: ./openwrt/build/source-/files/
Now build the image:
make build-img
This will populate the templates with the necessary values and include them into the Openwrt build
Leverage the existing diffconfig
via the Makefile
:
make config
cd build/source-<SHA>/
make menuconfig
At this point you can add any additional pkgs youd like. Afterwhich its time
to save them back to the diffconfig
using the makefile and then copy them
to the commonconfig:
make diffconfig commonconfig
At which point you should have a diff in git which can then be tested against a new build of the img
This is similar to Adding a new package
however after running menuconfig
go back to the Makefile in openwrt
and run:
make diffconfig targetconfig
Depending on the SCaLE conference number, the WPS LED will be ON for even years and OFF for odd years.
NOTE: This depends on the SCaLE conference number from
facts.yaml
not the year since the build would drift based on when it was built.
- When iterating on new packages there have been times were the existing config is stale
and needs to be completely blown away and regenerated off of
master
then reconfigured withmenuconfig
. This is just something to be aware of since its come up during the development of this image.
/root
- Must be permissions755
(or less perm) or ssh-key auth wont work- openssh needs to have both
/etc/passwd
and/etc/hosts
to allow ssh login
To check which vlans are loaded onto a switch:
swconfig dev switch0 show
Check to see the status of the wifi radios:
wifi status
- http://makefiletutorial.com/
- https://bost.ocks.org/mike/make/
- http://mrbook.org/blog/tutorials/make/
- ftp://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_2.html