From fd0594323e424eeae2489b1f3e0bab5d5ac9b9cc Mon Sep 17 00:00:00 2001 From: ChUrl Date: Wed, 7 Dec 2022 16:40:51 +0100 Subject: [PATCH] Add build/run scripts --- build.sh | 15 +++++++++++++++ run.sh | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 build.sh create mode 100755 run.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..dd34a68 --- /dev/null +++ b/build.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +BUILD_DIR="build" +CORE_COUNT=8 +BUILD_TYPE="Debug" +TARGET="bootdisk" + +echo "Creating build-directory ${BUILD_DIR}" +mkdir -p ${BUILD_DIR} +cd $BUILD_DIR || exit + +echo "Using ${CORE_COUNT} CPU-Cores for make" + +cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" +make -j "${CORE_COUNT}" "${TARGET}" diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..8499776 --- /dev/null +++ b/run.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +QEMU_BIN="qemu-system-i386" +QEMU_MACHINE="pc" +QEMU_CPU="base" +QEMU_RAM="128M" +QEMU_ARGS="-drive format=raw,file=./bootdisk.vmi -boot a -k en-us -vga std -serial stdio" # or -monitor stdio +QEMU_AUDIO_ARGS="-audiodev id=pa,driver=pa -machine pcspk-audiodev=pa" +QEMU_GDB_PORT="" + +command="${QEMU_BIN} -machine ${QEMU_MACHINE} -m ${QEMU_RAM} -cpu ${QEMU_CPU} ${QEMU_ARGS} ${QEMU_AUDIO_ARGS}" + +printf "Running: %s\\n" "${command}" + +if [ -n "${QEMU_GDB_PORT}" ]; then + $command -gdb tcp::"${QEMU_GDB_PORT}" -S & +else + $command +fi