QEMU on FreeBSD/amd64 (patches)
Jung-uk Kim
jkim at niksun.com
Wed Apr 13 13:35:34 PDT 2005
I finally manage to build QEMU snapshot on FreeBSD/amd64 6-CURRENT.
There's ports/emulators/qemu but it doesn't build on AMD64 for
several reasons, i. e., QEMU and FreeBSD are both fast moving targets
(esp. src/lib/msun), some long double math functions don't exist on
FreeBSD, GCC in base system doesn't build QEMU because of several
optimization bugs specific to AMD64, etc.
1. Install GCC 3.4 from ports.
Anything newer than 20050316 should work. (Theoretically you can use
gcc40 newer than 20041127 but not verified. Actually I am using
patched version of src/contrib/gcc. ;-)
2. Install following dependencies from ports:
devel/gmake (of course)
net/samba
devel/sdl12
I believe samba is optional but sdl12 is not. It doesn't work without
SDL because `-nographic' option is broken. I believe it is an
upstream bug (related to FreeBSD's pty or termios, i. e., fail to get
correct term size and segfault) but I couldn't pin-point the culprit
yet. In fact, I didn't bother too much because SDL worked just
fine. ;-)
3. Get the latest QEMU source from:
http://www.dad-answers.com/qemu/
The file name is something like qemu-snapshot-*.tar.bz2.
4. Extract the tarball, chdir to it, and do the following:
mkdir -p bsd/amd64
patch -p0 < ${PATCHDIR}/qemu-snapshot-fbsd.diff
patch -p0 < ${PATCHDIR}/qemu-libmath-amd64.diff
./configure -cc=${GCC_BIN}
gmake
gmake install
${PATCHDIR} is where the attached patches are saved and ${GCC_BIN} is
gcc path, e. g., /usr/local/bin/gcc34 for GCC 3.4.4
and /usr/local/bin/gcc40 for GCC 4.0.0, etc.
I was able to run DragonFly 1.2 CD-ROM on i386 emulation (qemu) and
Mandrake Linux 10.2rc1 for amd64 on x86-64 emulation
(qemu-system-x86-64). ppc (qemu-system-ppc) and sparc
(qemu-system-sparc) emulators are not tested.
Enjoy,
Jung-uk Kim
Note 1: The limitations of this patch should be the same from ports
because large portion was taken from it:
http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/ports/emulators/qemu/pkg-message?rev=1.7&content-type=text/plain
Note 2: qemu-libmath-amd64.diff contains C99 long double math
functions taken from glibc-2.3.5 and modified for FreeBSD/amd64:
http://ftp.gnu.org/gnu/glibc/
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/?cvsroot=glibc
rintl() sysdeps/i386/fpu/s_rintl.c
atan2l() sysdeps/i386/fpu/e_atan2l.c
sqrtl() sysdeps/i386/fpu/e_sqrtl.c
llrintl() sysdeps/x86_64/fpu/s_llrintl.S
lrintl() sysdeps/x86_64/fpu/s_llrintl.S
sinl() sysdeps/x86_64/fpu/s_sinl.S
cosl() sysdeps/x86_64/fpu/s_cosl.S
tanl() sysdeps/x86_64/fpu/s_tanl.S
logl() sysdeps/x86_64/fpu/e_logl.S
powl() sysdeps/x86_64/fpu/e_powl.S
remainderl() sysdeps/x86_64/fpu/e_remainderl.S
Just enough to compile QEMU snapshot until we complete C99
project. ;-) Similarly you can add other architectures under
bsd/${MACHINE_ARCH}.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qemu-libmath-amd64.diff
Type: text/x-diff
Size: 14572 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-amd64/attachments/20050413/9dd4ff79/qemu-libmath-amd64.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qemu-snapshot-fbsd.diff
Type: text/x-diff
Size: 18248 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-amd64/attachments/20050413/9dd4ff79/qemu-snapshot-fbsd.bin
More information about the freebsd-amd64
mailing list