I just discovered qemu-user, thanks to lu_zero on #gentoo-embedded. It’s brilliant. They took QEMU’s ability to simulate an entire processor, tossed out the other hardware emulation, and packaged it up. qemu-user’s primary use is for running foreign binaries.
So far, I’ve been running all my stage generation for Neuvoo on the BeagleBoard, which has a 500MHz armv7a processor. Everything compiles very slowly, but at least it’s native and stable.
There’s a couple problems with that setup. First, everything is running off an SDHC card. We’re talking slow. Second, the beagle has 128M of RAM, and after that it’s using the swapfile. Which is on the SDHC card. Now we’re really talking slow.
qemu-user deftly solves these problems. Of course, running stage generation on my hefty 2.6GHz Core2 Duo processor is going to slightly speed up compiling, just because of the dual cores. But not only that: now I have a huge, fast 7200rpm hard-drive to run everything off of, and 4G of RAM (2 of which is almost always cache) to run it all within.
Think of it like this: qemu-user enables you to run a chroot (and possibly other things) for almost any processor on a system of your choice, as though it were running natively.
Setting up qemu-user is a piece of cake, so I won’t go into details here. Just follow these instructions. One thing I didn’t get at first was why they use “USE=static”. The reason is this: if you’re going to be running an armv7a chroot, you need something inside the chroot to be translating (qemu-user). The problem is, that something can’t link dynamically against any libraries, because they’ll all be armv7a libraries. Static linking means the binary is self-contained and portable.
Let me know if there are other cool uses for qemu-user. I’m all ears.