1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

pixelserv compiled to run on router WRT54G

Discussion in 'Tomato Firmware' started by Jedis, Sep 5, 2009.

  1. HunterZ

    HunterZ Networkin' Nut Member

    What toolchain can be used to compile the h0tw1r3 version? I get weird errors trying to use Shibby's branch of the Tomato firmware toolchain:
    $ make
    mipsel-uclibc-gcc -mips32 -Os -s -Wall -ffunction-sections -fdata-sections -fno-strict-aliasing -Wl,--gc-sections -DDO_COUNT -DTEXT_REPLY -DREAD_FILE -DREAD_GIF -DNULLSERV_REPLIES -DSSL_RESP pixelserv.c -o dist/pixelserv.mips32
    pixelserv.c: In function `main':
    pixelserv.c:615: `AI_ADDRCONFIG' undeclared (first use in this function)
    pixelserv.c:615: (Each undeclared identifier is reported only once
    pixelserv.c:615: for each function it appears in.)
    make: *** [mips] Error 1
    Edit: Happens with the official version too.

    Edit 2: Looks like I screwed up and was probably using the trunk toolchain, which is ancient.
    Last edited: Apr 22, 2014
  2. koitsu

    koitsu Network Guru Member

    Ensure the .c file has the following lines in it:

    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netdb.h>
    If it contains these (edit: it looks like it does), then the Makefile or related bits are not referring to the proper location (specifically -I include base directory) for where these are located. Cross-compiling is a complex/different situation than native compiling, but my guess from reviewing the Makefile is that missing -I arguments for relevant kernel include file paths. Here's an example (from some of the TomatoUSB source, albeit Toastman's branch) -- and a big example but I digress -- of included crap in the firmware and how use of CPPFLAGS and CFLAGS often require -I arguments to include what's relevant (see targets miniupnpd, and especially flac/stamp-h1). TL;DR -- I think the author of that stuff on github needs to provide much more accurate/thorough documentation of how to get his stuff to build. Building stuff for TomatoUSB is never easy.

    AI_ADDRCONFIG and its functionality is discussed as part of getaddrinfo(3). I'm not sure if this functionality is available in Linux 2.6.22 (I'd need to git clone the tomato source and grep through it all).
    Last edited: Apr 20, 2014
  3. HunterZ

    HunterZ Networkin' Nut Member

    For what it's worth, I grep'd the Tomato toolchain I was trying to use and didn't find AI_ADDRCONFIG in any .h files.

    Sent from my Nexus 7 using Tapatalk
  4. koitsu

    koitsu Network Guru Member

    Took the time to git clone and all that jazz.

    Toastman-RT-N branch contains uClibc (the libc that's used on Tomato) which does in fact support and define AI_ADDRCONFIG, for both 2.4 and 2.6 kernels:

    2.4: http://repo.or.cz/w/tomato.git/blob.../hndtools-mipsel-uclibc-4.2.4/include/netdb.h
    2.6: http://repo.or.cz/w/tomato.git/blob.../hndtools-mipsel-uclibc-4.2.4/include/netdb.h

    This is the file which should be included when using #include <netdb.h>

    And support for this is indeed included in uClibc from review of the configuration portion:

    2.4: http://repo.or.cz/w/tomato.git/blob...sel-uclibc-4.2.4/include/bits/uClibc_config.h
    2.6: http://repo.or.cz/w/tomato.git/blob...sel-uclibc-4.2.4/include/bits/uClibc_config.h

    If the branch you checked out had none of this, then therein lies the problem. But if you're using, say, Toastman-RT-N, and the problem happens, then the issue relates to incorrect include paths being passed to gcc as my previous post explained; the issue happens during compile-time, not link-time. I only follow Toastman-RT-N; I respectfully can't be bothered to try and track all the changes everyone else is doing all the time.

    Based on a quick skim of the pixelserv code linked in question, the use of AI_ADDRCONFIG appears to be important.
  5. mstombs

    mstombs Network Guru Member

    So there is a problem either Shibby or Entware toolchain? h0tw1r3 pixelserv Compiles fine on Ubuntu or with old tomatousb toolchain - but there is a code bug ifname not null strung defined, so you must specify "-n lo" or similar to be able to use, also the tiny build option is broken, still haven't looked at DECODE_URL in operation!
  6. HunterZ

    HunterZ Networkin' Nut Member

    There may be a problem with Shibby, yeah. I was just able to compile h0tw1r3's mips-flavored pixelserv with Toastman-RT-N just like koitsu, so I guess I'll stick with that toolchain?

    Not to get too off-topic, but I searched the entire Internet yesterday looking for some discussion on which branch was the best to use for a Tomato cross-compiler toolchain and came up empty and frustrated. I had semi-randomly picked Shibby's tomato-shibby-RT-AC branch because it was one of the most recently updated, and I guess it didn't pay off.

    Edit: Build seems to run fine on my RT-N66U (K26 mipsR2 running Toastman Tomato).

    Also noticed that h0tw1r3 provides occasional binary releases (doh): https://github.com/h0tw1r3/pixelserv/releases
    Last edited: Apr 21, 2014
  7. jerrm

    jerrm Addicted to LI Member

    Just grabbed the zip from h0tw1r3's git, got a fresh new copy of Shibby's RT-AC branch, and the mips version builds and (appears to) run fine for me.

    Just to be sure - you realize the Shibby chain is compiled for a 64bit OS?
  8. HunterZ

    HunterZ Networkin' Nut Member

    I'm on 64 bit actually. Maybe I screwed up the git clone/checkout somehow.

    Edit: Yeah, I'm pretty sure I ended up with the a base Tomato 1.28 checkout instead of Shibby's. Oh well.
    Last edited: Apr 21, 2014
  9. superdos

    superdos Reformed Router Member

    I've compiled h0tw1r3's version of pixelserv for Asus RT-AC68U.
    If anyone interested I use the toolchain included in the Asus Firmware source (hndtools-arm-linux-2.6.36-uclibc-4.5.3).

    Attached Files:

  10. koitsu

    koitsu Network Guru Member

    Folks should be very careful using this for the following reasons. Note that when I say "TomatoUSB" I am referring to Toastman-RT-N branch (others may differ, but I think the kernel and uClibc are identical across Toastman, Shibby, and Victek):

    - Architecture differences -- be very aware that this binary is for the RT-AC68U. It may not work on other models of routers given SoC differences.

    - TomatoUSB uses Linux 2.6.22, while Asus uses Linux 2.6.36. It's very possible that some part of the socket implementation or layer changed across all those minor versions.

    - TomatoUSB uses uClibc 0.9.30 with some patches (it's labelled "" -- don't confuse this with, while Asus uses (I have no idea). uClibc is probably the most key/critical part to this picture (if something was to break I'd expect it to be here more so than the kernel).

    - A statically-linked binary would not necessarily rectify issues encountered with either of these items.

    It's always best to provide binaries built for the specific router and firmware you're using. Kudos to you for building a binary that works for you on that specific firmware / with that specific toolchain, but that may not work correctly for others using TomatoUSB.
  11. mstombs

    mstombs Network Guru Member

    I'd always recommend using the same toolchain as used for the firmware, so library links and kernel hooks are correct. I suspect the Victek/Shibby Tomatousb ARM ports do use the Asus toolchain and same kernel version with Broadcom binary modules at the moment.

    Linux binaries can be surprisingly portable - with mipsel dynamic linked binaries working between Broadcom K2.6 routers and Ti AR7 K2.4 adsl router firmwares in my experience - but I found earlier in this thread that pixelserv built using tomatousb toolchain did not work on stock tomato K2.4 firmwares, a failure to run due to missing/changed library link, rather than obscure occasional run-time error which is always possible when mixing/matching.

    I assume things are better forward compatible so pixelserv with older Toastman toolchain will work fine with newer Shibby toolchain, but I have to admit haven't looked in detail at Shibby/Entware compilers. I did have my own built toolchain with a timezone patch at one time. In a different field I see some Android mods claim better performance with newer gcc/ Linaro compilers and optimizations, and its not unusual to see different compiler used for kernel and userspace, but all quite risky to try.
  12. lancethepants

    lancethepants Addicted to LI Member

    I believe Tomato and Asus both use the same kernel in both instances of architectures, as is necessary for the binary blob drivers

    mipsel -> (MIPSR2)
    arm ->

    uclibc is not necessarily backwards compatible with previous versions, in fact they may be very incompatible (so statically compile)

    I would safely say it is fine to use another toolchain, so long as it was also built against the same kernel version and architecture as the firmware you run, and you statically compile (unless you want to setup a whole entware-like environment). Maybe not in all cases, but I would say most the time.
    One good example of this is entware. Totally different, more up-to-date toolchain. I actually think the toolchain that entware uses is superior to tomato's. It manages to work across a plethora of routers with various firmwares.

    It's surprising how some non-static binaries still tend to work on systems built with different toolchains. For example, many of the early non-static binaries I compiled would work fine on dd-wrt systems, using the libraries from their firmware. Some would horribly break though too :)
    Last edited: Apr 22, 2014
    koitsu likes this.
  13. darkknight93

    darkknight93 Serious Server Member

    This is what adblocking Looks in Sophos UTM (different router distro for x86 - free!)

    You can unblock via "Unblock" and page will load automatically

    Administration is quite easy due you only Switch on filtering for ads - lists are updated by Sophos Team itself adblock.jpg
  14. mstombs

    mstombs Network Guru Member

    Is Sophos UTM GNU/Linux based so has GPL available? A splash page on blocked domains is actually opposite to what pixelserv aims to do!
  15. darkknight93

    darkknight93 Serious Server Member

    Sophos utm is based on open suse enterprise server. The sophos part itself is closed firmware due it not only offers proxy but also routing and WiFi protection..

    Well I find splash pages okay due I sometimes need to bypass filtering. But you can edit this splash screen :)

Share This Page