Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
71 changes: 71 additions & 0 deletions scripts/lych.ps1
Original file line number Diff line number Diff line change
@@ -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
}
}