OpenWrt Forum Archive

Topic: Toolchain on usb drive?

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

Hi All,

I use the svn kamikaze toolchain, but my harddisk runs out of space.
I wanted to run the toolchain from usb disk so i used the svn co https://svn.openwrt.org/openwrt/trunk/
so everything was coppied on the usb disk. when i run make menuconfig it complains about missing dependencies,
but they are all installed and i dont have the error when i have the toolchain installed on the internal disk.
I guess the toolchain expect zlib, ncurses, etc to be installed on the same disk.
I can create a buch of symlinks to solve this, but i think there is a much better way.

Anny ideas?
Thanks for all help.

NO. Native compilation is NOT supported.

You have to cross-compile on a Linux box either on a real box or in a Virtual Machine.

(Last edited by forum2008 on 23 Mar 2008, 14:02)

forum2008 wrote:

NO. Native compilation is NOT supported.

You have to cross-compile on a Linux box either on a real box or in a Virtual Machine.

Yes, this is what i mean. The toolchain is on my laptop with kubuntu.
But i run out of space, so i attached a usb disk to my laptop and intalled the toolchain on the usb disk.
(i had to mention my laptop in first post. Sorry)

There is no reason this should not work.

I have kamikaze checked out to my home directory.  There is no difference between that and having it on /mnt/usb or somewhere else instead.

Did you install the official Ubuntu packages for zlib and the other dependencies or did you install them manually?

You might have a point there. I first installed things manualy because i could not find them. (used wrong package manger)
Later i found out how to install them and did this using synaptic. Maybe some things are still screwed up because of the first attemt

forum2008 wrote:

You have to cross-compile on a Linux box either on a real box or in a Virtual Machine.

What is a cross-compile on a real box?

He means you must compile on an x86 Linux PC instead of trying to compile on the router itself.

e.g. if you have a MIPS-based router, your cross compiler runs on x86, but produces MIPS binaries.

A normal compiler will run on x86 and produce x86 binaries (or run on MIPS and produce MIPS binaries).

What you explained is called a cross compilation on a host computer which most of us have been doing; however, what I asked is a cross-compile on a real box. These are two different things. AFAIC, a cross-compile on a real box is a native compilation that forum2008 said that isn't supported (by OpenWRT). However, it doesn't mean one cannot do a native compilation to produce an OpenWRT firmware.

mazilo: "to cross-compile" is the verb form of "cross compilation" (noun form).  i.e. it is the same thing.  I don't understand why you distinguish between them and why you say "cross-compile on a real box" is a native compilation.

Whether or not one can compile OpenWrt natively I do not know.  I am pretty sure it would work if the target is x86, but maybe it would not work on some other platform for some reason.

Perhaps I should try it on qemu smile

i did used the uclibc mips toolchain to compile stuff on my router. This did work, but was pretty slow sad
So i think it is also possible to create opwrt firmware on the router, but of course this will take a lot of patching.

Wodin wrote:

mazilo: "to cross-compile" is the verb form of "cross compilation" (noun form).  i.e. it is the same thing.  I don't understand why you distinguish between them and why you say "cross-compile on a real box" is a native compilation.

I wasn't trying to distinguish what you claimed above; however, I tried to find an answer from forum2008 what he meant by a cross-compile on a real box. The way I understood about a real box is the actual machine that runs the code; thus, a cross-compile on a real box is nothing but a native compilation. If so, the two statements that forum2008 said on his post here really contradict each other. Thus, this prompted me to ask forum2008 for a little clarification on what he said on his post.

BTW, I haven't done any native compilation on the OpenWRT SVN source; however, I don't see why a native compilation won't work if the codes can be cross compiled, except the compilation process takes more time. I thought all one needs is the native SDK to perform a native compilation.

mazilo: Ah, no he meant "real" as opposed to "Virtual Machine."  He said native compilation is not supported and that you must "cross-compile on a [real Linux PC] or in a Virtual Machine."

mrx: I have also compiled small things on one of my routers by mounting the toolchain via NFS, but it was incredibly slow just to compile a simple "Hello, World", so I would never bother trying to do compile OpenWrt like that.  Anyway, I don't know if there would be enough RAM.

Wodin wrote:

mazilo: Ah, no he meant "real" as opposed to "Virtual Machine."  He said native compilation is not supported and that you must "cross-compile on a [real Linux PC] or in a Virtual Machine."

Thanks and you are definitely right!

Wodin wrote:

mrx: I have also compiled small things on one of my routers by mounting the toolchain via NFS, but it was incredibly slow just to compile a simple "Hello, World", so I would never bother trying to do compile OpenWrt like that.  Anyway, I don't know if there would be enough RAM.

By any chance, did you try to compile this simple program several times to time the compilation process to see how long did the process take and how much RAM was being consumed? The reason I asked this kind of questions is I suspect the system started to waste resources in trying to swap out without any swapped file. Back in earlier 90s when Linux just started, I remember porting/compiling my ANSI C/C++ neural-net program on an i386 20MHz 8MB RAM was very fast and much faster than any MS C/C++ compiler. This was a 20MHz, not 200MHz RiSC, CPU with only 8MB, not 32MB, RAM, except with a 16MB swapped file.

There is no disk on my router, so definitely no swap smile

It also has only has 16MB of Ram.  Although that's more than your 386 with 8MB of RAM, I think the swap makes a bit of a difference.  Also, I was using gcc 3.x or 4.x (I can't remember now) which is probably bigger than 2.x that you were probably using.

I think the main problem was that I had the toolchain mounted via NFS over USB.

I did not monitor the network or RAM while I was compiling, and I didn't recompile several times because I was just testing if it would work, not how long it would take.

Wodin wrote:

I think the main problem was that I had the toolchain mounted via NFS over USB.

IIRC, my HD was only able to deliver about 5MBps (~40Mbps) throughput. If your router supports USB2, I am sure it probably had no problem to be able to stream data at least a 40Mbps. So, this wouldn't be the issue. As you said, I would suspect a swapped file is the issue. In this case, we probably will be able to attain the speed needed to perform a native compilation of an OpenWRT source if we attach a swapped file through a USB2 port. Someone just needs to try to see the possibilities.

The discussion might have continued from here.