From ea33bbdc8acbeee1402f2c9ef15f6aa50923459f Mon Sep 17 00:00:00 2001 From: rabindra789 Date: Fri, 11 Sep 2026 10:07:25 +0530 Subject: [PATCH] scripts: add Windows PowerShell entry point --- CONTRIBUTING.md | 2 ++ README.md | 4 ++- scripts/lych.ps1 | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 scripts/lych.ps1 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ceff0b5..48bd793 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,6 +22,8 @@ Install QEMU and GDB with your system package manager: apt install qemu-system-arm gdb-multiarch ``` +> **Windows:** use Git Bash and the `./scripts/lych` commands below, or PowerShell with `.\scripts\lych.ps1` instead. The two scripts expose the same commands. + ## Getting the Source ```sh diff --git a/README.md b/README.md index 3c74d84..9ce4b63 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,8 @@ Install QEMU and GDB through your system package manager, e.g.: apt install qemu-system-arm gdb-multiarch ``` +> **Windows:** run the same commands from Git Bash using `./scripts/lych`, or from PowerShell using `.\scripts\lych.ps1`. The two scripts are equivalent. + ### Build ```sh @@ -76,7 +78,7 @@ The first starts QEMU paused with a GDB stub on `tcp::1234`; the second attaches ./scripts/lych clean ``` -All development flows go through `./scripts/lych` instead of raw `qemu-system-aarch64` and `gdb-multiarch` invocations. QEMU arguments, the CPU model, and debug options are kept in one place so they change in only one file when the platform or workflow changes. +All development flows go through the `scripts/` entry points — `./scripts/lych` (Git Bash, Linux, macOS) or `.\scripts\lych.ps1` (Windows PowerShell) — instead of raw `qemu-system-aarch64` and `gdb-multiarch` invocations. QEMU arguments, the CPU model, and debug options are kept in one place so they change in only one file when the platform or workflow changes. ## Repository Layout diff --git a/scripts/lych.ps1 b/scripts/lych.ps1 new file mode 100644 index 0000000..170042f --- /dev/null +++ b/scripts/lych.ps1 @@ -0,0 +1,71 @@ +param( + [Parameter(Position = 0)] + [string]$Command +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +$Project = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path) +Write-Host "Project root: $Project" -ForegroundColor DarkGray + +switch ($Command) { + 'build' { + cargo build --release + } + + 'run' { + cargo build --release + + & qemu-system-aarch64 ` + -M virt ` + -cpu cortex-a72 ` + -nographic ` + -kernel $Project\target\aarch64-unknown-none\release\kernel + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + } + + 'debug' { + cargo build --release + + & qemu-system-aarch64 ` + -M virt ` + -cpu cortex-a72 ` + -nographic ` + -S ` + -gdb tcp::1234 ` + -kernel $Project\target\aarch64-unknown-none\release\kernel + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + } + + 'gdb' { + & gdb-multiarch ` + $Project\target\aarch64-unknown-none\release\kernel ` + -ex 'target remote :1234' + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + } + + 'clean' { + cargo clean + } + + 'fmt' { + cargo fmt --all + } + + 'fmt-check' { + cargo fmt --all --check + } + + default { + Write-Host 'Usage:' -ForegroundColor Yellow + Write-Host ' .\scripts\lych.ps1 build' + Write-Host ' .\scripts\lych.ps1 run' + Write-Host ' .\scripts\lych.ps1 debug' + Write-Host ' .\scripts\lych.ps1 gdb' + Write-Host ' .\scripts\lych.ps1 clean' + Write-Host ' .\scripts\lych.ps1 fmt' + Write-Host ' .\scripts\lych.ps1 fmt-check' + exit 1 + } +} \ No newline at end of file