[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/18] backdoor: Handle config-time activation
From: |
Lluís |
Subject: |
[Qemu-devel] [PATCH 01/18] backdoor: Handle config-time activation |
Date: |
Mon, 18 Oct 2010 19:24:26 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
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 c48cbcc..9152723 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 a079a49..0de937e 100755
--- a/configure
+++ b/configure
@@ -332,6 +332,8 @@ trace_backend="nop"
trace_file="trace"
spice=""
+backdoor=""
+
# OS specific
if check_define __linux__ ; then
targetos="Linux"
@@ -740,6 +742,14 @@ for opt do
;;
--*dir)
;;
+ --with-backdoor=*) backdoor="$optarg"
+ if test ! -f "$backdoor/Makefile"; then
+ echo "ERROR: cannot make into $backdoor"
+ show_help="yes"
+ else
+ backdoor=`readlink -f $backdoor`
+ fi
+ ;;
*) echo "ERROR: unknown option $opt"; show_help="yes"
;;
esac
@@ -931,6 +941,7 @@ echo " --trace-file=NAME Full PATH,NAME of file to
store traces"
echo " Default:trace-<pid>"
echo " --disable-spice disable spice"
echo " --enable-spice enable spice"
+echo " --with-backdoor=PATH enable backdoor communication and compile
implementation in PATH"
echo ""
echo "NOTE: The object files are built at the place where configure is
launched"
exit 1
@@ -2321,6 +2332,10 @@ 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"
fi
@@ -2579,6 +2594,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 *-{linux-user,softmmu}/libbackdoor/
+fi
+
# XXX: suppress that
if [ "$bsd" = "yes" ] ; then
echo "CONFIG_BSD=y" >> $config_host_mak
--
1.7.1
--
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom
Tollbooth
- [Qemu-devel] [PATCH 00/17] [RFC] static instrumentation, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 00/17] [RFC] static instrumentation, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 01/18] backdoor: Handle config-time activation,
Lluís <=
- [Qemu-devel] [PATCH 02/18] backdoor: Declare host-side backdoor helpers, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 13/18] instrument: Add FETCH point, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 14/18] instrument: [i386] Call FETCH point, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 15/18] instrument: Add VMEM point, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 16/18] instrument: [all] Call VMEM point, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 17/18] instrument: Add PLVL point, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 18/18] instrument: [i386] Call PLVL point, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 03/18] backdoor: [all] Include backdoor helper declarations, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 04/18] backdoor: Declare guest-side interface macros, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 08/18] instrument: Handle config-time activation, Lluís, 2010/10/22