qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lluís <xscript@gmx.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v2 2/6] backdoor: handle config-time activation
Date: Thu, 04 Nov 2010 23:35:26 +0100	[thread overview]
Message-ID: <20101104223526.16669.80998.stgit@ginnungagap.bsc.es> (raw)
In-Reply-To: <20101104223452.16669.25092.stgit@ginnungagap.bsc.es>

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 <vilanova@ac.upc.edu>
---
 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

  parent reply	other threads:[~2010-11-04 22:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-04 22:34 [Qemu-devel] [RFC][PATCH v2 0/6] backdoor: instruction-based guest-to-QEMU backdoor communication channel Lluís
2010-11-04 22:35 ` [Qemu-devel] [PATCH v2 1/6] [arm m68k] move helpers.h to helper.h Lluís
2010-11-04 22:35 ` Lluís [this message]
2010-11-04 22:35 ` [Qemu-devel] [PATCH v2 3/6] backdoor: declare host-side backdoor helpers Lluís
2010-11-04 22:35 ` [Qemu-devel] [PATCH v2 4/6] backdoor: declare guest-side interface macros Lluís
2010-11-04 22:36 ` [Qemu-devel] [PATCH v2 5/6] backdoor: [i386] provide and implement intruction-based backdoor interface Lluís
2010-11-07 12:36   ` Gleb Natapov
2010-11-08 14:16     ` Lluís
2010-11-04 22:36 ` [Qemu-devel] [PATCH v2 6/6] backdoor: add a simple example Lluís

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101104223526.16669.80998.stgit@ginnungagap.bsc.es \
    --to=xscript@gmx.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).