QEMU
QEMU is distributed as a source package, like most of open source tools, however this is not always convenient for Windows users, so you will also find a link to Windows pre-compiled binaries.
- UNIX users: download and compile QEMU from sources.
- Windows users: download the binaries from this page, or from this direct link to 1.6.0 zip package (52MB)
Installing GNU/Linux
The simplest and quickest way to get a Linux/ARM distribution running on top of QEMU is to used pre-installed Debian images. These Virtual Machine images can be found there along with additional useful information (be sure to read them all). As you can see, there are two kind of images: standard and desktop. The desktop one gives you the full Debian GUI environment pre-installed, but be warned, it is extremely slow, even on my Core i7 box with a medium-level graphic card, so I recommend using the standard version pre-installed with Debian Squeeze (latest Debian release).
The files you need from the debian.org site are (direct links provided for convenience):
- debian_squeeze_armel_standard.qcow2 (169MB)
- initrd.img-2.6.32-5-versatile (2.4MB)
- vmlinuz-2.6.32-5-versatile (1.2MB)
The command line for starting QEMU with the pre-installed VM is provided on the debian.org page, here is a copy of the right command line for the standard VM with 2.6.32 kernel:
qemu-system-armw -L Bios -M versatilepb -kernel vmlinuz-2.6.32-5-versatile -initrd initrd.img-2.6.32-5-versatile -hda debian_squeeze_armel_standard.qcow2 -append "root=/dev/sda1"For Windows users, the easiest way to start it is to make a shortcut on qemu-system-arm , add the command-line arguments and insert the path to the VM files in the "working folder" field.
You can now just run the emulator and boot on Debian to test your environment.
For purists, it is also possible to install the Debian distro from scratch following this step-by-step tutorial.
Making the Virtual Machine communicate
As you will quickly discover, the network connection is not working out of the box, so you need to add more parameters to the command-line to make it work. From my own experience, it is a black art to make it work properly (the documentation is really poor and obscure on that topic), but I ended up making the network work (and the Internet connection through the host platform) by using these additional arguments:
-net nic -net user
Once the VM is rebooted, you can test it using a ping and then issue an `apt-get update` command. In case the ping test passes but not the apt-get, you might have wrong apt source URL, so you can change them by editing the /etc/apt/sources.list config file.
You have now a working ARM virtual platform, but in order to make it useful for Red/System testing, you need a simple way to pass compiled files to the guest OS (Red/System can only cross-compile to ARM due to the lack of a suitable REBOL interpreter).
In order to achieve that, you need to add new parameters to the command-line in order to map a guest OS TCP port to a host OS port. For example, to map guest OS port 22 (SSH) to port 1222 on host OS, just add:
-redir tcp:2222::22
So, the VM internal port 22 is now reachable from localhost:1222 on your host OS. You can now use your favorite SSH/SFTP/SCP client to get a remote shell and transfer files to the VM. You might need to setup a SSH server in the VM (I seem to recall that it is not installed by default in the above images), you can achieve that using the following command:
# sudo apt-get install openssh-client openssh-server
I use SSH for moving files in and out the VM using the still excellent SSH Secure Shell tool for Windows, but you could as well use FTP or any other TCP-based suitable protocol.
Additional settings
You can improve your experience with QEMU by adding more memory to the default emulated ARM platform which only has 128MB. Pushing it to 256MB (same as Raspberry PI Model A board now has) is highly recommended, just add to the command-line:
-m 256
If you are using a non-english keyboard like myself, you can also emulate your preferred keyboard layout using for example, the following command:
-k fr
will setup the keyboard with a french layout, other country codes are available here. In case you get an error message about the keymap not being found, just copy the Bios/keymaps folder one level up, so that it is just above your qemu-* binaries.
That's all folks, I hope this would have help you get started! Let me know if there is any error or missing info in this article, and let me know if it worked well for you.
I wish the Raspberry Pi wait list was shorter :-)
ReplyDeleteLe dev de red semble ralentir?
ReplyDeleteDans la roadmap il y a la reécriture des compilateurs red/systeme et static en red. N'est-il pas plus judicieux d'écrire un interpreteur rebol et un parser partiel du langage C (seulement pour les instructions des fichiers .h) en red et ... ainsi d'une pierre on ferait trois coups:
-un rebol open source (rêve de la communauté rebol).
-plus besoin de reécrire les compilateurs.
-extensions futures par dll faciles.
Oui le dev de Red a ralenti car j'effectue une mission pour un client afin de pouvoir financer la suite du projet Red. Je termine ce mois-ci (juillet), le travail sur Red reprendra donc dans la foulée. Heureusement, j'ai dans le même temps reçu d'importantes donations qui vont me permettre de ne plus travailler que sur Red jusqu'à l'année prochaine au moins.
ReplyDeleteCe que tu décris n'est pas le projet Red, mais un projet de clone pure de REBOL (en remplaçant le C par Red+Red/System) si j'ai bien compris ? Je n'ai pas compris le parser partiel du langage C ? La réécriture des compilateurs en Red est un passage obligé pour avoir un langage indépendant de tout autre (C y compris, du moins autant que faire se peut) et est une forme de validation des fonctionnalités du langage. De plus, la réécriture en Red permettra l'implémentation d'un compilateur JIT.
Red n'a pas pour vocation de faire un clone de REBOL, mais de le dépasser (en gardant tous les bons aspects). Cf mes slides de présentations de Red.
Pour continuer la conversation, je suggère le canal IRC #red-lang.
What a star! Am sitting here thinking - shall i dig out my RaspberryPi to start working on DTrace for ARM, or could I use a VM. First hit, I hit this page, seconds later I have a working ARM kernel. How brilliant, and its running on my i7 laptop.
ReplyDeleteNow to get the network working....
Glad this tutorial was useful to you.
ReplyDeleteThanks for the extensive VM guide!
ReplyDelete