Re: [Qemu-devel] FreeBSD Support
Hi, On 03/03/07, Thiemo Seufer [EMAIL PROTECTED] wrote: andrzej zaborowski wrote: Hi, On 20/02/07, Christopher Olsen [EMAIL PROTECTED] wrote: Ok FreeBSD Support round one.. Be gentle this is my first attempt at working with the rest of this community.. Files it modifies and the reasons are as follows configure - Adds HOST_FREEBSD type to alter included libraries FreeBSD does not need -ltr Makefile.target - Once again uses HOST_FREEBSD to avoid including -ltr See http://lists.gnu.org/archive/html/qemu-devel/2006-11/msg00166.html - I believe this is a more appropriate way to select -lrt. The solaris part there looked a bit inconsistent, is the appended version ok? It works for FreeBSD, I think it's Ok. Regards, Andrew ___ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel
Re: [Qemu-devel] FreeBSD Support
andrzej zaborowski wrote: Hi, On 20/02/07, Christopher Olsen [EMAIL PROTECTED] wrote: Ok FreeBSD Support round one.. Be gentle this is my first attempt at working with the rest of this community.. Files it modifies and the reasons are as follows configure - Adds HOST_FREEBSD type to alter included libraries FreeBSD does not need -ltr Makefile.target - Once again uses HOST_FREEBSD to avoid including -ltr See http://lists.gnu.org/archive/html/qemu-devel/2006-11/msg00166.html - I believe this is a more appropriate way to select -lrt. The solaris part there looked a bit inconsistent, is the appended version ok? Thiemo Index: qemu-work/Makefile === --- qemu-work.orig/Makefile 2007-02-11 16:10:55.0 + +++ qemu-work/Makefile 2007-03-02 21:07:26.0 + @@ -24,11 +24,7 @@ DOCS= endif -ifndef CONFIG_DARWIN -ifndef CONFIG_WIN32 -LIBS+=-lrt -endif -endif +LIBS+=$(AIOLIBS) all: $(TOOLS) $(DOCS) recurse-all Index: qemu-work/Makefile.target === --- qemu-work.orig/Makefile.target 2007-03-02 20:57:01.0 + +++ qemu-work/Makefile.target 2007-03-02 21:01:22.0 + @@ -436,6 +436,7 @@ endif VL_LDFLAGS= +VL_LIBS=$(AIOLIBS) # specific flags are needed for non soft mmu emulator ifdef CONFIG_STATIC VL_LDFLAGS+=-static @@ -446,7 +447,7 @@ ifndef CONFIG_DARWIN ifndef CONFIG_WIN32 ifndef CONFIG_SOLARIS -VL_LIBS=-lutil -lrt +VL_LIBS+=-lutil endif endif endif Index: qemu-work/configure === --- qemu-work.orig/configure2007-03-02 20:57:00.0 + +++ qemu-work/configure 2007-03-02 21:07:10.0 + @@ -159,6 +159,12 @@ fi fi +if [ $bsd = yes -o $darwin = yes -o $solaris = yes -o $mingw32 = yes ] ; then +AIOLIBS= +else +AIOLIBS=-lrt +fi + # find source path source_path=`dirname $0` if [ -z $source_path ]; then @@ -653,6 +659,7 @@ echo CFLAGS=$CFLAGS $config_mak echo LDFLAGS=$LDFLAGS $config_mak echo EXESUF=$EXESUF $config_mak +echo AIOLIBS=$AIOLIBS $config_mak if test $cpu = i386 ; then echo ARCH=i386 $config_mak echo #define HOST_I386 1 $config_h ___ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel
Re: [Qemu-devel] FreeBSD Support
Hi, On 20/02/07, Christopher Olsen [EMAIL PROTECTED] wrote: Ok FreeBSD Support round one.. Be gentle this is my first attempt at working with the rest of this community.. Files it modifies and the reasons are as follows configure - Adds HOST_FREEBSD type to alter included libraries FreeBSD does not need -ltr Makefile.target - Once again uses HOST_FREEBSD to avoid including -ltr See http://lists.gnu.org/archive/html/qemu-devel/2006-11/msg00166.html - I believe this is a more appropriate way to select -lrt. Regards, Andrew ___ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel
Re: [Qemu-devel] FreeBSD Support
MAP_PRIVATE|MAP_ANON also works on Solaris. In fact, Linux is the only platform where it doesn't work due to a bug in the Linux kernel as Fabrice mentions: http://www.qemu.org/kqemu-tech.html#SEC7 Technically on Solaris, /tmp is probably the same thing as MAP_PRIVATE|MAP_ANON since the filesystem is actually mapped to virtual memory... however, it's much cleaner to not use a file if not necessary. I can post a reworked patch that makes the file mapping for the Linux case only if anyone's interested, but it's a pretty simple change. - Leo Reiter On 2/24/07, Juergen Lock [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED] you write: -=-=-=-=-=- Ok FreeBSD Support round one.. Be gentle this is my first attempt at working with the rest of this community.. Files it modifies and the reasons are as follows configure - Adds HOST_FREEBSD type to alter included libraries FreeBSD does not need -ltr Makefile.target - Once again uses HOST_FREEBSD to avoid including -ltr osdeps.c - FreeBSD does not have /dev/shm so it uses /tmp for kqemu_valloc also sys/vfs.h is not part of freebsd stat information is part of mount.h/param.h ... Actually the port simply uses mmap MAP_PRIVATE|MAP_ANON, so no tempfile is used at all (this is files/patch-osdep.c in the port): Index: qemu/osdep.c @@ -79,7 +79,9 @@ #if defined(USE_KQEMU) +#ifndef __FreeBSD__ #include sys/vfs.h +#endif #include sys/mman.h #include fcntl.h @@ -90,6 +92,7 @@ const char *tmpdir; char phys_ram_file[1024]; void *ptr; +#ifndef __FreeBSD__ #ifdef HOST_SOLARIS struct statvfs stfs; #else @@ -151,12 +154,20 @@ } unlink(phys_ram_file); } +#endif size = (size + 4095) ~4095; +#ifndef __FreeBSD__ ftruncate(phys_ram_fd, phys_ram_size + size); ptr = mmap(NULL, size, PROT_WRITE | PROT_READ, MAP_SHARED, phys_ram_fd, phys_ram_size); +#else +ptr = mmap(NULL, + size, + PROT_WRITE | PROT_READ, MAP_PRIVATE|MAP_ANON, + -1, 0); +#endif if (ptr == MAP_FAILED) { fprintf(stderr, Could not map physical memory\n); exit(1); ___ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel ___ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel
Re: [Qemu-devel] FreeBSD Support
This is a sidetrack here... But is it at all possible to make future releases of the source more FreeBSD friendly? If someone puts in the effort to make it so, yes. Note that dumping the current patches from FreeBSD ports on the list is generally not sufficient. Blindly posting patches without explanation is a good way to get them ignored. All patches should include a description of what they are fixing (ie. what qemu currently does wrong), how the patch fixes it, and why this is the right way to fix it. For OS specific hacks there needs to be a good reason why that OS is special. If you can't answer all the above questions then you shouldn't be submitting the patch. In some cases you may need to rewriting the patches to meet these criteria. Individual OS/Distros tend to be less picky because they only care whether the result works on that one system. Paul ___ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel
Re: [Qemu-devel] FreeBSD Support
On Monday 19 February 2007 20:46, Paul Brook wrote: This is a sidetrack here... But is it at all possible to make future releases of the source more FreeBSD friendly? If someone puts in the effort to make it so, yes. Note that dumping the current patches from FreeBSD ports on the list is generally not sufficient. Blindly posting patches without explanation is a good way to get them ignored. All patches should include a description of what they are fixing (ie. what qemu currently does wrong), how the patch fixes it, and why this is the right way to fix it. For OS specific hacks there needs to be a good reason why that OS is special. If you can't answer all the above questions then you shouldn't be submitting the patch. In some cases you may need to rewriting the patches to meet these criteria. Individual OS/Distros tend to be less picky because they only care whether the result works on that one system. Paul ___ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel Paul, So should I make a separate patch for each modified file? -Christopher -- Christopher Olsen [EMAIL PROTECTED] Tel: 631-676-4877 Fax: 631-249-3036 ___ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel
Re: [Qemu-devel] FreeBSD Support
On Monday 19 February 2007 21:08, Ben Taylor wrote: Having been in your shoes, the only thing I can tell you is start small. Be able to justify your patches and change as little as possible. Be smart about how you code things if there are specific reasons. And get ready for a long haul. Be ready to constantly be porting your changes through the CVS tree. I can tell you that you won't be able to submit a This patch makes it work with FreeBSD and have it accepted. Start with the configure script and Makefiles, and any very specfic, targeted and small patches and let those changes slowly propogate out. HTH, Ben ___ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel Well that shouldn't be an issue... Plus I have particular interest in this project. That and I've stuck by QEMU because of it's significant performance over BOCHS as the PC emulator of choice when I developed my operating system -Christopher -- Christopher Olsen [EMAIL PROTECTED] Tel: 631-676-4877 Fax: 631-249-3036 ___ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel
Re: [Qemu-devel] FreeBSD Support
So should I make a separate patch for each modified file? No. You should break changes into logically independent patches. It is ok for a single patch to touch multiple files, but it should only fix one thing. Paul ___ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel
Re: [Qemu-devel] FreeBSD Support
In message: [EMAIL PROTECTED] Ben Taylor [EMAIL PROTECTED] writes: : Start with the configure script and Makefiles, and any very specfic, targeted : and small patches and let those changes slowly propogate out. Most of the FreeBSD ports patches are relatively easy to justify and explain. For example, FreeBSD port system defines SDL_CONFIG in a way that's overridable. There's a patch that looks like: Index: qemu/configure @@ -204,7 +204,7 @@ if test -z $sdl ; then -sdl_config=sdl-config +sdl_config=${SDL_CONFIG} sdl=no sdl_static=no which is straight forward enought, but still wrong... It should be: Index: qemu/configure @@ -204,7 +204,7 @@ if test -z $sdl ; then -sdl_config=sdl-config +sdl_config=${SDL_CONFIG:-sdl-config} sdl=no sdl_static=no to still work on non-FreeBSD systems or on FreeBSD systems not using the ports There's a lot of niggles like this, however... Warner ___ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel