How to cross-compile native C++ executable for Teltonika RUTX10 / RUTX11

First, download the pre-configure OpenWRT buildroot from Teltonika.

Unzip it:

extract_rutos_buildroot.sh
tar xzvf RUTX_R_GPL_00.07.04.1.tar.gz
cd_rutos_dir.sh
cd rutos-ipq40xx-rutx-gpl/

and now build using

build_rutos.sh
./scripts/feeds update -a
make -i

This will build not only the toolchain but also all packages etc, hence it will take a while.

Now create main.cpp, e.g.:

main.cpp
#include <iostream>

int main(int argc, char** argv) {
    std::cout << "Hello World!" <<std::endl;
}

The build script build.sh looks like this:

build.sh
#!/bin/sh
export STAGING_DIR=~/rutos-ipq40xx-rutx-gpl/staging_dir
export TOOLCHAIN=${STAGING_DIR}/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi
export CC=${TOOLCHAIN}/bin/arm-openwrt-linux-musulgnueabi-gcc
export CPP=${TOOLCHAIN}/bin/arm-openwrt-linux-musulgnueabi-g++

# Build !
${CPP} -o main main.cpp

This will produce main , an executable which you can copy to and run on your RUTX10.

 


Check out similar posts by category: OpenWRT