How to compile apps for Tomato?

Discussion in 'Tomato Firmware' started by bimmerm3m5, Jul 18, 2009.

  1. bimmerm3m5

    bimmerm3m5 Network Guru Member

    Bear with me, I'm a noob to compiling but I've done a little searching and can't seem to find any info about compiling applications for the Tomato firmware.

    Specifically, I want to compile these 2 apps and get them running:

    I don't think I need to compile a firmware with these apps included, because I would imagine they could be created just like srelay.

  2. bogderpirat

    bogderpirat Network Guru Member

    nstx' source doesn't appear to be downloadable from anywhere - every download link seems to be a 404.

    in the case of icmptx, you'd have to download linksys' firmware for the wrt54gl which includes a crosscompiler for mipsel under ./tools/brcm/hndtools-mipsel-<uclibc|linux>/bin.
    you'd have to set your path to include either of these directories.
    afterwards, you could just go into the directory containing icmptx' source and edit the Makefile, replacing occurrences of "gcc" by "mipsel-linux-gcc", or "mipsel-uclibc-gcc".
    the last step should consist of a simple "make" which should produce a binary that works if you transfer it to your tomato.
    i compiled igmpproxy v0.1-b4 in a similar manner.
  3. bimmerm3m5

    bimmerm3m5 Network Guru Member

    You lost I to find this cross compiler somewhere on the official linksys ftp? Are there multiple versions of the cross compiler? I have a v2 WRT54g...
  4. bogderpirat

    bogderpirat Network Guru Member

  5. Assman

    Assman Addicted to LI Member

    bimmerm3m5, when you brick your router can I have it? :biggrin:
  6. bimmerm3m5

    bimmerm3m5 Network Guru Member

    Sure Assman....but I have a JTAG connection built in now, so I can supposedly recover from quite a mess.
  7. bimmerm3m5

    bimmerm3m5 Network Guru Member

    Well, Assman is out of luck. I got the compiler working, but now I'm a bit lost with compiling certain apps, such as iodine ( ). I assume i need to change the first line:

    CC = gcc
    COMMONOBJS = tun.o dns.o read.o encoding.o login.o base32.o base64.o md5.o common.o
    CLIENTOBJS = iodine.o
    CLIENT = ../bin/iodine
    SERVEROBJS = iodined.o user.o fw_query.o
    SERVER = ../bin/iodined

    OS = `echo $(TARGETOS) | tr "a-z" "A-Z"`
    ARCH = `uname -m`

    LIBPATH = -L.
    LDFLAGS = -lz `sh osflags $(TARGETOS) link` $(LIBPATH)
    CFLAGS = -c -g -Wall -D$(OS) -pedantic `sh osflags $(TARGETOS) cflags`

    all: stateos $(CLIENT) $(SERVER)

    @echo OS is $(OS), arch is $(ARCH)

    @echo LD $@
    @mkdir -p ../bin

    @echo LD $@
    @mkdir -p ../bin

    @echo CC $<
    @$(CC) $(CFLAGS) $< -o $@

    @echo "Cleaning src/"
    @rm -f $(CLIENT){,.exe} $(SERVER){,.exe} *~ *.o *.core
  8. fyellin

    fyellin LI Guru Member

    Assuming you've already downloaded the appropriate toolset:

  9. bimmerm3m5

    bimmerm3m5 Network Guru Member

    I did, installed there any way I can know if it is setup properly?
  10. fyellin

    fyellin LI Guru Member

    I wrote myself a little hello world, and then
    ...../mipsel-uclibc-gcc test.c -o test
    I copied the file "test" onto /tmp/test on the router, then ran /tmp/test on the router.

    It printed out "hello world."

    You're going to then want to compile and link bigger programs and copy them over.

  11. mstombs

    mstombs Network Guru Member

  12. rhester72

    rhester72 Network Guru Member

    Bear in mind that all three mentioned apps (nstx, icmptx and iodine) all require the kernel to be compiled with tun support, which (stock) Tomato's is not. This would be a better target for one of the OpenVPN-supporting builds (which must have tun by default).

    In short, these are non-trivial at best and will never work as "drop-ins" for official Tomato.

  13. ceckin

    ceckin LI Guru Member

    Yeah better download the source from one of the other mods and import NSTX etc., this way you'll be able to add GUI for them.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice