need help with kqemu

Juergen Lock nox at jelal.kn-bremen.de
Mon Jul 25 20:26:43 GMT 2005


Hi!

 Fabrice has released a new version of kqemu that now also
supports amd64 hosts, but as he doesnt know FreeBSD (and my
kernel foo is far from being good enough, neither do i have
an amd64 box) we need someone to port the wrapper to amd64.
Actually the i386 wrapper he has now added to the release
(kqemu-0.7.1.tar.gz) doesnt work either (not sure what happened
there, it doesnt even build), so we need someone to fix/update
that as well.  I have made an update for the port that can be
used as a template (only non-kqemu build works), I'll append it
below:

Removed files: files/BSDmakefile files/kmod_bsd.c
New files: files/kqemu-Makefile-patch files/patch-libmath2 files/patch-vl.c

 (btw patch-vl.c is from Andrey V. Elsukov, it enables kernel
debugging via virtual serial console, as posted on -ports:

# qemu -hda disk.img -cdrom 6.0-BETA1.iso -serial pty
# gdb
(gdb) target remote /dev/ptyp0
....)

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/emulators/qemu/Makefile,v
retrieving revision 1.27
diff -u -r1.27 Makefile
--- Makefile	19 Jul 2005 06:06:56 -0000	1.27
+++ Makefile	25 Jul 2005 16:52:49 -0000
@@ -6,12 +6,9 @@
 #
 
 PORTNAME=	qemu
-PORTVERSION=	0.7.0s.20050717
+PORTVERSION=	0.7.1
 CATEGORIES=	emulators
-MASTER_SITES=	http://www.qemu.org/ \
-		http://people.fruitsalad.org/nox/qemu/ \
-		http://dad-answers.com/qemu/
-DISTNAME=	${PORTNAME}-snapshot-2005-07-17_23
+MASTER_SITES=	http://www.qemu.org/
 EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}
 
 MAINTAINER=	nox at jelal.kn-bremen.de
@@ -23,12 +20,12 @@
 .endif
 
 .if defined(WITH_KQEMU)
-DISTKQEMU=	kqemu-0.6.2-1.tar.gz
+DISTKQEMU=	kqemu-0.7.1.tar.gz
 DISTFILES=	${EXTRACT_ONLY} ${DISTKQEMU}
+EXTRA_PATCHES=	${FILESDIR}/kqemu-Makefile-patch
 .endif
 
 HAS_CONFIGURE=	yes
-USE_BZIP2=	yes
 USE_GMAKE=	yes
 USE_GETOPT_LONG=	yes
 USE_SDL=	sdl
@@ -85,7 +82,7 @@
 .if defined(WITH_KQEMU)
 post-extract:
 	@cd ${WRKSRC} && ${TAR} xfz ${_DISTDIR}/${DISTKQEMU}
-	@${CP} ${FILESDIR}/BSDmakefile ${FILESDIR}/kmod_bsd.c ${WRKSRC}/kqemu
+	@${LN} -s Makefile.freebsd ${WRKSRC}/kqemu/BSDmakefile
 .endif
 
 pre-patch:
Index: distinfo
===================================================================
RCS file: /home/ncvs/ports/emulators/qemu/distinfo,v
retrieving revision 1.20
diff -u -r1.20 distinfo
--- distinfo	19 Jul 2005 06:06:56 -0000	1.20
+++ distinfo	25 Jul 2005 16:40:12 -0000
@@ -1,4 +1,4 @@
-MD5 (qemu-snapshot-2005-07-17_23.tar.bz2) = 5d21295c1f328ea00de19a54715ee7c3
-SIZE (qemu-snapshot-2005-07-17_23.tar.bz2) = 1114748
-MD5 (kqemu-0.6.2-1.tar.gz) = c6bb3b40fb3d526d731eb0f1f9dee7ee
-SIZE (kqemu-0.6.2-1.tar.gz) = 21002
+MD5 (qemu-0.7.1.tar.gz) = b0c80d2c082049a5b8ccbc7f55fe165b
+SIZE (qemu-0.7.1.tar.gz) = 1338521
+MD5 (kqemu-0.7.1.tar.gz) = 8fc7967492b2157521198f6639218420
+SIZE (kqemu-0.7.1.tar.gz) = 76135
Index: files/kqemu-Makefile-patch
@@ -0,0 +1,13 @@
+Index: qemu/kqemu/Makefile.freebsd
+@@ -1,6 +1,10 @@
+ # $Id: Makefile.freebsd,v 1.1 2005/04/17 17:21:31 bellard Exp $
+ KMOD=	kqemu
+-SRCS=	kmod-freebsd.c
++SRCS=	kqemu-freebsd.c
+ OBJS=	kqemu-mod-i386.o
++.if ${OSVERSION} >= 500000
++CC=    cc
++.endif
++WERROR=
+ 
+ .include <bsd.kmod.mk>
Index: files/patch-libmath2
@@ -0,0 +1,67 @@
+Index: qemu/bsd/Makefile
+@@ -16,7 +16,8 @@
+ 	${MACHINE_ARCH}/s_rintl.c	\
+ 	${MACHINE_ARCH}/s_round.c	\
+ 	${MACHINE_ARCH}/s_sinl.S	\
+-	${MACHINE_ARCH}/s_tanl.S
++	${MACHINE_ARCH}/s_tanl.S	\
++	${MACHINE_ARCH}/s_ldexpl.c
+ 
+ OBJS=	${SRCS:R:S/$/.o/}
+ 
+Index: qemu/bsd/i386/s_ldexpl.c
+@@ -0,0 +1,21 @@
++#include <math.h>
++#include <errno.h>
++#include <sysdep.h>
++
++long double __ldexpl(long double x, int expn)
++{
++  long double res;
++  if (!isfinite (x) || x == 0.0L)
++    return x;
++
++  __asm__ ("fscale"
++  	    : "=t" (res)
++	    : "0" (x), "u" ((long double) expn));
++
++  if (!isfinite (res) || res == 0.0L)
++    errno = ERANGE;
++
++  return res;
++}
++
++weak_alias(__ldexpl,ldexpl)
+Index: qemu/bsd/amd64/s_ldexpl.c
+@@ -0,0 +1,21 @@
++#include <math.h>
++#include <errno.h>
++#include <sysdep.h>
++
++long double __ldexpl(long double x, int expn)
++{
++  long double res;
++  if (!isfinite (x) || x == 0.0L)
++    return x;
++
++  __asm__ ("fscale"
++  	    : "=t" (res)
++	    : "0" (x), "u" ((long double) expn));
++
++  if (!isfinite (res) || res == 0.0L)
++    errno = ERANGE;
++
++  return res;
++}
++
++weak_alias(__ldexpl,ldexpl)
+Index: qemu/target-i386/helper.c
+@@ -2886,6 +2886,8 @@
+     ST0 = floatx_round_to_int(ST0, &env->fp_status);
+ }
+ 
++long double	ldexpl(long double, int);
++
+ void helper_fscale(void)
+ {
+     ST0 = ldexp (ST0, (int)(ST1)); 
Index: files/patch-vl.c
@@ -0,0 +1,21 @@
+Index: qemu/vl.c
+@@ -40,6 +40,10 @@
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <dirent.h>
++#ifdef __FreeBSD__
++#include <sys/types.h>
++#include <libutil.h>
++#endif
+ #ifdef _BSD
+ #include <sys/stat.h>
+ #ifndef __APPLE__
+@@ -1280,7 +1284,7 @@
+     return chr;
+ }
+ 
+-#if defined(__linux__)
++#if defined(__linux__) || defined(__FreeBSD__)
+ CharDriverState *qemu_chr_open_pty(void)
+ {
+     char slave_name[1024];


More information about the freebsd-amd64 mailing list