[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
|
smp=4
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-b | --debugboot)
|
-b | --debugboot)
|
||||||
debug="-s -S"
|
debug="-s -S"
|
||||||
debugtarget="${build}/boot/boot.efi"
|
debugtarget="${build}/boot/boot.efi"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-d | --debug)
|
-d | --debug)
|
||||||
debug="-s -S"
|
debug="-s -S"
|
||||||
isaexit=""
|
isaexit=""
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-g | --gfx)
|
-g | --gfx)
|
||||||
gfx=""
|
gfx=""
|
||||||
vga=""
|
vga=""
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-v | --vga)
|
-v | --vga)
|
||||||
vga=""
|
vga=""
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-k | --kvm)
|
-r | --remote)
|
||||||
kvm="-enable-kvm"
|
|
||||||
cpu="host"
|
|
||||||
shift
|
shift
|
||||||
;;
|
vnchost="${1:-${VNCHOST:-localhost}}"
|
||||||
|
gfx="-vnc ${vnchost}:7000,reverse"
|
||||||
|
vga=""
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-k | --kvm)
|
||||||
|
kvm="-enable-kvm"
|
||||||
|
cpu="host"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-c | --cpus)
|
-c | --cpus)
|
||||||
smp=$2
|
smp=$2
|
||||||
shift 2
|
shift 2
|
||||||
@@ -46,53 +53,54 @@ while true; do
|
|||||||
log="-d mmu,int,guest_errors -D jsix.log"
|
log="-d mmu,int,guest_errors -D jsix.log"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -d "$1" ]; then
|
if [ -d "$1" ]; then
|
||||||
build="$1"
|
build="$1"
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ ! -c /dev/kvm ]]; then
|
if [[ ! -c /dev/kvm ]]; then
|
||||||
kvm=""
|
kvm=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! ninja -C "${build}"; then
|
if ! ninja -C "${build}"; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n $TMUX ]]; then
|
if [[ -n $TMUX ]]; then
|
||||||
if [[ -n $debug ]]; then
|
if [[ -n $debug ]]; then
|
||||||
tmux split-window -h "gdb ${debugtarget}" &
|
tmux split-window -h "gdb ${debugtarget}" &
|
||||||
else
|
else
|
||||||
tmux split-window -h -l 80 "sleep 1; telnet localhost 45455" &
|
tmux split-window -h -l 80 "sleep 1; telnet localhost 45455" &
|
||||||
tmux last-pane
|
tmux last-pane
|
||||||
tmux split-window -l 10 "sleep 1; telnet localhost 45454" &
|
tmux split-window -l 10 "sleep 1; telnet localhost 45454" &
|
||||||
fi
|
fi
|
||||||
elif [[ $DESKTOP_SESSION = "i3" ]]; then
|
elif [[ $DESKTOP_SESSION = "i3" ]]; then
|
||||||
if [[ -n $debug ]]; then
|
if [[ -n $debug ]]; then
|
||||||
i3-msg exec i3-sensible-terminal -- -e "gdb ${debugtarget}" &
|
i3-msg exec i3-sensible-terminal -- -e "gdb ${debugtarget}" &
|
||||||
else
|
else
|
||||||
i3-msg exec i3-sensible-terminal -- -e 'telnet localhost 45454' &
|
i3-msg exec i3-sensible-terminal -- -e 'telnet localhost 45454' &
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
qemu-system-x86_64 \
|
qemu-system-x86_64 \
|
||||||
-drive "if=pflash,format=raw,readonly,file=${assets}/ovmf/x64/ovmf_code.fd" \
|
-drive "if=pflash,format=raw,readonly,file=${assets}/ovmf/x64/ovmf_code.fd" \
|
||||||
-drive "if=pflash,format=raw,file=${build}/ovmf_vars.fd" \
|
-drive "if=pflash,format=raw,file=${build}/ovmf_vars.fd" \
|
||||||
-drive "format=raw,file=${build}/jsix.img" \
|
-drive "format=raw,file=${build}/jsix.img" \
|
||||||
-monitor telnet:localhost:45454,server,nowait \
|
-monitor telnet:localhost:45454,server,nowait \
|
||||||
-serial stdio \
|
-serial stdio \
|
||||||
-serial telnet:localhost:45455,server,nowait \
|
-serial telnet:localhost:45455,server,nowait \
|
||||||
-smp "${smp}" \
|
-smp "${smp}" \
|
||||||
-m 4096 \
|
-m 4096 \
|
||||||
-cpu "${cpu}" \
|
-cpu "${cpu}" \
|
||||||
-M q35 \
|
-M q35 \
|
||||||
-no-reboot \
|
-no-reboot \
|
||||||
$isaexit $log $gfx $vga $kvm $debug
|
-name "jsix" \
|
||||||
|
$isaexit $log $gfx $vga $kvm $debug
|
||||||
|
|
||||||
((result = ($? >> 1) - 1))
|
((result = ($? >> 1) - 1))
|
||||||
exit $result
|
exit $result
|
||||||
|
|||||||
Reference in New Issue
Block a user