qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v2 2/6] backdoor: handle config-time activation


From: Lluís
Subject: [Qemu-devel] [PATCH v2 2/6] backdoor: handle config-time activation
Date: Thu, 04 Nov 2010 23:35:26 +0100
User-agent: StGit/0.15

Add a '--with-backdoor' configuration option pointing to user-provided backdoor
callback implementation.

Make is invoked on the user-provided directory, which must build a static
library containing, at least, the implementation of the backdoor helpers.

Signed-off-by: Lluís Vilanova <address@hidden>
---
 Makefile.target |   40 ++++++++++++++++++++++++++++++++++++----
 configure       |   21 +++++++++++++++++++++
 2 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index 91e6e74..da6ee03 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -29,7 +29,7 @@ QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
 endif
 endif
 
-PROGS=$(QEMU_PROG)
+PROGS=$(QEMU_PROG)-prepare $(QEMU_PROG)
 
 ifndef CONFIG_HAIKU
 LIBS+=-lm
@@ -323,8 +323,40 @@ endif # CONFIG_SOFTMMU
 obj-y += $(addprefix ../, $(trace-obj-y))
 obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
 
-$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
-       $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y))
+
+.PHONY: force
+force:
+
+#########################################################
+# backdoor communication channel
+ifdef CONFIG_BACKDOOR
+VPATH := $(VPATH):$(BACKDOOR_PATH)
+
+LIBBACKDOOR_LIB = libbackdoor/libbackdoor.a
+LIBBACKDOOR_CLEAN = libbackdoor-clean
+
+libbackdoor/Makefile:
+       $(call quiet-command, mkdir -p libbackdoor, "  CREAT $(TARGET_DIR)$@")
+       $(call quiet-command, rm -f libbackdoor/Makefile)
+       $(call quiet-command, ln -s $(BACKDOOR_PATH)/Makefile 
libbackdoor/Makefile)
+
+libbackdoor/libbackdoor.a: libbackdoor/Makefile force
+       $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libbackdoor         
\
+               QEMU_CFLAGS="$(QEMU_CFLAGS) -I../target-$(TARGET_BASE_ARCH)"    
\
+               TARGET_DIR=$(TARGET_DIR)libbackdoor/ VPATH=$(VPATH)             
\
+               SRC_PATH=$(SRC_PATH) V="$(V)" libbackdoor.a)
+
+libbackdoor-clean:
+       $(MAKE) $(SUBDIR_MAKEFLAGS) -C $(LIBBACKDOOR_DIR)                       
\
+               VPATH=$(VPATH) SRC_PATH=$(SRC_PATH) V="$(V)" clean || true
+endif
+
+
+
+$(QEMU_PROG)-prepare: $(GENERATED_HEADERS) $(LIBBACKDOOR_LIB) $(QEMU_PROG)
+
+$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(LIBBACKDOOR_LIB)
+       $(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)) $(LIBBACKDOOR_LIB)
 
 
 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/feature_to_c.sh
@@ -336,7 +368,7 @@ hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
 qmp-commands.h: $(SRC_PATH)/qmp-commands.hx
        $(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   
$(TARGET_DIR)$@")
 
-clean:
+clean: $(LIBBACKDOOR_CLEAN)
        rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
        rm -f *.d */*.d tcg/*.o ide/*.o
        rm -f hmp-commands.h qmp-commands.h gdbstub-xml.c
diff --git a/configure b/configure
index 7025d2b..e6fbf97 100755
--- a/configure
+++ b/configure
@@ -332,6 +332,7 @@ zero_malloc=""
 trace_backend="nop"
 trace_file="trace"
 spice=""
+backdoor=""
 
 # OS specific
 if check_define __linux__ ; then
@@ -741,6 +742,17 @@ for opt do
   ;;
   --*dir)
   ;;
+  --with-backdoor=*) backdoor="$optarg"
+  if test ! -f "$backdoor/Makefile"; then
+      echo
+      echo "Error: cannot make into '$backdoor'"
+      echo "Please choose a directory where I can run 'make'"
+      echo
+      exit 1
+  else
+      backdoor=`readlink -f $backdoor`
+  fi
+  ;;
   *) echo "ERROR: unknown option $opt"; show_help="yes"
   ;;
   esac
@@ -2338,6 +2350,9 @@ echo "vhost-net support $vhost_net"
 echo "Trace backend     $trace_backend"
 echo "Trace output file $trace_file-<pid>"
 echo "spice support     $spice"
+if test -n "$backdoor"; then
+    echo "Backdoor comm.    $backdoor"
+fi
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -2601,6 +2616,12 @@ if test "$spice" = "yes" ; then
   echo "CONFIG_SPICE=y" >> $config_host_mak
 fi
 
+if test -n "$backdoor"; then
+  echo "CONFIG_BACKDOOR=y" >> $config_host_mak
+  echo "BACKDOOR_PATH=$backdoor" >> $config_host_mak
+  rm -rf *-{bsd-usr,darwin-user,linux-user,softmmu}/libbackdoor/
+fi
+
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
   echo "CONFIG_BSD=y" >> $config_host_mak




reply via email to

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