Compile for AR7-MIPSEL under QEMU - possible?

All about firmwares for routers. Support for RouterTech firmwares is here too.
Post Reply
User avatar
rokafeller
Regular
Regular
Posts: 71
Joined: Wed Jul 22, 2009 8:57 pm
Location: Italy

Compile for AR7-MIPSEL under QEMU - possible?

Post by rokafeller » Tue Apr 19, 2011 1:27 am

Hi all,

I've been investigating a bit to understand whether it's possible to compile for AR7 without crosscompiling. The goal would be having an AR7-compatible virtual machine, running for example Debian, where compile process is easier and can leverage tools like apt-get for libraries, etc.
The QEMU http://wiki.qemu.org project looks interesting since it can emulate a lot of RISC platforms: I tried to compile a simple hello world on Debian running on MIPSEL, but my executable doesn't run on G624T.

Somehow it's possible, since some german guys made a VM emulating an AR7 router running OpenWRT http://ar7-firmware.berlios.de/qemu/index.html.en

My goal would be far simpler: not emulating the router itself, but simply creating a compiling environment that allows direct compiling of source code.
Did you ever think of such an option? For other RISC platform it works quite well (ie. for home/smb nas's running on some SPARC processors).. do you have an idea of which emulation should one be looking for? Have you ever tried it?

I think it would be great to have a standard virtual machine image that allows compiling for AR7/routertech!

cheers
d
Running D-Link DSL-G624T, PSP bootloader in place of the original Adam2, RouterTech Firmware v2.97. OpenVPN and port knocking services activated.
mstombs
RouterTech Team
RouterTech Team
Posts: 3753
Joined: Wed Jan 10, 2007 11:54 pm

Re: Compile for AR7-MIPSEL under QEMU - possible?

Post by mstombs » Tue Apr 19, 2011 8:56 am

AR7 emulation does sort of work run under QEMU, I have used my router bootloader mtd2 etc, but failed trying to load the atm/dsp drivers - if you remove those it could boot to a serial console command line I recall, but no Ethernet emulation either so all pretty academic only!

Routers with hard-drives can use optware to install native compile environments - I have one on my Linksys NSLU2 - but only needed because the cross-compile tools I tried not compatible with modern 64 bit Linux host. I am not familiar with any AR7 routers with usb hard-drives that are supported by OpenWrt, but if you had one (fritz-box?) you could do this with OpenWrt - but then you don't need it because OpenWrt has such a great buildroot tool to build a cross-compiler!

I don't see any mileage in trying to run this native under QEMU. A more realistic option is a standard 32-bit old Linux kernel virtual machine that works with a standard cross-compiling toolchain, without any special dependencies on system libraries, host 'make', 'bash', 'path' etc.

Should be easy to compile a "Hello World" with the pre-built "Hard-Hat" toolchain, not sure if the Acorp/mcmcc links still alive, but Linksys WAG200G GPL distros include one (GPL may be available from OpenWAG2000 sourceforge website). Compiling modern apps for AR7 is much harder, need to know all about the old kernel/library limitations - its too difficult to support on this site!
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: Compile for AR7-MIPSEL under QEMU - possible?

Post by thechief » Tue Apr 19, 2011 12:19 pm

I agree that it is not a viable proposition to do it this way. Cross compilation is not complicated if you are freed from host system dependencies. We hope to release such a self-contained build system when we release firmware v2.96.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
geekgirl
Regular
Regular
Posts: 72
Joined: Sat Feb 27, 2010 3:23 pm
Location: Egypt
Contact:

Re: Compile for AR7-MIPSEL under QEMU - possible?

Post by geekgirl » Tue Apr 19, 2011 10:04 pm

thechief wrote:We hope to release such a self-contained build system when we release firmware v2.96.
That would be remarkable!
User avatar
rokafeller
Regular
Regular
Posts: 71
Joined: Wed Jul 22, 2009 8:57 pm
Location: Italy

Re: Compile for AR7-MIPSEL under QEMU - possible?

Post by rokafeller » Tue Apr 19, 2011 10:45 pm

geekgirl wrote:
thechief wrote:We hope to release such a self-contained build system when we release firmware v2.96.
That would be remarkable!
totally agree.
Crosscompiling is not a difficult procedure itself, but due to the variety of involved components it can become really time consuming for non xcompilation experienced users.

thanks
d
Running D-Link DSL-G624T, PSP bootloader in place of the original Adam2, RouterTech Firmware v2.97. OpenVPN and port knocking services activated.
Post Reply