From: Jerone Young <[EMAIL PROTECTED]>

This patch adds libfdt support into the qemu configuation script. There is a
portion for libfdt probing that is has some "XXX". The code commented out is
how to properly do probing for a library, the issue is that with kvm-userspace
we do not build libfdt before configuring qemu. So to pervent this check from
failing everytime we just do a simple test with the libfdt header. Once this
can be resolved elgantly then we can uncomment the place commented out and
remove the lines below them.

Signed-off-by: Jerone Young <[EMAIL PROTECTED]>
Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>

diff --git a/qemu/Makefile.target b/qemu/Makefile.target
index e29bbeb..9c87eac 100644
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -557,6 +557,11 @@ CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
 LIBS += $(CONFIG_VNC_TLS_LIBS)
 endif
 
+ifdef CONFIG_LIBFDT
+LIBS += -lfdt
+DEPLIBS += libfdt.a
+endif
+
 # SCSI layer
 OBJS+= lsi53c895a.o esp.o
 
diff --git a/qemu/configure b/qemu/configure
index bbedddc..a13a11b 100755
--- a/qemu/configure
+++ b/qemu/configure
@@ -112,6 +112,7 @@ build_docs="no"
 uname_release=""
 curses="yes"
 cpu_emulation="yes"
+device_tree_support=""
 
 # OS specific
 targetos=`uname -s`
@@ -345,6 +346,8 @@ for opt do
   ;;
   --disable-cpu-emulation) cpu_emulation="no"
   ;;
+  --disable-libfdt) device_tree_support="no"
+  ;;
   *) echo "ERROR: unknown option $opt"; exit 1
   ;;
   esac
@@ -449,6 +452,7 @@ echo "  --fmod-inc               path to FMOD includes"
 echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
 echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, 
v8plus, v8plusa, v9"
 echo "  --disable-cpu-emulation  disables use of qemu cpu emulation code"
+echo "  --disable-libfdt         disables use of libfdt support for device 
tree"
 echo ""
 echo "NOTE: The object files are built at the place where configure is 
launched"
 exit 1
@@ -732,6 +736,31 @@ else
   binsuffix="/bin"
 fi
 
+######################################
+# libfdt probe
+#
+if test -z "$device_tree_support" -a \
+   "$cpu" = "powerpc"; then
+  device_tree_support="no"
+  cat > $TMPC << EOF
+#include <libfdt.h>
+/* XXX uncomment later when libfdt is built before this test */
+//int main(void) { void *fdt; return fdt_create(fdt, 1024); }
+int main (void) {return 0;}
+EOF
+# XXX for now do not try to link to libfdt and just check for header */
+# if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC -lfdt 2> /dev/null ; then
+  if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC 2> /dev/null; then
+   device_tree_support="yes"
+  else
+    echo
+    echo "Error: Could not find libfdt"
+    echo "Make sure to have the libfdt libs and headers installed."
+    echo
+    exit 1
+  fi
+fi
+
 echo "Install prefix    $prefix"
 echo "BIOS directory    $prefix$datasuffix"
 echo "binary directory  $prefix$binsuffix"
@@ -793,6 +822,9 @@ fi
 echo "kqemu support     $kqemu"
 echo "kvm support       $kvm"
 echo "CPU emulation     $cpu_emulation"
+if test $cpu = "powerpc"; then
+echo "libfdt support    $device_tree_support"
+fi
 echo "Documentation     $build_docs"
 [ ! -z "$uname_release" ] && \
 echo "uname -r          $uname_release"
@@ -1186,6 +1218,10 @@ elif test "$target_cpu" = "ppcemb" ; then
   echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
   echo "#define TARGET_PPC 1" >> $config_h
   echo "#define TARGET_PPCEMB 1" >> $config_h
+  if test "$device_tree_support" = "yes" ; then
+      echo "#define CONFIG_LIBFDT 1" >> $config_h
+      echo "CONFIG_LIBFDT=1" >> $config_mak
+  fi
   configure_kvm
 elif test "$target_cpu" = "ppc64" ; then
   echo "TARGET_ARCH=ppc64" >> $config_mak

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-commits mailing list
kvm-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-commits

Reply via email to