Skip to content

Building OpenWrt from Source

b0naf1de edited this page Mar 1, 2020 · 20 revisions

Building OpenWrt/LEDE (for RaspberryPi)

If you don't want to use the pre-built LinkMeter OpenWrt image, you can build it yourself from source. LinkMeter is built on the Attitude Adjustment release of OpenWrt. In these examples, it is assumed your heatermeter git repository lives at ~/heatermeter and you'll be building OpenWrt at ~/openwrt

These packages are required to install on 64bit Ubuntu 14.04 (trusty)

$ sudo apt-get update
$ sudo apt-get -y install git-core build-essential libssl-dev libncurses5-dev \
 unzip lua5.1 libxml-parser-perl subversion python2.7 python-pip zlib1g-dev

First, clone the heatermeter and LEDE (openwrt) repos

$ cd ~
$ git clone git://github.com/CapnBry/HeaterMeter.git heatermeter
$ git clone https://github.com/lede-project/source.git openwrt

Next, you need to find the commit (or branch) of LEDE that is aligns with the current heatermeter build. Fortunately, this is shared at the top of the ~/heatermeter/openwrt/install.sh file. Look for the commit value after the reference to the github.com/lede-project/source.git .

echo "BCM2708 - https://github.com/lede-project/source.git@94491a15712732c56dccbf4593000376ae275134"

Switch to the commit branch of LEDE that you just found

$ cd ~/openwrt
$ git checkout 94491a15712732c56dccbf4593000376ae275134

Install the heatermeter packages and patches

$ cd ~/heatermeter/openwrt
$ ./install.sh BCM2708 ~/openwrt

Configure the build. When running make oldconfig, make sure you choose the BCM2708 subtarget that matches your Raspberry Pi board revision; BCM2708 based boards or BCM2708 (Pi B/B+/CM/Zero/ZeroW) or BCM2708/BCM2710 (Pi 2B/3B/3CM).

$ cd ~/openwrt
$ make oldconfig

Finally, the following will pre-fetch all sources and then build everything.

$ make download
$ make -j1 V=s 

The firmware image will be built to ~/openwrt/bin/targets/brcm2708/bcm2708/lede-brcm2708-brcm2708-rpi-squashfs-sdcard.img

Building just the LinkMeter package

You'll still need the full OpenWrt build environment created from the above steps, but recompiling just the LinkMeter package can be done (from ~/openwrt)

make package/linkmeter/compile

The package will be built to ~/openwrt/bin/targets/brcm2708/package/linkmeter_*_brcm2708.ipk

Building OpenWrt (for WRT54GL)

The Linksys WRT54GL target had to be frozen during the OpenWrt development cycle. The release version of Attitude Adjustment requires too much memory to run in the 16MB available on the device. You can however build it using the same method, however the platform and SVN source URL are different

$ cd ~
$ svn co svn://svn.openwrt.org/openwrt/trunk@29665 openwrt
$ cd ~/heatermeter/openwrt
$ ./install.sh BCM47XX ~/openwrt
$ cd ~/openwrt
$ make oldconfig
$ make

The firmware image will be built to ~/openwrt/bin/brcm47xx/.

Clone this wiki locally