buildroot: add support for debugging Normal World applications
Build with GDBSERVER=y to enable remote debugging of Normal World
applications. gdbserver is added to the root filesystem.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
diff --git a/common.mk b/common.mk
index f4232f9..c170f0b 100644
--- a/common.mk
+++ b/common.mk
@@ -183,11 +183,17 @@
# Build root
################################################################################
BUILDROOT_ARCH=aarch$(COMPILE_NS_USER)
+ifeq ($(GDBSERVER),y)
+BUILDROOT_TOOLCHAIN=toolchain-br # Use toolchain supplied by buildroot
+DEFCONFIG_GDBSERVER=--br-defconfig build/br-ext/configs/gdbserver.conf
+else
+# Local toolchains (downloaded by "make toolchains")
ifeq ($(COMPILE_LEGACY),)
BUILDROOT_TOOLCHAIN=toolchain-aarch$(COMPILE_NS_USER)
else
BUILDROOT_TOOLCHAIN=toolchain-aarch$(COMPILE_NS_USER)-legacy
endif
+endif
BUILDROOT_GETTY_PORT ?= \
$(if $(CFG_NW_CONSOLE_UART),ttyAMA$(CFG_NW_CONSOLE_UART),ttyAMA0)
.PHONY: buildroot
@@ -230,6 +236,7 @@
--br-defconfig build/br-ext/configs/optee_$(BUILDROOT_ARCH) \
--br-defconfig build/br-ext/configs/optee_generic \
--br-defconfig build/br-ext/configs/$(BUILDROOT_TOOLCHAIN) \
+ $(DEFCONFIG_GDBSERVER) \
--br-defconfig out-br/extra.conf \
--make-cmd $(MAKE))
@$(MAKE) -C ../out-br all
@@ -306,8 +313,12 @@
-device virtio-9p-device,fsdev=fsdev0,mount_tag=host
endif
+ifeq ($(GDBSERVER),y)
+HOSTFWD := ,hostfwd=tcp::12345-:12345
+endif
# Enable QEMU SLiRP user networking
-QEMU_EXTRA_ARGS += -netdev user,id=vmnic -device virtio-net-device,netdev=vmnic
+QEMU_EXTRA_ARGS +=\
+ -netdev user,id=vmnic$(HOSTFWD) -device virtio-net-device,netdev=vmnic
define run-help
@echo