[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ next ]

Using qemu syscall emulation with Debian.
Chapter 2 - Setting up an environment


To setup the environment the way I describe, you will need a directory with around 150Mb of free space. However, once you are more experienced with the process you can use much less disk space. On my box, this directory is /scratch/qemu. I install a arm environment in /scratch/qemu/ARM by running the command below in the /scratch/qemu directory.

     fakeroot /usr/sbin/debootstrap --arch arm sid ARM

This will download arm debs and unpack them. This should fail with

     /usr/lib/debootstrap/functions: line 524: chroot: command not found

because you are not root. (If you are root this will fail anyway since you cannot execute the binaries).

Now, finish to unpack the debs

     for pkg in ARM/var/cache/apt/archives/*.deb; do \
     echo "Extracting $pkg..."; dpkg-deb -x $pkg ARM; done

since you cannot use chroot(2), all hard-coded paths to binaries you have installed might be a problem. In particular, edit the file ARM/lib/ld-linux.so.2 to replace the string /etc/ld.so.cache to something that does not exists like /xxx/ld.so.cache. Be careful to not change the length of the string, else the offset will be wrong and the ELF file will be invalid. Now you can try qemu with

     qemu-arm -L /scratch/qemu/ARM ARM/bin/ls

The -L option cause qemu to use an alternative root for finding the dynamic loader and the C library. You can also try

     qemu-arm -L /scratch/qemu/ARM ARM/bin/sh

Programs you launch from that shell will be native program unless you run them through qemu-arm itself.

You can check network access with

     qemu-arm -L /scratch/qemu/ARM ARM/usr/bin/wget www.debian.org

[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ next ]

Using qemu syscall emulation with Debian.

version 0.0, 1 mars 2005
Bill Allombert ballombe@debian.org