What's new

Compile C programs for asus routers

  • 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!

sovking

New Around Here
Hi,
I need to compile a C program to monitor some input on USB port.
(I need to compile this program).

I realize that I need to make cross-compiling. So, I create a Virtual Machine
with Ubuntu 12.04, and there I installed the necessary development tools and then the asus-merlin distribution for my RT-N66u.

Now my question is:
how I can use this building environment to make that program ?
What I have to set in my Makefile to get the right 'make' and 'gcc' working ?

Thanks in advance!
 
This is a simple solution I found:

Install a development environment for asus-merlin as described here.

Then create your Makefile following this template:
Code:
CC = mipsel-uclibc-gcc
CFLAGS = -O2 -Wall -pipe -mtune=mips32r2 -mips32r2 -isystem /home/youruser/asuswrt-merlin/release/src-rt/linux/linux-2.6/include -I./include
OFILES = main.o otherfile.o

TARGET = yourprogram

all:    $(TARGET)

$(TARGET): $(OFILES)
        $(CC) $(OFILES) -o $(TARGET)
        chmod 4711 $(TARGET)

main.o: Makefile main.c include/main.h include/otherfile.h 
        $(CC) $(CFLAGS) -c main.c

otherfile.o: Makefile comm.c include/main.h include/otherfile.h 
        $(CC) $(CFLAGS) -c comm.c

clean:
        rm -f $(TARGET) *.o
 
This is a simple solution I found:

Install a development environment for asus-merlin as described here.

Then create your Makefile following this template:
Code:
CC = mipsel-uclibc-gcc
CFLAGS = -O2 -Wall -pipe -mtune=mips32r2 -mips32r2 -isystem /home/youruser/asuswrt-merlin/release/src-rt/linux/linux-2.6/include -I./include
OFILES = main.o otherfile.o

TARGET = yourprogram

all:    $(TARGET)

$(TARGET): $(OFILES)
        $(CC) $(OFILES) -o $(TARGET)
        chmod 4711 $(TARGET)

main.o: Makefile main.c include/main.h include/otherfile.h 
        $(CC) $(CFLAGS) -c main.c

otherfile.o: Makefile comm.c include/main.h include/otherfile.h 
        $(CC) $(CFLAGS) -c comm.c

clean:
        rm -f $(TARGET) *.o

Do you think it would be possible for you to show me how to do this for this file? I'm trying to compile a version for 2.03 because I can't find the ipk anywhere.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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