What's new

Tomatoware - not just for Tomato

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

lancethepants

Regular Contributor
I recently purchased an Asus RT-AX88U to get more wireguard throughput and I thought I'd port my project Tomatoware to it.

Overview

Tomatoware is a native development environment for embedded routers. It comes with c/c++ compilers, many development tools, and commonly used libraries to support natively compiling code on the router itself.
https://github.com/lancethepants/tomatoware
https://files.lancethepants.com/Tomatoware/

Some of the available tools/languages include:
  • gcc
  • clang
  • python
  • perl
  • golang
  • rust (using apt, !mipsel, but arm can cross-compile for mipsel)
  • zig (using apt, !mipsel)
  • git
  • bash
  • make, cmake, ninja
  • ccache
  • autoconf, automake, m4 gawk, sed, grep, tar
  • flex & bison
  • file
  • patch
  • strace
  • gdb

Some of the available libraries include:
  • zlib, bzip2, lzo, lzma, lz4, zstandard
  • openssl
  • nettle/gnutls
  • libcurl
  • expat, libxml2, libxslt
  • libboost
  • libpcap
  • ncurses
  • readline
  • sqlite

I try to have many of the most common libraries without getting too bloated.
You still may need to compile libraries on your own to fulfill the dependencies of an application that you're trying to build.

Some use cases for Tomatoware could be:
  • Compile a package not found in Entware.
  • Compile, test, and deploy your own code or project.
  • When natively compiling is easier than cross-compiling.
Tomatoware is not suitable for compiling kernel modules, only userspace binaries

Tomatoware currently supports 3 architectures: mipsel, arm(softfloat), and arm64/aarch64 which was recently added (Sep 2022). arm64 routers can run either the arm or arm64 versions where arm produces 32bit userspace binaries and arm64 produces 64bit userspace binaries. Currently arm64 asuswrt(-merlin) firmware runs all 32bit in its included userspace.
  • mipsel - uclibc-ng / 2.6.22.19 kernel headers
  • arm - uclibc-ng / 2.6.36.4 kernel headers
  • arm64 - musl / 4.1.51 kernel headers
Getting Started

To get started download the latest release to your device
https://github.com/lancethepants/tomatoware

or better yet get the latest nightly build.
https://files.lancethepants.com/Tomatoware/

extract the firmware to the /mmc prefix
Code:
tar zxvf aarch64-mmc.tgz -C /mmc

Then for the best experience do one of the following.
Code:
source /mmc/etc/profile
# every time you login

# or

mkdir -p /jffs/etc
ln -s /mmc/etc/profile /jffs/etc/profile

# or

mkdir -p /opt/etc
ln -s /mmc/etc/profile /opt/etc/profile

On my Asus RT-AX88U router running asuswrt-merlin firmware I noticed that the LD_LIBRARY_PATH environment variable has been set which can interfere with other software like Tomatoware from running. For the arm64 build using musl libc I've made the following changes which prevent this clash.
  • LD_LIBRARY_PATH -> MUSL_LD_LIBRARY_PATH
  • LD_PRELOAD -> MUSL_LD_PRELOAD
On rare occasions some software depends on using LD_LIBRARY_PATH for the building process. In those cases the code would need to be patched accordingly to the new musl environment variables.

For running the arm/mipsel builds, it may be necessary to run or put into the profile "unset LD_LIBRARY_PATH" if it is set in your firmware and you find it is conflicting with Tomatoware being able to work.

Then you should be ready to run

autoconf example
Code:
./configure --prefix=/mmc
make
make install

cmake example
Code:
cmake \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/mmc \
.
ninja
ninja install

I've chosen uclibc-ng and musl because they are friendly to static linking as opposed to glibc which seems to discourage and despise it.
Most or all libraries should have both their dynamic and static counterparts.
Most programs can be statically linked by adding -static to LDFLAGS.
All 3 architectures also support -static-pie linking and all included libraries and programs are compiled as Position Independent Code and Executables

The apt package manager is included which provides some additional tools and languages like rust and zig.

Code:
apt update
apt list
apt install rust
 
Last edited:

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top