qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] PATCH: fix qemu-mips[el]-static to work with debian squeeze/sid chroot
@ 2011-07-05 10:08 Wesley W. Terpstra
  2011-07-05 14:18 ` Peter Maydell
  2011-07-05 21:30 ` Lisandro Damián Nicanor Pérez Meyer
  0 siblings, 2 replies; 3+ messages in thread
From: Wesley W. Terpstra @ 2011-07-05 10:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: perezmeyer, pkg-qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 2608 bytes --]

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 #1.2: Type: text/html, Size: 2850 bytes --]

[-- Attachment #2: qemu-mipsel-debian-rootfs.patch.gz --]
[-- Type: application/x-gzip, Size: 1748 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-05 21:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-05 10:08 [Qemu-devel] PATCH: fix qemu-mips[el]-static to work with debian squeeze/sid chroot Wesley W. Terpstra
2011-07-05 14:18 ` Peter Maydell
2011-07-05 21:30 ` Lisandro Damián Nicanor Pérez Meyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).