From patchwork Fri Mar 26 23:58:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Landley X-Patchwork-Id: 48734 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 18D4FB7CF0 for ; Sat, 27 Mar 2010 11:03:40 +1100 (EST) Received: from localhost ([127.0.0.1]:60619 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvJRx-0004Dh-J3 for incoming@patchwork.ozlabs.org; Fri, 26 Mar 2010 20:00:25 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NvJQf-0004DM-U0 for qemu-devel@nongnu.org; Fri, 26 Mar 2010 19:59:05 -0400 Received: from [140.186.70.92] (port=46820 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvJQe-0004Cy-6t for qemu-devel@nongnu.org; Fri, 26 Mar 2010 19:59:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NvJQb-0001zv-G9 for qemu-devel@nongnu.org; Fri, 26 Mar 2010 19:59:03 -0400 Received: from static-71-162-243-5.phlapa.fios.verizon.net ([71.162.243.5]:60575 helo=grelber.thyrsus.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NvJQb-0001zR-AT for qemu-devel@nongnu.org; Fri, 26 Mar 2010 19:59:01 -0400 Received: from landley.net (localhost [127.0.0.1]) by grelber.thyrsus.com (Postfix) with ESMTP id B9B669F0155 for ; Fri, 26 Mar 2010 19:58:07 -0400 (EDT) From: Rob Landley Organization: Boundaries Unlimited To: qemu-devel@nongnu.org Subject: Re: [Qemu-devel] How do I build mips64-linux-user? Date: Fri, 26 Mar 2010 18:58:53 -0500 User-Agent: KMail/1.11.2 (Linux/2.6.28-18-generic; KDE/4.2.2; x86_64; ; ) References: <201003251904.47784.rob@landley.net> In-Reply-To: <201003251904.47784.rob@landley.net> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201003261858.55017.rob@landley.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Thursday 25 March 2010 19:04:46 Rob Landley wrote: > If I do the standard "./configure --disable-werror", it builds qemu-mips > and qemu-system-mips64, but no qemu-mips64. If I tell it "./configure > --disable- werror --target-list-mips64-linux-user", configure completes but > the build breaks because it can't set up the dependencies for that > directory. > > How do I beat a qemu-mips64 out of the qemu source? Apparently, gentoo > manages to build one, but I'm not sure how.... Answer: Gentoo's qemu ebuild file is here: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app- emulation/qemu/qemu-0.11.1.ebuild?rev=1.2&view=log Which has these bits: IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} ppcemb" IUSE_USER_TARGETS="${COMMON_TARGETS} alpha armeb ppc64abi32 sparc64 sparc32plus" src_prepare() { # avoid fdt till an updated release appears sed -i -e 's:fdt="yes":fdt="no":' configure # prevent docs to get automatically installed sed -i '/$(DESTDIR)$(docdir)/d' Makefile # Alter target makefiles to accept CFLAGS set via flag-o sed -i 's/^\(C\|OP_C\|HELPER_C\)FLAGS=/\1FLAGS+=/' \ Makefile Makefile.target tests/Makefile [[ -x /sbin/paxctl ]] && \ sed -i 's/^VL_LDFLAGS=$/VL_LDFLAGS=-Wl,-z,execheap/' \ Makefile.target # Append CFLAGS while linking sed -i 's/$(LDFLAGS)/$(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS)/' rules.mak epatch "${FILESDIR}/qemu-0.11.0-mips64-user-fix.patch" } Most of which isn't very interesting. Presumably they're getting mips64 from "COMMON_TARGETS", which looks like some kind of ebuild standard plumbing. Gentoo also has a patch directory for qemu: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-emulation/qemu/files/ And their mips64 patch is here: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app- emulation/qemu/files/qemu-0.11.0-mips64-user-fix.patch?rev=1.1&view=markup Which isn't much: And that's it. Ok, let's try that out... ./configure --target-list=mips64-linux-user --disable-werror make -j 2 And it died: > GEN config-host.h > Makefile:7: config-devices.mak: No such file or directory > make[1]: *** No rule to make target `config-devices.mak'. Stop. > make: *** [subdir-mips64-linux-user] Error 2 But since the 32 bit version of that file is just a comment, I'm pretty happy doing this: touch mips64-linux-user/config-devices.mak (Dunno where the makefile thinks it should get this from...) So with that, it compiles, with this warning: CC mips64-linux-user/signal.o /home/landley/qemu/git/linux-user/signal.c:2262:3: warning: #warning signal handling not implemented But it's not complaining about system calls. And it gives me a qemu-mips64. Right. Which segfaults immediately running a statically linked "hello world". Running a dynamically linked version it does indeed complain that /lib/ld- uClibc.so.0 isn't there (correct), but the statically linked one segfaults with no output. Huh. Ok, let's scp that to gentoo and try it there... qemu-mips64 ./mips64-hello qemu: uncaught target signal 4 (Illegal instruction) - exiting And running that same hello world binary under system-image-mips64... Works fine. Right, Gentoo includes a qemu-mips64 that _doesn't_work_. (At least not for me.) They fixed the build break, but that's it. False alarm, my bad... Rob --- qemu-0.11.0.orig/linux-user/main.c 2009-10-23 02:19:57.000000000 +0200 +++ qemu-0.11.0/linux-user/main.c 2009-10-23 02:47:09.000000000 +0200 @@ -1469,6 +1469,8 @@ #ifdef TARGET_MIPS +#define TARGET_QEMU_ESIGRETURN 255 + #define MIPS_SYS(name, args) args, static const uint8_t mips_syscall_args[] = {