[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] PATCH: fix qemu-mips[el]-static to work with debian squeeze

From: Wesley W. Terpstra
Subject: [Qemu-devel] PATCH: fix qemu-mips[el]-static to work with debian squeeze/sid chroot
Date: Tue, 5 Jul 2011 12:08:23 +0200

I also recently tried to get a mipsel debian/sid chroot running under my amd64/squeeze system. As posted by Lisandro earlier this month, it didn't work. ;-) There are several problems, the most glaring of which the attached patch fixes. I'll break down the changes:

1. Return -TARGET_ENOSYS instead of -ENOSYS from linux-user/main.c
   * Caused the strange 'Level 2 synchronization messages' instead of correctly reporting the syscall was missing.
   * Made glibc simply fail instead of using older syscalls (one important example is the new setrlimit syscall which qemu lacks and gnupg/apt needs)

2. The mips syscall table wasn't kept in-sync with syscall.c
   * utimensat was missing (and the cause of the ENOSYS error Lisandro was seeing)
   * Although I didn't run into problems with any other syscalls, I updated the table to match syscall.c as well I could anyway

3. Dereferencing a null pointer causes an exception 0xC (EXCP_AdEL) instead of EXCP_TLBL. This should also trigger a segfault.

4. The codes for get/setrlimit do not stay constant between linux target platforms. I added a conversion method. This is important else programs (rsyslog, python, ...) can go into a near infinite loop trying to close all the file descriptors from 0 to -1.

5. 64-bit file system calls were failing on mipsel (ftruncate 888 created files 888*4GB large). arm had already work-around code for EABI which also worked for mipsel, so I just added the same code path for mips everywhere arm eabi has it. Works for both little and big endian.

These changes were enough to get a mostly working debian chroot for me. I did have to install squeeze first and then dist-upgrade to sid, however, as debootstrap seems to have problems with the new multilib glibc (dist-upgrade will install it fine, though).

To setup a mipsel chroot in /media with the patch applied:
apt-get install qemu-user-static binfmt-support debootstrap
debootstrap --foreign --arch=mipsel squeeze /media/mipsel-sid
<compile qemu with patch>
cp <qemu-srcdir>/mipsel-user-static /media/mipsel-sid/usr/bin
chroot /media/mipsel-sid
/debootstrap/debootstrap --second-stage
echo deb http://ftp.de.debian.org/debian sid main > /etc/apt/sources.list
apt-get update
apt-get install locales
mount devpts /dev/pts -t devpts
mount proc /proc -t proc
mount sys /sys -t sysfs
dpkg-reconfigure locales
apt-get dist-upgrade
... install whatever else you need ...

There is still some problem where gcc 4.6.1 in the chroot can ICE when handling floating point code. I'm looking into it.

I would appreciate it if these fixes could be merged upstream. Thanks.

Attachment: qemu-mipsel-debian-rootfs.patch.gz
Description: GNU Zip compressed data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]