Skip to content

Commit

Permalink
Add tmux mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kernel-cyrus committed May 15, 2024
1 parent 62b356b commit c4cca07
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions start-kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CMDLINE=""
DEBUGGER="gdb"
SHARE_FOLDER=$(realpath ./host-share)
TERMINAL="gnome"
PARAMS="$@"

for i in "$@"; do
case $i in
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -163,4 +173,4 @@ elif [ $DEBUGGER == "ddd" ]; then
fi

killall qemu-system-aarch64

tmux kill-session -t lightbox

0 comments on commit c4cca07

Please sign in to comment.