qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2 of 3] Optionally link against libuuid if prese


From: Filip Navara
Subject: Re: [Qemu-devel] [PATCH 2 of 3] Optionally link against libuuid if present
Date: Tue, 11 Dec 2007 22:21:56 +0100

Hi Ryan & others,

now I have been holding a SMBIOS patch on my hard disk for way to long it seems. I used a different approach from yours, so I decided to publish it for review or further ideas. What I did was to modify the bochs bios to produce the SMBIOS tables and I get the UUID using VMware backdoor port from the virtual machine.

Attached are just the changed files, creating a patch will take a while because it's against VERY OLD version of the sources.

Oh, it also contains ACPI patch for the processor descriptors which was needed for some Windows versions and Darwin. Similar patch was used in KVM before, but this one dynamically detects the number of CPUs.

Best regards,
Filip Navara

On Dec 11, 2007 9:08 PM, Ryan Harper <address@hidden> wrote:
3 files changed, 38 insertions(+), 2 deletions(-)
Makefile.target |    5 ++++-
configure       |   26 ++++++++++++++++++++++++++
smbios.c        |    9 ++++++++-


# HG changeset patch
# User Ryan Harper < address@hidden>
# Date 1197402122 21600
# Node ID 115f40a4994be1d5b44ef193b3ccbe8e26410eef
# Parent  e81bef5fa072360d12b87b3237b7d3f72c9b9784
Optionally link against libuuid if present.

This patch makes libuuid optional.  If not detected, SMBIOS tables will use
canned UUID.

Signed-off-by: Ryan Harper <address@hidden>

diff -r e81bef5fa072 -r 115f40a4994b Makefile.target
--- a/Makefile.target   Tue Dec 11 13:42:01 2007 -0600
+++ b/Makefile.target   Tue Dec 11 13:42:02 2007 -0600
@@ -402,6 +402,9 @@ VL_OBJS+=block-raw.o

 ifdef CONFIG_ALSA
 LIBS += -lasound
+endif
+ifdef CONFIG_UUID
+LIBS += -luuid
 endif
 ifdef CONFIG_DSOUND
 LIBS += -lole32 -ldxguid
@@ -535,7 +538,7 @@ ifndef CONFIG_DARWIN
 ifndef CONFIG_DARWIN
 ifndef CONFIG_WIN32
 ifndef CONFIG_SOLARIS
-VL_LIBS+=-lutil -luuid
+VL_LIBS+=-lutil
 endif
 endif
 endif
diff -r e81bef5fa072 -r 115f40a4994b configure
--- a/configure Tue Dec 11 13:42:01 2007 -0600
+++ b/configure Tue Dec 11 13:42:02 2007 -0600
@@ -89,6 +89,7 @@ dsound="no"
 dsound="no"
 coreaudio="no"
 alsa="no"
+uuid="yes"
 fmod="no"
 fmod_lib=""
 fmod_inc=""
@@ -260,6 +261,8 @@ for opt do
  ;;
  --enable-alsa) alsa="yes"
  ;;
+  --enable-uuid) uuid="yes"
+  ;;
  --enable-dsound) dsound="yes"
  ;;
  --enable-fmod) fmod="yes"
@@ -404,6 +407,7 @@ echo "  --enable-adlib           enable
 echo "  --enable-adlib           enable Adlib emulation"
 echo "  --enable-coreaudio       enable Coreaudio audio driver"
 echo "  --enable-alsa            enable ALSA audio driver"
+echo "  --enable-uuid            enable UUID generation for machines"
 echo "  --enable-fmod            enable FMOD audio driver"
 echo "  --enable-dsound          enable DirectSound audio driver"
 echo "  --disable-vnc-tls        disable TLS encryption for VNC server"
@@ -662,6 +666,23 @@ EOF
  fi
 fi

+##########################################
+# uuid library
+if test "$uuid" = "yes" ; then
+  cat > $TMPC << EOF
+#include <uuid/uuid.h>
+int main(void) { uuid_t u; return 0; }
+EOF
+  if $cc -o $TMPE $TMPC -luuid 2> /dev/null ; then
+    :
+  else
+    echo
+    echo "Error: Could not find uuid"
+    echo "Make sure to have the uuid libs and headers installed."
+    echo
+    exit 1
+  fi
+fi
 # Check if tools are available to build documentation.
 if [ -x "`which texi2html 2>/dev/null`" ] && \
   [ -x "`which pod2man 2>/dev/null`" ]; then
@@ -716,6 +737,7 @@ echo "Adlib support     $adlib"
 echo "Adlib support     $adlib"
 echo "CoreAudio support $coreaudio"
 echo "ALSA support      $alsa"
+echo "UUID support      $uuid"
 echo "DSound support    $dsound"
 if test "$fmod" = "yes"; then
    if test -z $fmod_lib || test -z $fmod_inc; then
@@ -901,6 +923,10 @@ if test "$alsa" = "yes" ; then
  echo "CONFIG_ALSA=yes" >> $config_mak
  echo "#define CONFIG_ALSA 1" >> $config_h
 fi
+if test "$uuid" = "yes" ; then
+  echo "CONFIG_UUID=yes" >> $config_mak
+  echo "#define CONFIG_UUID 1" >> $config_h
+fi
 if test "$dsound" = "yes" ; then
  echo "CONFIG_DSOUND=yes" >> $config_mak
  echo "#define CONFIG_DSOUND 1" >> $config_h
diff -r e81bef5fa072 -r 115f40a4994b smbios.c
--- a/smbios.c  Tue Dec 11 13:42:01 2007 -0600
+++ b/smbios.c  Tue Dec 11 13:42:02 2007 -0600
@@ -25,11 +25,14 @@
 #include <stdio.h>
 #include <stdint.h>
 #include <string.h>
-#include <uuid/uuid.h>
 #include "hw/hw.h"
 #include "sysemu.h"
 #include "smbios_types.h"
 #include "config-host.h"
+
+#ifdef CONFIG_UUID
+#include <uuid/uuid.h>
+#endif

 /* Write a two-character hex representation of 'byte' to digits[].
   Pre-condition: sizeof(digits) >= 2 */
@@ -489,9 +492,13 @@ load_smbios_tables(uint8_t *entry, uint8
    int len;
    uint32_t major_version = 0;
    uint32_t minor_version = 9;
+#ifdef CONFIG_UUID
    uuid_t uuid;

    uuid_generate(uuid);
+#else
+    uint8_t uuid[16] = "QEMUQEMUQEMUQEMU";
+#endif

    len = write_smbios_tables(entry, table, phys_table_start,
                              smp_cpus, (ram_size >> 20),



Attachment: rombios32.zip
Description: Zip archive


reply via email to

[Prev in Thread] Current Thread [Next in Thread]