Tag Archives: ubuntu

Compiling custom OpenWRT firmware / packages

OpenWRT is a nifty thing. However, if you want to test some custom or self written programs it can be tricky.

For most instances, e.g. on a Raspberry or other embedded device, you can install a compile toolchain to just configure and make your project. Due to space constraints this is often not necessary. Cross-compiling for these embedded devices (for instance WR703N is MIPS32) is quite tricky. The easiest way therefore is to use the OpenWRT build root to compile these packages (and complete OpenWrt firmares).

I will not go into detail how to get, configure and build OpenWRT, you can find detailled instructions at the OpenWRT Wiki, and in addition how you can compile only a single package.

Assuming you have configured your OpenWRT install, you can build and include custom packages by editing the corresponding Makefiles.
For instance rtl-sdr you can find in the feeds directory:
openwrt/package/feeds/packages/rtl-sdr
Or the hamlib
openwrt/package/feeds/packages/hamlib

Everytime you install and compile the package, the source files will be downloaded newly from the internet and compiled. Therefore the easiest way is to provide a repository and commit where is the newer version.

So for instance, replacing the rtl-sdr/Makefile with this content can receive my custom version of rtl-sdr.

#
# Copyright (C) 2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.

include $(TOPDIR)/rules.mk

PKG_NAME:=rtl-sdr
PKG_VERSION:=2014-10-21
PKG_RELEASE:=$(PKG_SOURCE_VERSION)

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=git://github.com/satnogs/rtl-sdr.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=b72ab8fc83efbc2ec112154b9d1cbe2d85b1e258
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
CMAKE_INSTALL:=1

Building hamlib on Ubuntu from trunk (04/2015)

This instruction is written on Ubuntu 14.10 x86_64.

Get the required tools for building:

sudo apt-get install automake libtool build-essential make texinfo

Get files from git

git clone https://github.com/N0NB/hamlib.git
cd hamlib
chmod +x autogen.sh
./autogen
./configure
make

This instruction is for hamlib-1.2.15.3. The readme and Install file specify to use ./configure, but in the latest official github that file is renamed to ./autogen.sh. If you instead use autogen.sh it will work just fine then.
This will take time for a cup of tea.

Then you can install (and uninstall) witht his command:

sudo make install

If you encounter this error:

libhamlib.so.2: cannot open shared object file: No such file or directory

This is what fixed it:

sudo apt-get install --reinstall libhamlib2