diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-04-07 14:01:18 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-04-07 14:01:18 +0200 |
| commit | 3bf3c748eec38c776dd3c54cbb30be1d44ffb5c3 (patch) | |
| tree | 9700ccca2924d263da341e141543507dd07a26a6 | |
| parent | 482f431213b77b3ec72d4cfb5c77e23b34e8e68f (diff) | |
| download | teachos-3bf3c748eec38c776dd3c54cbb30be1d44ffb5c3.tar.xz teachos-3bf3c748eec38c776dd3c54cbb30be1d44ffb5c3.zip | |
ide: simplify overall configuration
| -rw-r--r-- | .nvim.lua | 34 | ||||
| -rw-r--r-- | .vscode/tasks.json | 36 | ||||
| -rwxr-xr-x | scripts/qemu-wrapper.sh | 30 |
3 files changed, 42 insertions, 58 deletions
@@ -49,39 +49,19 @@ local function launch_qemu(artifact_path, is_debug) end local paths = resolve_build_paths(artifact_path) + local debug_flag = is_debug and "1" or "0" + local shell_cmd = string.format("%s/scripts/qemu-wrapper.sh '%s' '%s' '%s' '%s'", + workspace_folder, workspace_folder, paths.build_type, paths.iso, debug_flag) - local cmd = { - "qemu-system-x86_64", - "-m", "32M", - "-machine", "q35", - "-smp", "4,sockets=1,cores=4,threads=1", - "-display", "curses", - "-debugcon", string.format("file:%s/qemu-debugcon-%s.log", workspace_folder, paths.build_type), - "-cdrom", paths.iso - } - - if is_debug then - table.insert(cmd, 2, "-s") - table.insert(cmd, 3, "-no-reboot") - table.insert(cmd, 4, "-d") - table.insert(cmd, 5, "int,cpu_reset") - end - - local shell_cmd = string.format("%s 2>%s/qemu-stderr-%s.log", table.concat(cmd, " "), workspace_folder, paths.build_type) - - vim.cmd("botright vsplit") - vim.cmd("enew") + vim.cmd("botright vsplit | enew") qemu_bufnr = vim.api.nvim_get_current_buf() - - vim.api.nvim_buf_set_name(qemu_bufnr, "TeachOS QEMU") + vim.api.nvim_buf_set_name(qemu_bufnr, "TeachOS QEMU (" .. paths.build_type .. ")") vim.opt_local.number = false vim.opt_local.relativenumber = false vim.opt_local.signcolumn = "no" - qemu_job_id = vim.fn.termopen({ "bash", "-c", shell_cmd }, { - on_exit = function() - qemu_job_id = nil - end + qemu_job_id = vim.fn.termopen(shell_cmd, { + on_exit = function() qemu_job_id = nil end }) vim.cmd("wincmd p") diff --git a/.vscode/tasks.json b/.vscode/tasks.json index d673a7a..1aa53d9 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -6,23 +6,10 @@ "command": "${workspaceFolder}/scripts/qemu-wrapper.sh", "type": "shell", "args": [ - "-s", - "-m", - "32M", - "-machine", - "q35", - "-smp", - "4,sockets=1,cores=4,threads=1", - "-display", - "curses", - "-debugcon", - "file:${workspaceFolder}/qemu-debugcon-${command:cmake.buildType}.log", - "-no-reboot", - "-d", - "int,cpu_reset", - "-cdrom", + "${workspaceFolder}", + "${command:cmake.buildType}", "${command:cmake.buildDirectory}/bin/${command:cmake.buildType}/kernel.iso", - "2>${workspaceFolder}/qemu-stderr-${command:cmake.buildType}.log" + "1" ], "isBackground": true, "presentation": { @@ -47,22 +34,13 @@ }, { "label": "QEMU", - "command": "qemu-system-x86_64", + "command": "${workspaceFolder}/scripts/qemu-wrapper.sh", "type": "shell", "args": [ - "-m", - "32M", - "-machine", - "q35", - "-smp", - "4,sockets=1,cores=4,threads=1", - "-display", - "curses", - "-debugcon", - "file:${workspaceFolder}/qemu-debugcon-${command:cmake.buildType}.log", - "-cdrom", + "${workspaceFolder}", + "${command:cmake.buildType}", "${command:cmake.buildDirectory}/bin/${command:cmake.buildType}/kernel.iso", - "2>${workspaceFolder}/qemu-stderr-${command:cmake.buildType}.log" + "0" ], "isBackground": true, "presentation": { diff --git a/scripts/qemu-wrapper.sh b/scripts/qemu-wrapper.sh index fa89ac5..49c01ec 100755 --- a/scripts/qemu-wrapper.sh +++ b/scripts/qemu-wrapper.sh @@ -1,4 +1,30 @@ #!/bin/bash +# scripts/qemu-wrapper.sh -echo "QEMU WRAPPER" -qemu-system-x86_64 $@ +WORKSPACE_DIR=${1:-.} +BUILD_TYPE=${2:-Debug} +ISO_PATH=$3 +IS_DEBUG=${4:-0} + +if [ -z "$ISO_PATH" ]; then + echo "Usage: $0 <workspace_dir> <build_type> <iso_path> [is_debug]" + exit 1 +fi + +ARGS=( + "-m" "32M" + "-machine" "q35" + "-smp" "4,sockets=1,cores=4,threads=1" + "-display" "curses" + "-debugcon" "file:${WORKSPACE_DIR}/qemu-debugcon-${BUILD_TYPE}.log" + "-cdrom" "${ISO_PATH}" +) + +if [ "$IS_DEBUG" == "1" ]; then + ARGS=( "-s" "-no-reboot" "-d" "int,cpu_reset" "${ARGS[@]}" ) +fi + +echo "QEMU WRAPPER: Executing TeachOS" +echo "Arguments: ${ARGS[@]}" + +qemu-system-x86_64 "${ARGS[@]}" 2> "${WORKSPACE_DIR}/qemu-stderr-${BUILD_TYPE}.log" |
