[tools] Add --no-build option to qemu.sh

Add an option to tell qemu.sh not to build before running. Also update
paths to be more explicit about where log files go.
This commit is contained in:
Justin C. Miller
2023-07-10 01:43:07 -07:00
parent a449a88395
commit 3ba0600694

24
qemu.sh
View File

@@ -1,7 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
build="$(dirname $0)/build" root=$(dirname $0)
assets="$(dirname $0)/assets" build="${root}/build"
assets="${root}/assets"
no_build=""
debug="" debug=""
isaexit='-device isa-debug-exit,iobase=0xf4,iosize=0x04' isaexit='-device isa-debug-exit,iobase=0xf4,iosize=0x04'
debugtarget="${build}/jsix.elf" debugtarget="${build}/jsix.elf"
@@ -52,13 +55,17 @@ while true; do
shift 2 shift 2
;; ;;
-l | --log) -l | --log)
log="-d mmu,int,guest_errors -D jsix.log" log="-d mmu,int,guest_errors -D ${root}/jsix.log"
shift shift
;; ;;
-x | --debugcon) -x | --debugcon)
debugcon_cmd="less --follow-name -R +F debugcon.log" debugcon_cmd="less --follow-name -R +F debugcon.log"
shift shift
;; ;;
--no-build)
no_build="yes"
shift
;;
*) *)
if [ -d "$1" ]; then if [ -d "$1" ]; then
build="$1" build="$1"
@@ -73,7 +80,7 @@ if [[ ! -c /dev/kvm ]]; then
kvm="" kvm=""
fi fi
if ! ninja -C "${build}"; then [[ -z "${no_build}" ]] && if ! ninja -C "${build}"; then
exit 1 exit 1
fi fi
@@ -120,11 +127,16 @@ elif [[ $DESKTOP_SESSION = "i3" ]]; then
fi fi
fi fi
if [[ -n "${debug}" ]]; then
(sleep 1; echo "Debugging ready.") &
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=on,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" \
-chardev file,path=debugcon.log,id=jsix_debug -device isa-debugcon,iobase=0x6600,chardev=jsix_debug \ -chardev "file,path=${root}/debugcon.log,id=jsix_debug" \
-device "isa-debugcon,iobase=0x6600,chardev=jsix_debug" \
-monitor telnet:localhost:45454,server,nowait \ -monitor telnet:localhost:45454,server,nowait \
-serial stdio \ -serial stdio \
-smp "${smp}" \ -smp "${smp}" \