# HOWTO Build Maxwell This documents how to build the Maxwell meshing software with OpenWRT. Base system is Debian Bullseye (11/testing) on ppc64le architecture. Should also work fine on x86_64. # Build thang Do. OpenWRT build system: * https://openwrt.org/docs/guide-developer/build-system/start ## Install Dependencies Dependencies for other distros are listed here: * https://openwrt.org/docs/guide-developer/build-system/install-buildsystem#examp Get current: ``` apt update ``` Upstream command suggests for Debian: ``` apt install build-essential ccache ecj fastjar file g++ gawk \ gettext git java-propose-classpath libelf-dev libncurses5-dev \ libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget \ python3-distutils python3-setuptools python3-dev rsync subversion swig time \ xsltproc zlib1g-dev ``` Full docs list more dependencies for full list, that work with Debian Bullseye. Takes over 6 gigs on root filesystem ``` apt install \ asciidoc \ bash \ binutils \ bzip2 \ flex \ git-core \ g++ \ gcc \ util-linux \ gawk \ help2man \ intltool \ libelf-dev \ zlib1g-dev \ make \ libncurses5-dev \ libssl-dev \ patch \ perl-modules \ python2-dev \ python3-dev \ unzip \ wget \ gettext \ xsltproc \ zlib1g-dev \ libboost-dev \ libxml-parser-perl \ libusb-dev \ bin86 \ bcc \ sharutils ``` Maybe want to use `ccache` to save on rebuilds: ``` apt install ccache ``` Add to your `~/.bashrc`: ``` PATH=/usr/lib/ccache:$PATH ``` Then log out and back in and run `echo $PATH` to make sure it is there. Run `ccache -s` during build to see cache hit rate. ## Get Source Clone OpenWRT sources, around ~300 megs: ``` git clone https://git.openwrt.org/openwrt/openwrt.git cd openwrt ``` Add Maxwell source code, around ~5 megs, to `openwrt` directory: ``` git clone https://github.com/drandyhaas/haasmesh.git ``` ## Configure Build If you've done other builds, it is good to clean up first, maybe: ``` make clean ``` There are a variety of units the setup script is compatible with: * luma * Maxwell Indoor 3-Band: ea8300 * Maxwell Outdoor 2-Band: ew72 * c7v2 * c7v5 * jetstream * redmi You will need to check out the correct git branch or commit depending on your radio. To get the stock version `OpenWrt 19.07.4, r11208-ce6496d796` of the Maxwell Indoor 3-Band EA8300: ``` git checkout ce6496d796 ``` To get the stock version `OpenWrt SNAPSHOT, r14229-b52b4afa15` of the Maxwell Outdoor 2-Band EW-72: ``` git checkout b52b4afa15 ``` TODO: Add more versions, newer releases. Pull in more needful things: ``` # Takes about ~1 min: ./scripts/feeds update -a # Takes less than 1 min: ./scripts/feeds install -a ``` To build, run the build script with one of these options. ``` haasmesh/script/setupnodebuild.sh [luma|ea8300|ew72|c7v2|c7v5|jetstream|redmi] ``` For example, to configure the build system for the Maxwell Outdoor 2-Band, run below. The configure script should run in ~1 second. ``` haasmesh/script/setupnodebuild.sh ew72 ``` This is a sample `.config` file that can be used for EW-72: ``` wget -O .config https://spacecruft.org/network/maxwell/raw/branch/master/config/dot-config-ew-72 ``` Run menuconfig: ``` make menuconfig ``` Or, if you used the `.config` from above, you can skip `menuconfig` and run: ``` make defconfig ``` In there, there are a few options needed to select, which should be already including in above config: ``` network -> alfred (with auto bat-hosts) batctl-full iperf3 network/wirelessAPD -> remove wpad-basic, install wpad-mesh-openssl network/filetransfer -> wget network/ssh -> openssh-client-utils utilities/compression -> unzip utilities/editors -> nano utilities/bootloader -> uboot-envtools kernel/network support-> kmod-batman-adv kernel/wireless drivers -> kmod-rt2800-usb (for alfa r36a) firmware -> ath10k non-ct drivers and kmod-ath10k non-ct (for wave-1 devices only, like archer) firmware -> ath10k-firmware-qca9888-ct (for ea8300) development -> diffutils luci, luci-app-commands for luma also add: utilities -> i2c-tools, nand-utils, usbutils kernel/filesystems -> kmod-fs-exfat, kmod-fs-ext4, kmod-fs-vfat, kmod-usb-storage ``` TODO: What kernel wifi modules on EW-72? Use `ath9k` and `ath10k` for now. TODO: Make `defconfig` for different hardware. Hit `` to get to `EXIT`, then `` to select `Yes` to save the configuration. Download more sources: ``` make -j1 download ``` ## Build Source Now, actually build it. Takes over an hour or two, depending on hardware. ``` make -j`nproc` ``` ## MISC HACKS Notes on things that need to be done too: ``` For the Archer, you need the source patch I discuss in this thread, so you can raise the mtu... https://forum.openwrt.org/t/ag71xx-gigabit-e-g-archer-c7-v5-eth-raising-mtu-problem-regression/44138/ For the Linksys I had to follow this thread (which really just means deleting a patch file) https://forum.openwrt.org/t/vlan-tagging-on-ipq40xx-gl-b1300-no-longer-works/69569/58 so that vlans work, which is needed for separate lan, wan, and backhaul ``` Also better for ssh config in OpenWRT build, enable: ``` Base system --> Dropbear Configuration --> Ed25519 support ```