Cross Compile a missing package (fping) for OpenWRT/LEDE Reboot 17.01.04

Sadly in LEDE Reboot 17.01.4 (latest OpenWRT release) the package fping is missing. It was already included in previous releases, but it’s missing in this stable. It’s already readded to the master branch for future releases. But if you need the fping binary now, it is not available in the opkg installer for 17.01.4. So we have to build it manually.

Download SDK

OpenWRT provides for each router target with the firmware downloads also the Software Development Kit with an already prepared Cross Compile Toolchain. It’s of course possible to create own Cross Compile ToolChain explained explained int the Build System Documentation. But the SDK is already available, so i’ll just use it.

You can find the SDK at the end of the Firmware Download Pages, precompiled and ready to use.

In my case i use at the moment a TP-Link WDR4300 (N750) which contains an Atheros AR9344 CPU @560MHz with MIPS 74Kc Instruction Set, 8 MB NAND Flash, 128MB RAM, Serial, 5x GigE Ports, VLAN capable.

The Firmware can be obtained from https://downloads.openwrt.org/releases/17.01.4/targets./ar71xx/generic/. The SDK Download is at the end and named https://downloads.openwrt.org/releases/17.01.4/targets/ar71xx/generic/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64.tar.xz.

Prerequisites and Dependencies

To use the SDK, the same tools must be available as when the Cross compile Toolchain is created. Check the instructions from Install Buildsystem Documentation.

For Debian following installation procedure should be enough:

  • Debian 7 Wheezy:

    apt-get install libncurses5-dev zlib1g-dev gawk
  • Debian 8 Jessie:

    sudo apt-get install build-essential libncurses5-dev gawk git subversion libssl-dev gettext unzip zlib1g-dev file python
  • Debian 9.3 Stretch:

    sudo apt install build-essential libncurses5-dev gawk git subversion libssl-dev gettext zlib1g-dev

     

Locate FPing on Master Branch

The FPing packages is available in the master Branch here: https://github.com/openwrt/packages/tree/master/net/fping

Cross Compile

Documentation on Using the SDK to cross compile packages for a specific target without compiling the whole system from scratch.

  • Extract the SDK on your system.

Package Feeds

After decompressing the SDK archive, edit the feeds.conf.default file to add your packages, by default it has LEDE feeds, and you can add your own feeds, local or remote.

For example, you can add all packages you have in a local folder by adding this line

src-link custom /full/path/to/the/local/folder

Load package lists

./scripts/feeds update -a command will refresh the package lists. It will download from github the LEDE feeds, and then it will also download from github or read from your local folder the packages you have loaded in the Package Feeds step above.

cave@laptop:~/openwrt/sdk/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64$ ./scripts/feeds update -a
Updating feed 'base' from 'https://git.lede-project.org/source.git;v17.01.4' ...
Cloning into './feeds/base'...
remote: Counting objects: 8382, done.
remote: Compressing objects: 100% (7378/7378), done.
remote: Total 8382 (delta 1034), reused 4265 (delta 360)
Receiving objects: 100% (8382/8382), 10.76 MiB | 3.45 MiB/s, done.
Resolving deltas: 100% (1034/1034), done.
Checking connectivity... done.
Note: checking out '444add156f2a6d92fc15005c5ade2208a978966c'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

Create index file './feeds/base.index' 
Collecting package info: feeds/base/package/firmware/lantiq/dsl-vrx200-firmware-Collecting package info: done
Collecting target info: done
Updating feed 'packages' from 'https://git.lede-project.org/feed/packages.git^cd5c448758f30868770b9ebf8b656c1a4211a240' ...
Cloning into './feeds/packages'...
remote: Counting objects: 57751, done.
remote: Compressing objects: 100% (25080/25080), done.
remote: Total 57751 (delta 31196), reused 55736 (delta 29454)
Receiving objects: 100% (57751/57751), 13.89 MiB | 3.49 MiB/s, done.
Resolving deltas: 100% (31196/31196), done.
Checking connectivity... done.
Switched to a new branch 'cd5c448758f30868770b9ebf8b656c1a4211a240'
/home/cave/openwrt/sdk/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64
Create index file './feeds/packages.index' 
Collecting package info: done
Collecting target info: done
Updating feed 'luci' from 'https://git.lede-project.org/project/luci.git^d3f0685d63c1291359dc5dd089c82fa1e150e0c6' ...
Cloning into './feeds/luci'...
remote: Counting objects: 104191, done.
remote: Compressing objects: 100% (29395/29395), done.
remote: Total 104191 (delta 61227), reused 101632 (delta 59436)
Receiving objects: 100% (104191/104191), 25.29 MiB | 3.85 MiB/s, done.
Resolving deltas: 100% (61227/61227), done.
Checking connectivity... done.
Switched to a new branch 'd3f0685d63c1291359dc5dd089c82fa1e150e0c6'
/home/cave/openwrt/sdk/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64
Create index file './feeds/luci.index' 
Collecting package info: done
Collecting target info: done
Updating feed 'routing' from 'https://git.lede-project.org/feed/routing.git^d11075cd40a88602bf4ba2b275f72100ddcb4767' ...
Cloning into './feeds/routing'...
remote: Counting objects: 6622, done.
remote: Compressing objects: 100% (4253/4253), done.
remote: Total 6622 (delta 2668), reused 5194 (delta 1977)
Receiving objects: 100% (6622/6622), 1.60 MiB | 2.59 MiB/s, done.
Resolving deltas: 100% (2668/2668), done.
Checking connectivity... done.
Switched to a new branch 'd11075cd40a88602bf4ba2b275f72100ddcb4767'
/home/cave/openwrt/sdk/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64
Create index file './feeds/routing.index' 
Collecting package info: done
Collecting target info: done
Updating feed 'telephony' from 'https://git.lede-project.org/feed/telephony.git^ac6415e61f147a6892fd2785337aec93ddc68fa9' ...
Cloning into './feeds/telephony'...
remote: Counting objects: 6939, done.
remote: Compressing objects: 100% (4836/4836), done.
remote: Total 6939 (delta 3808), reused 3734 (delta 1921)
Receiving objects: 100% (6939/6939), 1.31 MiB | 0 bytes/s, done.
Resolving deltas: 100% (3808/3808), done.
Checking connectivity... done.
Switched to a new branch 'ac6415e61f147a6892fd2785337aec93ddc68fa9'
/home/cave/openwrt/sdk/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64
Create index file './feeds/telephony.index' 
Collecting package info: done
Collecting target info: done

I have not used custom src-link in the feeds.conf.default file. I just added the package from master to the downloaded feed.

I added the parts from https://github.com/openwrt/packages/tree/master/net/fping to the path ./feeds/packages/net in the sdk directory.

Select Packages

./scripts/feeds install <packagename> will load the package and its dependencies in the SDK

Then open the SDK menu again, find the package you want to build and select it by pressing “m”, this will also select all the dependencies, and you will see that they are all tagged with “<M>” in the menu.

cave@laptop:~/openwrt/sdk/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64$ ./scripts/feeds install fping
Installing package 'fping' from packages

Compile Package

Before we compile, let’s check make menuconfig.

cave@laptop:~/openwrt/sdk/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64$ make menuconfig

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

Now let’s build the package fping.

cave@laptop:~/openwrt/sdk/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64$ make -j7
...
#
# configuration written to .config
#
 make[1] world
 make[2] package/compile
 make[3] -C package/toolchain compile
 make[3] -C package/linux compile
 make[3] -C feeds/packages/net/fping compile
 make[2] package/index
...

Package and Install

In ./bin/packages/mips_24kc/packages in the sdk directory should be the compiled output.

cave@laptop:~/openwrt/sdk/lede-sdk-17.01.4-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64$ ls -lh ./bin/packages/mips_24kc/packages 
total 28K
-rw-r--r-- 1 cave cave 15K Mar 25 20:47 fping_4.0-2_mips_24kc.ipk
-rw-r--r-- 1 cave cave 719 Mar 25 20:48 Packages
-rw-r--r-- 1 cave cave 473 Mar 25 20:48 Packages.gz
-rw-r--r-- 1 cave cave 822 Mar 25 20:48 Packages.manifest

scp the package to your openwrt device and install with opkg install ./fping_4.0-2_mips_24kc.ipk

root@openwrt:~# opkg install ./fping_4.0-2_mips_24kc.ipk 
Installing fping (4.0-2) to root...
Configuring fping.

 

Comments are closed.