From c4cca070ddcbf659b46ab4525d9e711866c15620 Mon Sep 17 00:00:00 2001 From: Cyrus Huang Date: Wed, 15 May 2024 19:53:13 +0800 Subject: [PATCH] Add tmux mode --- start-kernel.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/start-kernel.sh b/start-kernel.sh index 4872b49..35dcc0c 100755 --- a/start-kernel.sh +++ b/start-kernel.sh @@ -5,6 +5,7 @@ CMDLINE="" DEBUGGER="gdb" SHARE_FOLDER=$(realpath ./host-share) TERMINAL="gnome" +PARAMS="$@" for i in "$@"; do case $i in @@ -121,10 +122,19 @@ elif [ $TERMINAL == "cli-qemu" ]; then elif [ $TERMINAL == "cli-gdb" ]; then echo "Try to connect QEMU..." elif [ $TERMINAL == "tmux" ]; then - # FIXME: tmux new-session -d -s mysession 'bash' ; split-window -h 'bash' ; attach-session -d -t mysession + DIR=$(pwd) + tmux kill-session -t lightbox + tmux new-session -d -s lightbox "bash" + tmux send-keys -t lightbox "cd $DIR" C-m + tmux send-keys -t lightbox "source ./start-kernel.sh ${PARAMS/tmux/cli-qemu}" C-m + tmux split-window -h "bash" + tmux send-keys -t lightbox "cd $DIR" C-m + tmux send-keys -t lightbox "source ./start-kernel.sh ${PARAMS/tmux/cli-gdb}" C-m + tmux attach-session -d -t lightbox + tmux kill-session -t lightbox return 0 else - echo "Invalid param: --terminal=\"$TERMINAL\", please use \"gnome\", \"xfce4\", \"cli-qemu\", \"cli-gdb\"" + echo "Invalid param: --terminal=\"$TERMINAL\", please use \"tmux\", \"gnome\", \"xfce4\", \"cli-qemu\", \"cli-gdb\"" return 0 fi @@ -163,4 +173,4 @@ elif [ $DEBUGGER == "ddd" ]; then fi killall qemu-system-aarch64 - +tmux kill-session -t lightbox