From 0ced0032ff8dc4c9383652697122e4473904e014 Mon Sep 17 00:00:00 2001 From: Drew Galbraith Date: Wed, 15 Nov 2023 16:39:30 -0800 Subject: [PATCH] Move qemu startup to its own script. This causes us to reinstall and rebuild the image each time we run qemu. This necessary now that we are loading files from the disk because cmake makes it tricky (impossible?) to have a command rely on a different target being "installed". Because of this, updates to the teton executable were not being picked up on the image. --- CMakeLists.txt | 25 ------------------------- scripts/qemu.sh | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 25 deletions(-) create mode 100755 scripts/qemu.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index b1fca57..ab6a474 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,28 +16,3 @@ add_subdirectory(zion) add_subdirectory(lib) add_subdirectory(yunq) add_subdirectory(sys) - -# Use machine q35 to access PCI devices. -set(QEMU_CMD qemu-system-x86_64 -machine q35 -d guest_errors -m 1G -serial stdio -hda disk.img) - -add_custom_command( - OUTPUT disk.img - COMMAND sudo sh ../scripts/build_image.sh disk.img - DEPENDS zion yellowstone denali victoriafalls - USES_TERMINAL -) - -add_custom_target(qemu - COMMAND ${QEMU_CMD} - DEPENDS disk.img - USES_TERMINAL) - -add_custom_target(qemu-dbg - COMMAND ${QEMU_CMD} -S -s - DEPENDS disk.img - USES_TERMINAL) - -add_custom_target(qemu-int - COMMAND ${QEMU_CMD} -d int - DEPENDS disk.img - USES_TERMINAL) diff --git a/scripts/qemu.sh b/scripts/qemu.sh new file mode 100755 index 0000000..082c939 --- /dev/null +++ b/scripts/qemu.sh @@ -0,0 +1,23 @@ +#! /bin/bash + +set -e + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +echo $DIR + +BUILD_DIR="${DIR}/../builddbg" + +pushd $BUILD_DIR +ninja && ninja install + +sudo sh ${DIR}/build_image.sh disk.img + +# Use machine q35 to access PCI devices. +qemu-system-x86_64 -machine q35 -d guest_errors -m 1G -serial stdio -hda disk.img +popd + +# Extra options to add to this script in the future. +# Debug opts: -S -s +# Interrupt opts: -d int +