diff --git a/.labbegin b/.labbegin index cf295bdc52b390917b9527482021c8c88e5503f9..e8621c65298ecd2f9fd9c0047f3e58aa5403bf46 100644 --- a/.labbegin +++ b/.labbegin @@ -32,6 +32,13 @@ ifneq ($(QEMU),) endif endif +# With tmux, the Linux kernel can be debugged in the CLI +ifneq ($(findstring debug,$(firstword $(MAKECMDGOALS)))),) + ifeq ($(wildcard /usr/bin/tmux),) + PKGS += tmux + endif +endif + # gcc 4.3 must work with 2.24 binutils (ld), otherwise, the kernel compiled not boot # LS is a predefined variable, use LDT (ld tool) instead here ifeq ($(CCORI),internal) diff --git a/Makefile b/Makefile index c75bf67e094c943cdb1dacd69bca9b27eae1bf00..075c865c0bae41c7c70a47024d915f8cd6f94c2d 100644 --- a/Makefile +++ b/Makefile @@ -4607,7 +4607,7 @@ ifneq ($(DEBUG),0) # Debug listen on a unqiue port, should run exclusively DEBUG_LOCK := $(GDBINIT_DIR)/.lock KEEP_UNIQUE := flock -n -x $(DEBUG_LOCK) - RUN_BOOT_CMD := $(KEEP_UNIQUE) $(BOOT_CMD) || $(GDB_CMD) + RUN_BOOT_CMD := tmux new-session -d '$(KEEP_UNIQUE) $(BOOT_CMD)' \; split-window -h '$(GDB_CMD)' \; attach else RUN_BOOT_CMD := $(BOOT_CMD) endif