mirror of
https://github.com/justinian/jsix.git
synced 2025-12-09 16:04:32 -08:00
[tools] Add remote option to qemu.sh
I discovered that QEMU has a "remote" option to the `-vnc` switch, which causes it to reverse-connect to a VNC client on start. I've added this into qemu.sh as the -r option.
This commit is contained in:
104
qemu.sh
104
qemu.sh
@@ -13,31 +13,38 @@ cpu="Broadwell,+pdpe1gb"
|
||||
smp=4
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
-b | --debugboot)
|
||||
debug="-s -S"
|
||||
debugtarget="${build}/boot/boot.efi"
|
||||
case "$1" in
|
||||
-b | --debugboot)
|
||||
debug="-s -S"
|
||||
debugtarget="${build}/boot/boot.efi"
|
||||
shift
|
||||
;;
|
||||
-d | --debug)
|
||||
debug="-s -S"
|
||||
;;
|
||||
-d | --debug)
|
||||
debug="-s -S"
|
||||
isaexit=""
|
||||
shift
|
||||
;;
|
||||
-g | --gfx)
|
||||
gfx=""
|
||||
vga=""
|
||||
;;
|
||||
-g | --gfx)
|
||||
gfx=""
|
||||
vga=""
|
||||
shift
|
||||
;;
|
||||
-v | --vga)
|
||||
vga=""
|
||||
;;
|
||||
-v | --vga)
|
||||
vga=""
|
||||
shift
|
||||
;;
|
||||
-k | --kvm)
|
||||
kvm="-enable-kvm"
|
||||
cpu="host"
|
||||
;;
|
||||
-r | --remote)
|
||||
shift
|
||||
;;
|
||||
vnchost="${1:-${VNCHOST:-localhost}}"
|
||||
gfx="-vnc ${vnchost}:7000,reverse"
|
||||
vga=""
|
||||
shift
|
||||
;;
|
||||
-k | --kvm)
|
||||
kvm="-enable-kvm"
|
||||
cpu="host"
|
||||
shift
|
||||
;;
|
||||
-c | --cpus)
|
||||
smp=$2
|
||||
shift 2
|
||||
@@ -46,53 +53,54 @@ while true; do
|
||||
log="-d mmu,int,guest_errors -D jsix.log"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
*)
|
||||
if [ -d "$1" ]; then
|
||||
build="$1"
|
||||
shift
|
||||
fi
|
||||
break
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ ! -c /dev/kvm ]]; then
|
||||
kvm=""
|
||||
kvm=""
|
||||
fi
|
||||
|
||||
if ! ninja -C "${build}"; then
|
||||
exit 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n $TMUX ]]; then
|
||||
if [[ -n $debug ]]; then
|
||||
tmux split-window -h "gdb ${debugtarget}" &
|
||||
else
|
||||
tmux split-window -h -l 80 "sleep 1; telnet localhost 45455" &
|
||||
tmux last-pane
|
||||
tmux split-window -l 10 "sleep 1; telnet localhost 45454" &
|
||||
fi
|
||||
if [[ -n $debug ]]; then
|
||||
tmux split-window -h "gdb ${debugtarget}" &
|
||||
else
|
||||
tmux split-window -h -l 80 "sleep 1; telnet localhost 45455" &
|
||||
tmux last-pane
|
||||
tmux split-window -l 10 "sleep 1; telnet localhost 45454" &
|
||||
fi
|
||||
elif [[ $DESKTOP_SESSION = "i3" ]]; then
|
||||
if [[ -n $debug ]]; then
|
||||
i3-msg exec i3-sensible-terminal -- -e "gdb ${debugtarget}" &
|
||||
else
|
||||
i3-msg exec i3-sensible-terminal -- -e 'telnet localhost 45454' &
|
||||
fi
|
||||
if [[ -n $debug ]]; then
|
||||
i3-msg exec i3-sensible-terminal -- -e "gdb ${debugtarget}" &
|
||||
else
|
||||
i3-msg exec i3-sensible-terminal -- -e 'telnet localhost 45454' &
|
||||
fi
|
||||
fi
|
||||
|
||||
qemu-system-x86_64 \
|
||||
-drive "if=pflash,format=raw,readonly,file=${assets}/ovmf/x64/ovmf_code.fd" \
|
||||
-drive "if=pflash,format=raw,file=${build}/ovmf_vars.fd" \
|
||||
-drive "format=raw,file=${build}/jsix.img" \
|
||||
-monitor telnet:localhost:45454,server,nowait \
|
||||
-serial stdio \
|
||||
-serial telnet:localhost:45455,server,nowait \
|
||||
-smp "${smp}" \
|
||||
-m 4096 \
|
||||
-cpu "${cpu}" \
|
||||
-M q35 \
|
||||
-no-reboot \
|
||||
$isaexit $log $gfx $vga $kvm $debug
|
||||
-drive "if=pflash,format=raw,readonly,file=${assets}/ovmf/x64/ovmf_code.fd" \
|
||||
-drive "if=pflash,format=raw,file=${build}/ovmf_vars.fd" \
|
||||
-drive "format=raw,file=${build}/jsix.img" \
|
||||
-monitor telnet:localhost:45454,server,nowait \
|
||||
-serial stdio \
|
||||
-serial telnet:localhost:45455,server,nowait \
|
||||
-smp "${smp}" \
|
||||
-m 4096 \
|
||||
-cpu "${cpu}" \
|
||||
-M q35 \
|
||||
-no-reboot \
|
||||
-name "jsix" \
|
||||
$isaexit $log $gfx $vga $kvm $debug
|
||||
|
||||
((result = ($? >> 1) - 1))
|
||||
exit $result
|
||||
|
||||
Reference in New Issue
Block a user