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

Compiling an application for Linksys

Discussion in 'Linksys Official Firmware' started by manish at linksys, Nov 26, 2007.

  1. manish at linksys

    manish at linksys LI Guru Member


    I would like to embed a new application on Linksys.
    My C/C++ application compiles with gcc/g++ and runs very nicely on i386/Linux 2.4/2.6.
    It has a very small foot-print - less than 2MB

    My question is -
    I would like to learn - how to set up a development platform to build my application for Linksys.

    Is there a step-by-step guide / howto, that could guide me?

    Consider me a novice, and please be kind.

    Thanking you in advance.
  2. Toxic

    Toxic Administrator Staff Member

    new embedded application on linksys????? do you mean you want to add an application into some linksys firmware? what router? official firmware is very close to the maximum of the routers flash memory limits. for example a usual WRT54GL is 4MB flash. the firmware is approx 3-3.5Mb. if you added a new application of 2Mb you could not fit it into the 4Mb flash chip. you would then need to extract other features from the router that could break functionality.

    http://www.thibor.co.uk/#build shows how to compile the normal linksys firmware on the WRT54G, but if your looking to compile on another type of router (which you have not said) then you maynot beable to even compile the firmware correctly.

    compiling firmware is not an easy task if you dont even know where to start.
  3. manish at linksys

    manish at linksys LI Guru Member

    I sincerely appreciate that quick response, Simon, Thank you.

    Ok, I see your point.
    So, if my application takes 2MB on i386 it will take the same amount of space on openWRT.

    So academically speaking, my application could be embedded only if the memory on the Router was expandable, or there was some model that offered more free space for such activities (very doubtful).

    Would you be additionally (extra-kind), to clarify another one my confusions:
    Routers do not have i386 processors, they have something like MIPS/ARM/RISC. However applications can be compiled on i386 based systems, and then put on the desired target systems, and executed. Is there a step-by-step tutorial on that, somewhere? I seriously hunted the web for this, stupid me, but couldn't find one.

    The link that you offered, in your earlier reply, does seem to tell that this is possible. But is there a simple, but generic tutorial / guide somewhere, on this subject?

    Thank you again, for sharing your advice.
  4. mstombs

    mstombs Network Guru Member

    You need to look into "cross-compiling", the routers usually have mips processors.

    Here's a good introductory guide for OpenWrt


    You can relatively easily add a 64Mb SD card to expand the non-volatile memory, or run programs from a cifs share folder. You can also try every trick in the book to strip/compress your app to fit into available flash/ram - just see what dd-wrt achieves with only 2Mb flash on a WRT54G v5!
  5. manish at linksys

    manish at linksys LI Guru Member

    Thank you, for the tip Mstombs.

    The link that you posted above is invaluable.

    Eric Bishop has written such a wonderful paper.

    I wish there was more stuff and encouragement to people who wanted to write some innovative applications for openWRT.

    Just imagine having apps like SafeSquid, or p3scan or some lightweight IM on a Linksys router. Wouldn't that be wonderful ?!!

    If you have more such stuff to share, please be generous, I am hungry for more.

    Thank you, once again.
  6. mstombs

    mstombs Network Guru Member

    Glad you like it! Google showed me that page some time ago - I have never got into OpenWrt. Next step is to be able to build something like Tomato - this uses the Linksys toolchain distributed with the source Linksys firmware. You can then build small apps to run from jfffs using the same toolchain without risk of damaging the core firmware. If you can get hold of an older WRT54GS v1.1 which has 8Mb flash 32Mb ram or some similar new Tomato uses less than half the ram/flash.

    I use versions of the script here to build apps for my modem (another mips device), and just change the toolchain references to build for tomato:

  7. manish at linksys

    manish at linksys LI Guru Member

    How I wish there was some "nook" created in this forum to encourage developers of new application, on routers that run embedded linux, like linksys.

    What I see at mostly, is people just recompiling things to actually just adjust, some existing features or functions. Quite like "sharpening old knives". I would be so happy to see new apps being built, for use on linksys. Thank you for the advice.

    But, I must say I am very happy to talk about it with people like you. And I will go ahead with your suggestion of investing on a WRT54GS and try some stunts. Or do you suppose WRT54GL would be a better choice?

    Btw: how do you prefer to pronounce your nickname "mstombs" ?
  8. mstombs

    mstombs Network Guru Member

    A new WRT54GL would come with warranty - DO NOT get a new WRT54GS. The WRT54G-TM is rumoured to have the older standard 8/32 memory but needs to be JTAGed to unlock the T-Mobile firmware (breaking any warranty!). The WRTSL54GS also has 8/32 and Toxic must have plenty of free flash/ram as I see he uses Tomato without the usb port functionality - but interesting for future hacking.

    If you seriously want to develop apps I think you will need to build/fit the serial console connection which will allow you to see error messages when LAN comms broken!
  9. Toxic

    Toxic Administrator Staff Member

    thats right, I now have a synology CS407 with built in Ethernet so this plugs directly into my ASA5505 and is on the DMZ as a web/ftp/media server, sp my SL is merely an access point for now. it has served me very well and when the USB was in use, I used Thibor 17RC3 firmware.

Share This Page