[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Solaris host patch for QEMU
|
From: |
EricNorthup |
|
Subject: |
[Qemu-devel] Solaris host patch for QEMU |
|
Date: |
Fri, 11 Jun 2004 19:23:09 -0400 |
Hi,
With this patch, I can build and run qemu on Solaris x86. Note that it
requires GNU make to build. The patch is available at
http://digitaleric.net/solaris.patch (in case my webmail mangles the
whitespace).
--Eric
--- patch against qemu CVS as of last night ---
diff -b -B -r -u qemu-cvs/configure qemu-cvs+solaris/configure
--- qemu-cvs/configure 2004-06-04 04:13:20.000000000 -0700
+++ qemu-cvs+solaris/configure 2004-06-10 22:17:22.000000000 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# qemu configure script (c) 2003 Fabrice Bellard
#
@@ -88,10 +88,13 @@
OpenBSD)
bsd="yes"
;;
+SunOS)
+solaris="yes"
+;;
*) ;;
esac
-if [ "$bsd" = "yes" ] ; then
+if [ "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
make="gmake"
target_list="i386-softmmu"
fi
@@ -391,6 +394,9 @@
elif test -f "/usr/include/byteswap.h" ; then
echo "#define HAVE_BYTESWAP_H 1" >> $config_h
fi
+if test "$solaris" = "yes" ; then
+ echo "CONFIG_SOLARIS=yes" >> $config_mak
+fi
if test "$gdbstub" = "yes" ; then
echo "CONFIG_GDBSTUB=yes" >> $config_mak
echo "#define CONFIG_GDBSTUB 1" >> $config_h
@@ -424,6 +430,10 @@
echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
echo "#define _BSD 1" >> $config_h
fi
+if [ "$solaris" = "yes" ] ; then
+ echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
+ echo "#define _SOLARIS 1" >> $config_h
+fi
for target in $target_list; do
diff -b -B -r -u qemu-cvs/dyngen-exec.h qemu-cvs+solaris/dyngen-exec.h
--- qemu-cvs/dyngen-exec.h 2004-05-12 12:32:15.000000000 -0700
+++ qemu-cvs+solaris/dyngen-exec.h 2004-06-10 22:41:31.000000000 -0700
@@ -22,6 +22,7 @@
#include <stddef.h>
+#ifndef _SOLARIS
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
@@ -40,6 +41,7 @@
#else
typedef signed long long int64_t;
#endif
+#endif // ! _SOLARIS
#define INT8_MIN (-128)
#define INT16_MIN (-32767-1)
@@ -54,16 +56,20 @@
#define UINT32_MAX (4294967295U)
#define UINT64_MAX ((uint64_t)(18446744073709551615))
+#ifdef _SOLARIS
+typedef struct __FILE FILE;
+#else
typedef struct FILE FILE;
+#endif // _SOLARIS
+
extern int fprintf(FILE *, const char *, ...);
extern int printf(const char *, ...);
#undef NULL
#define NULL 0
#ifdef _BSD
#include <ieeefp.h>
-#else
-#include <fenv.h>
#endif
+#include <fenv.h>
#ifdef __i386__
#define AREG0 "ebp"
diff -b -B -r -u qemu-cvs/Makefile.target qemu-cvs+solaris/Makefile.target
--- qemu-cvs/Makefile.target 2004-06-05 03:32:30.000000000 -0700
+++ qemu-cvs+solaris/Makefile.target 2004-06-10 22:44:52.000000000 -0700
@@ -159,6 +159,11 @@
ifdef CONFIG_WIN32
LIBS+=-lwinmm
endif
+ifdef CONFIG_SOLARIS
+LIBS+=-lsocket
+LIBS+=-lnsl
+LIBS+=-lresolv
+endif
# profiling code
ifdef TARGET_GPROF
@@ -271,8 +276,10 @@
VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
endif
ifndef CONFIG_WIN32
+ifndef CONFIG_SOLARIS
VL_LIBS=-lutil
endif
+endif
$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VL_LIBS)
diff -b -B -r -u qemu-cvs/oss.c qemu-cvs+solaris/oss.c
--- qemu-cvs/oss.c 2004-06-07 13:58:31.000000000 -0700
+++ qemu-cvs+solaris/oss.c 2004-06-10 20:02:30.000000000 -0700
@@ -23,7 +23,15 @@
*/
#include "vl.h"
-#ifndef _WIN32
+#ifdef _WIN32
+#define NO_OSS
+#endif
+#ifdef _SOLARIS
+#define NO_OSS
+#endif
+
+
+#ifndef NO_OSS
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
@@ -556,7 +564,7 @@
conf.fragsize = lsbindex (fsp);
}
-#else
+#else // NO_OSS
void AUD_run (void)
{
diff -b -B -r -u qemu-cvs/qemu-mkcow.c qemu-cvs+solaris/qemu-mkcow.c
--- qemu-cvs/qemu-mkcow.c 2004-05-05 11:50:02.000000000 -0700
+++ qemu-cvs+solaris/qemu-mkcow.c 2004-06-10 21:56:40.000000000 -0700
@@ -25,7 +25,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#include <getopt.h>
#include <inttypes.h>
#include <unistd.h>
#include <fcntl.h>
@@ -36,6 +35,12 @@
#include <sys/stat.h>
#include <netinet/in.h>
+#include "config-host.h"
+
+#ifndef _SOLARIS
+#include <getopt.h>
+#endif
+
#include "cow.h"
#include "bswap.h"
diff -b -B -r -u qemu-cvs/slirp/slirp.h qemu-cvs+solaris/slirp/slirp.h
--- qemu-cvs/slirp/slirp.h 2004-06-03 05:53:17.000000000 -0700
+++ qemu-cvs+solaris/slirp/slirp.h 2004-06-10 22:29:11.000000000 -0700
@@ -5,10 +5,15 @@
#define DEBUG 1
+#include "config.h"
#ifndef CONFIG_QEMU
#include "version.h"
-#endif
-#include "config.h"
+#else
+#ifdef _SOLARIS
+#include "types.h"
+#include <sys/filio.h> // for FIONREAD
+#endif // _SOLARIS
+#endif // CONFIG_QEMU
#include "slirp_config.h"
#include <sys/types.h>
diff -b -B -r -u qemu-cvs/target-i386/exec.h
qemu-cvs+solaris/target-i386/exec.h
--- qemu-cvs/target-i386/exec.h 2004-05-29 04:08:52.000000000 -0700
+++ qemu-cvs+solaris/target-i386/exec.h 2004-06-10 22:33:45.000000000 -0700
@@ -17,6 +17,8 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
*/
+
+#include <sys/types.h>
#include "config.h"
#include "dyngen-exec.h"
diff -b -B -r -u qemu-cvs/vl.c qemu-cvs+solaris/vl.c
--- qemu-cvs/vl.c 2004-06-05 06:46:47.000000000 -0700
+++ qemu-cvs+solaris/vl.c 2004-06-10 22:00:27.000000000 -0700
@@ -41,7 +41,9 @@
#ifdef _BSD
#include <sys/stat.h>
#include <libutil.h>
-#else
+#elif _SOLARIS
+#include <sys/stat.h>
+#else // assume Linux
#include <linux/if.h>
#include <linux/if_tun.h>
#include <pty.h>
@@ -865,6 +867,7 @@
the emulated kernel requested a too high timer frequency */
getitimer(ITIMER_REAL, &itv);
+#ifndef _SOLARIS
if (itv.it_interval.tv_usec > 1000) {
/* try to use /dev/rtc to have a faster timer */
if (start_rtc_timer() < 0)
@@ -885,6 +888,10 @@
pit_min_timer_count = ((uint64_t)itv.it_interval.tv_usec *
PIT_FREQ) / 1000000;
}
+#else
+
+ pit_min_timer_count = ((uint64_t)itv.it_interval.tv_usec * PIT_FREQ) /
1000000;
+#endif // ! _SOLARIS
}
#endif
}
@@ -1069,7 +1076,12 @@
fcntl(fd, F_SETFL, O_NONBLOCK);
return fd;
}
-#else
+#elif _SOLARIS
+static int tun_open(char *ifname, int ifname_size)
+{
+ return -1;
+}
+#else // assume Linux
static int tun_open(char *ifname, int ifname_size)
{
struct ifreq ifr;
- [Qemu-devel] Solaris host patch for QEMU,
EricNorthup <=