* [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
* Re: [Qemu-devel] PATCH: fix qemu-mips[el]-static to work with debian squeeze/sid chroot 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 1 sibling, 0 replies; 3+ messages in thread From: Peter Maydell @ 2011-07-05 14:18 UTC (permalink / raw) To: Wesley W. Terpstra; +Cc: perezmeyer, Riku Voipio, qemu-devel, pkg-qemu-devel On 5 July 2011 11:08, Wesley W. Terpstra <terpstra@debian.org> wrote: > 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. Thanks for this patch. To get it merged upstream it would be helpful if you could resubmit it in line with the guidelines at http://wiki.qemu.org/Contribute/SubmitAPatch (in particular it needs a Signed-off-by: line, it should be one patch per bug fix, and it needs to be against current head of qemu git). In the meantime, some minor initial review comments: > @@ -1985,6 +1985,20 @@ > MIPS_SYS(sys_epoll_pwait, 6) > MIPS_SYS(sys_ioprio_set, 3) > MIPS_SYS(sys_ioprio_get, 2) > + MIPS_SYS(sys_utimensat, 4) > + MIPS_SYS(sys_ni_syscall, 0) /* signalfd */ > + MIPS_SYS(sys_ni_syscall, 0) /* timerfd */ > + MIPS_SYS(sys_eventfd, 1) > + MIPS_SYS(sys_fallocate, 4) > + MIPS_SYS(sys_ni_syscall, 0) /* timerfd_create */ > + MIPS_SYS(sys_ni_syscall, 0) /* timerfd_gettime */ > + MIPS_SYS(sys_ni_syscall, 0) /* timerfd_settime */ > + MIPS_SYS(sys_ni_syscall, 0) /* signalfd4 */ > + MIPS_SYS(sys_eventfd2, 2) > + MIPS_SYS(sys_epoll_create1, 1) > + MIPS_SYS(sys_dup3, 3) > + MIPS_SYS(sys_pipe2, 2) > + MIPS_SYS(sys_inotify_init1, 1) > }; You can drop this bit as there's already a patch in the works which adds the new syscall numbers: http://patchwork.ozlabs.org/patch/102241/ (the earlier fix for sigaltstack is still needed). There are also some bits of your patch which use hardcoded tabs; these should be spaces. (Yes, existing code is sometimes not consistent; we tend to convert gradually as we touch code.) Otherwise I think it looks good. Thanks again -- PMM ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] PATCH: fix qemu-mips[el]-static to work with debian squeeze/sid chroot 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 1 sibling, 0 replies; 3+ messages in thread From: Lisandro Damián Nicanor Pérez Meyer @ 2011-07-05 21:30 UTC (permalink / raw) To: qemu-devel; +Cc: pkg-qemu-devel, Wesley W. Terpstra [-- Attachment #1: Type: Text/Plain, Size: 703 bytes --] On Mar 05 Jul 2011 07:08:23 Wesley W. Terpstra escribió: > 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: Hi! I tried this patch (patched the current qemu in Debian) and I can happily say it works :-) Thanks everyone :-) -- <rata> hmm, el enchufe hace chispas... <-- rata ha dejado este servidor ("Leaving"). <marga> ouch Visto en #lugfi, irc.freenode.net Lisandro Damián Nicanor Pérez Meyer http://perezmeyer.com.ar/ http://perezmeyer.blogspot.com/ [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 836 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).