OpenWrt Forum Archive

Topic: Porting an app, how do I compile?

The content of this topic has been archived on 9 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all:

Apologies for a stupid question, but we all start from the bottom one day!

I am an experienced developper and know my way around Linux and gcc (which I use everyday at work).

I now have some applications I would like to port, and am not sure how I should go about compiling them so they work on my wrt54g.  The code is really simple, and uses basic file io, sockets (although I could live without this) and a serial port (which I've successfully added to my wrt).  No external libraries are required, etc.

How would I go about building this code?  I have untarred and built the openwrt "distro" if it matters.  I assome I need to use the "toolchain" somehow.

Thanks in advance.

The best way to start, would be to look in the packages/* directories, at the Makefiles, and Config.in's and create your own subdirectory for your package.

Examine the makefiles, to see which environment variables are passed along to point to the crosscompiler that the OpenWRT build uses. You will also need to add a line for your packages' Config.in into packages/Config.in, and add a target for your package to packages/Makefile.

Socket support, etc shouldn't be a problem. Many complicated packages run just fine on the WRTs. If you're lucky, you may not need to make any code changes at all.

(Last edited by TheRoDent on 26 Jun 2005, 23:03)

Thanks for the answer TheRoDent.

Ok, I feel like a moron...  I check the makefiles, etc.  Looks all dandy.  Where's the code!!!!!  None of the packages I'm looking at have code?  Isn't there a "so you wanna compile hello_world.c" howto somewhere?

Funny how you think you're a rocket scientist until you try something new ;-b

Well, I'm replying to myself but I figured it out.  I now have my application compiled and running on OpenWRT.

I wasn't looking in the right place initially.

Saweeeet!

So could you update the wiki with your experience ?
thanks

This was my intention, but I want to make sure I know a bit more what I'm talking about as from experience, people are not too chatty when you ask for advice, but when you're trying to give some, they are quick to criticize!

I'll get my thoughts together!

Just curious.  What's the link to that wiki article?

Hey Hi pcbroch could u please explain steps like how u could compile a code like hello_world.c to a object hello_world.o and make a hello_world.ipkg?
  I am comparetively newer to linux programming so.. found it a bit hard to understand the buildroot and ipkg howto documentation.

The discussion might have continued from here.