# HG changeset patch
# User Jerone Young <[EMAIL PROTECTED]>
# Date 1205952857 18000
# Branch merge
# Node ID be1aa50ab7de0a9e0441e46769e2a40a582fc3c0
# Parent  20c62a22bfaeca9f01439b96b7159b725fff0dcd
Add libfdt support to qemu

This patch 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]>

diff --git a/qemu/Makefile.target b/qemu/Makefile.target
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -555,6 +555,11 @@ ifdef CONFIG_VNC_TLS
 ifdef CONFIG_VNC_TLS
 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
 LIBS += $(CONFIG_VNC_TLS_LIBS)
+endif
+
+ifdef CONFIG_LIBFDT
+LIBS += -lfdt
+DEPLIBS += libfdt.a
 endif
 
 # SCSI layer
diff --git a/qemu/configure b/qemu/configure
--- a/qemu/configure
+++ b/qemu/configure
@@ -112,6 +112,7 @@ uname_release=""
 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 "  --enable-uname-release=R Return 
 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 @@ echo "kqemu support     $kqemu"
 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" ; the
   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-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to