Assembly

From BarikWiki
Jump to: navigation, search

Intel Architecture

ARM Architecture

QEMU works well with emulating the ARM architecture, particularly since VMWare does virtualization, not emulation.

  • The physical memory map on versatile hardware does not allow more than 256MB of space for RAM (-m 256). Instead of a friendly error message, QEMU just crashes though!
  • QEMU. Finding a recent Windows built has been quite a challenge. To compile from source, you'll want MinGW, or Minimalist GNU for Windows. See the MinGW Installation Notes. It would be nice if one day MinGW provided sane instructions. Summarize: use mingw-get for basically everything, include msys-base.
  • Unfortunately, at this point: do not pass go, at least on compilation. Some older compilation instructions for Qemu on Windows 0.15.
  • However, some unofficial QEMU binaries are available. Eric Lassauge also has some recent images, and is linked to from the official QEMU site, but appears to be unable to afford bandwidth (the downloads are painfully slow).
  • Grab some QEMU disk images. Virtually Fun has some images as well, as an alternate.

On Windows (Hosts/W32), something a little weird happens, in that text which is normally printed by QEMU to the console output channels (normally known as standard output = stdout and standard error output = stderr) might be written to files called stdout.txt and stderr.txt. If you want to see QEMU's help messages or if it does not work as expected, you should look for these files in the directory where your exe file is installed. What's strange is that you can't get to this Wiki page at all from the QEMU Wiki.

On Windows, I also receive the following error when starting the qemu-system-arm binary directly: The program can't start because fmod.dll is missing from your computer. Try reinstalling the program to fix this problem.

The easiest, but perhaps most hacking, way of correct this issue was to simply copy the qemu-system-arm.exe out of the bin directory and place it one level up.

  • I find that when compared with something like VMWare, QEMU networking is quite unintuitive; the default networking is slirp, which is quite limited. And getting tap working in Windows is hard. Interestingly, redir is perhaps the most useful command here, but it's not easy to find. See QEMU/Networking.

This example will port forward 5555 to SSH on the guest OS:

-redir tcp:5555::22

Installing Debian on ARM

  • The Debian QEMU page has the simplest instructions, but it only works up to a point. It's not terribly useful for ARM.
  • Debian on an emulated ARM machine. Can be used for testing. ARMEL images. This is a good starting point. It's a little dated at this point, but works well if you simply replace vmlinuz-2.6.18-6-versatile with vmlinuz-2.6.32-5-versatile.
  • To check what type of QEMU disk image you've created, use qemu-img image linux.img.
  • It's somewhat difficult to track down, but in order to install the system in the first place, you'll need an initrd.gz (installer) and a vmlinuz-2.6.32-5-versatile. You can get both of these files from the Debian netboot images for versatile. Or you can grab them from aurel32. (In fact, you can actually grab pre-built QEMU images here if you don't want to install it yourself).
  • To install QEMU, use:
 qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.32-5-versatile \
   -initrd initrd.gz -hda linux.img -append "root=/dev/ram"
  • To boot the system, grab initrd.img-2.6.32-5-versatile. Presumably, you can get this kernel image by mounting the hard disk image, and copying over the file, but downloading it is much simpler:
 qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.32-5-versatile \ 
   -initrd initrd.img-2.6.32-5-versatile -hda linux.img \ 
   -append "root=/dev/sda1"
  • Recently, I've started getting "Bad archive mirror" when running through this installation. Check the Debian worldwide mirror list. The problem appears to be due to the fact that networking in QEMU is broken for certain Windows builds.

You can obtain Debian installation files, if you want. By far, the easiest way to accomplish this is to download the armel Small CD (netinst) directly. Or grab a torrent. There's really no need t o use jidgo at all these days.

ARM Assembly Tutorials

.global main
main:
  mov r0, #1
  mov r1, r0
  str r1, [r2]

QEMU Notes

  • Create a disk image with qemu-img create linux.img 2G.
  • You can boot with an ISO image for the installation: qemu -boot d -cdrom ~/Mandriva-Linux-Powerpack-2006-DVD.i586.iso -hda linux.img.
  • QEMU Monitor, when you think the issue might be with QEMU itself.