From 754d96ebc53ced4150fa35070bacaf3585359b25 Mon Sep 17 00:00:00 2001 From: Nexoniarz Date: Sun, 9 Aug 2026 14:38:02 +0200 Subject: [PATCH] tools: group scripts by what runs them tools/windows/ .ps1 (pwsh, so usable from Linux and macOS too) tools/posix/ .sh tools/python/ .py tools/ .c and .pl The .c and .pl files stay at the top level because they are not host-specific: the build compiles or invokes them on every platform. Call sites updated in the Makefile, ports/mk/port.mk, docs and the project memory. The one thing that does not survive a move on its own is a script deriving the repo root from its own location -- all nine PowerShell tools used Split-Path $PSScriptRoot -Parent, and memory-sync.sh used dirname/.., both of which quietly become tools/ one level deeper. Two levels now. Two pre-existing Windows failures surfaced while verifying, both real and neither caused by the move: - schfs_fsck.c did not compile under mingw at all: --extract uses POSIX mkdir(path,mode), symlink() and link(), none of which mingw has. That took the whole tool with it, and `make schfs-check` with it. mkdir maps to _mkdir; symlink and link fail loudly rather than writing a regular file in their place, because an extracted tree that differs from the image while reporting success defeats the point of --extract. - the round-trip test then failed at `ln -s`, since Git Bash cannot create symlinks without developer mode. It skips with a message now. Not a fudge: mkschfs's mingw build cannot see a symlink either, so the test would have compared a tree with none against an image with none and called it a pass -- coverage reporting itself as present while being absent. Verified on Windows: build clean, all seven bootcheck suites green, make schfs-check passes. --- Makefile | 12 ++++----- docs/architecture/kernel-history.md | 2 +- docs/architecture/schfs.md | 8 +++--- docs/building.md | 35 ++++++++++++++++++++------ docs/layout.md | 4 +-- docs/roadmap.md | 6 ++--- ports/mk/port.mk | 2 +- tools/{ => posix}/memory-sync.sh | 10 ++++---- tools/{ => posix}/mkiso.sh | 2 +- tools/{ => posix}/mktree.sh | 0 tools/{ => posix}/mutate.sh | 0 tools/{ => posix}/schfs_roundtrip.sh | 21 ++++++++++++++++ tools/{ => posix}/sha256check.sh | 0 tools/{ => python}/crashqr.py | 0 tools/{ => python}/mklogo.py | 0 tools/{ => python}/qrcheck.py | 0 tools/schfs_fsck.c | 37 ++++++++++++++++++++++++++++ tools/{ => windows}/bootcheck.ps1 | 3 ++- tools/{ => windows}/crashshot.ps1 | 3 ++- tools/{ => windows}/dispshot.ps1 | 3 ++- tools/{ => windows}/fbshot.ps1 | 3 ++- tools/{ => windows}/loc.ps1 | 3 ++- tools/{ => windows}/makeiso.ps1 | 3 ++- tools/{ => windows}/splashshot.ps1 | 3 ++- tools/{ => windows}/textshot.ps1 | 3 ++- tools/{ => windows}/ttyshot.ps1 | 3 ++- 26 files changed, 127 insertions(+), 39 deletions(-) rename tools/{ => posix}/memory-sync.sh (90%) rename tools/{ => posix}/mkiso.sh (98%) rename tools/{ => posix}/mktree.sh (100%) rename tools/{ => posix}/mutate.sh (100%) rename tools/{ => posix}/schfs_roundtrip.sh (81%) rename tools/{ => posix}/sha256check.sh (100%) rename tools/{ => python}/crashqr.py (100%) rename tools/{ => python}/mklogo.py (100%) rename tools/{ => python}/qrcheck.py (100%) rename tools/{ => windows}/bootcheck.ps1 (99%) rename tools/{ => windows}/crashshot.ps1 (97%) rename tools/{ => windows}/dispshot.ps1 (97%) rename tools/{ => windows}/fbshot.ps1 (97%) rename tools/{ => windows}/loc.ps1 (98%) rename tools/{ => windows}/makeiso.ps1 (98%) rename tools/{ => windows}/splashshot.ps1 (98%) rename tools/{ => windows}/textshot.ps1 (97%) rename tools/{ => windows}/ttyshot.ps1 (97%) diff --git a/Makefile b/Makefile index 9f84b08..599116d 100644 --- a/Makefile +++ b/Makefile @@ -366,7 +366,7 @@ iso: $(MAKE) RAMROOT=1 schos.iso schos.iso: $(BUILD)/boot/cdboot $(BUILD)/boot/stage2 $(BUILD)/kernel/kernel - STAGE2_SECTORS=$(STAGE2_SECTORS) sh tools/mkiso.sh $@ + STAGE2_SECTORS=$(STAGE2_SECTORS) sh tools/posix/mkiso.sh $@ # Boot the ISO the way a machine booting off a disc would: no hard disk at # all, so a kernel that still secretly depends on one fails here rather than @@ -644,7 +644,7 @@ schfs-fsck: $(SCHFS_FSCK) # the *filesystem* matches a tree that exists independently of it, so a writer # and reader that agree on something wrong are still caught. schfs-image-test: $(MKSCHFS) $(SCHFS_FSCK) - @sh tools/schfs_roundtrip.sh $(MKSCHFS) $(SCHFS_FSCK) + @sh tools/posix/schfs_roundtrip.sh $(MKSCHFS) $(SCHFS_FSCK) # Every SchFS suite. Run this after touching anything under kernel/fs/schfs. schfs-check: schfs-test schfs-objtest schfs-image-test @@ -655,7 +655,7 @@ schfs-check: schfs-test schfs-objtest schfs-image-test # the system, which is exactly why it rots. This makes "does it still render" # a question with a thirty-second answer. Needs a ramroot build first. crashshot: - pwsh -File tools/crashshot.ps1 + pwsh -File tools/windows/crashshot.ps1 # Read the QR code back off a captured crash screen. End-to-end on purpose: it # reads the pixels that were painted, so payload construction in panic context, @@ -663,7 +663,7 @@ crashshot: # text comes back. Run `make crashshot` first. Needs the same Python packages # as `qrcheck`. crashqr: - $(PYTHON) tools/crashqr.py + $(PYTHON) tools/python/crashqr.py $(MKFS): tools/mkfs.c include/fs.h include/stat.h include/param.h @mkdir -p $(BUILD)/tools @@ -773,7 +773,7 @@ LOGO_SRC = Assets/SchOS Small Logo.png LOGO_PX = 128 logo: - $(PYTHON) tools/mklogo.py "$(LOGO_SRC)" include/logo.h $(LOGO_PX) + $(PYTHON) tools/python/mklogo.py "$(LOGO_SRC)" include/logo.h $(LOGO_PX) # The USB vendor/product name database, from linux-usb.org. # @@ -826,7 +826,7 @@ qrtest: $(QRTEST) # pip install --target build/pylibs opencv-python-headless numpy segno # PYTHONPATH=build/pylibs make qrcheck qrcheck: $(QRTEST) - $(PYTHON) tools/qrcheck.py + $(PYTHON) tools/python/qrcheck.py .PHONY: all kernel ramroot cmd ports sysroot-install qemu \ schfs-test schfs-objtest schfs-image-test schfs-check mkschfs \ diff --git a/docs/architecture/kernel-history.md b/docs/architecture/kernel-history.md index 7d71ba2..f5425af 100644 --- a/docs/architecture/kernel-history.md +++ b/docs/architecture/kernel-history.md @@ -483,7 +483,7 @@ the user is looking at. That single fact is most of what separates a hobby project from a product; every shipping system puts that behind a flag. `cons_serial_only` already existed for panic, so the fix was to start it *set*. -Everything still goes out the UART — which is where `tools/bootcheck.ps1` reads +Everything still goes out the UART — which is where `tools/windows/bootcheck.ps1` reads it from, so all five suites kept passing untouched — and `console_takeover()` clears it on the first `exec()`, the moment userspace genuinely starts. `vga_init` no longer clears the screen, so the splash survives the whole of diff --git a/docs/architecture/schfs.md b/docs/architecture/schfs.md index c0bd69d..dd9be51 100644 --- a/docs/architecture/schfs.md +++ b/docs/architecture/schfs.md @@ -324,9 +324,9 @@ tools/mkschfs.c build an image from a directory tree tools/schfs_fsck.c verify, list, extract tools/schfs_test.c B-tree torture harness tools/schfs_objtest.c object layer: files, directories, space accounting -tools/schfs_roundtrip.sh end-to-end filesystem test -tools/mutate.sh mutation-tests the suites themselves -tools/bootcheck.ps1 boots under QEMU and drives the shell +tools/posix/schfs_roundtrip.sh end-to-end filesystem test +tools/posix/mutate.sh mutation-tests the suites themselves +tools/windows/bootcheck.ps1 boots under QEMU and drives the shell ``` Everything except `kmount.c` is compiled *both* into the kernel and into the @@ -357,7 +357,7 @@ is the least glamorous: after deleting everything, free space must be back to exactly what it was on an empty volume. Every other test in the suite still passes on a filesystem that leaks a block on every delete. -`tools/mutate.sh` injects six deliberate bugs and fails if any of them goes +`tools/posix/mutate.sh` injects six deliberate bugs and fails if any of them goes undetected. It is how the suites are kept honest; see the note in §9. ### Verifying on real hardware diff --git a/docs/building.md b/docs/building.md index 72c18e9..c1374ce 100644 --- a/docs/building.md +++ b/docs/building.md @@ -46,9 +46,9 @@ make USE_GNU=1 TOOLPREFIX=x86_64-elf- ## Testing ```sh -tools/bootcheck.ps1 # boots, drives the shell, asserts on output -tools/bootcheck.ps1 -Tty -Ps # plus terminal behaviour and process listing -make schfs-check # SchFS unit, object and image suites +tools/windows/bootcheck.ps1 # boots, drives the shell, asserts on output +tools/windows/bootcheck.ps1 -Tty -Ps # plus terminal behaviour and process listing +make schfs-check # SchFS unit, object and image suites ``` `bootcheck` is PowerShell, and PowerShell 7 (`pwsh`) runs on Linux, macOS and @@ -67,6 +67,27 @@ not work on a Windows host** — `make` prints `ports: skipped` and uses whateve is already staged in `sysroot/`. Building them needs a Linux host (or any other Unix); do it once and the staged result serves the Windows builds. +## Where the tools live + +`tools/` is grouped by what runs the file, so it is obvious at a glance which +tools a given host can use: + +``` +tools/ + windows/ .ps1 PowerShell (pwsh runs these on Linux and macOS too) + posix/ .sh shell + python/ .py + *.c host programs -- compiled by the build, run everywhere + *.pl perl, likewise +``` + +The `.c` and `.pl` files stay at the top level because they are not +host-specific: the build compiles or invokes them on every platform. + +A script that needs the repo root derives it from its own location, so anything +moved between these directories has to have that adjusted — the PowerShell tools +use `Split-Path (Split-Path $PSScriptRoot -Parent) -Parent`, two levels up. + ## Known host differences, already handled Listed because they are the shape of the next such bug, not because anything is @@ -75,7 +96,7 @@ outstanding: - `` is glibc/musl only. macOS and the BSDs take `major()` and `minor()` from ``. - `sha256sum` exists on Linux and Git Bash; macOS has `shasum -a 256`, - FreeBSD/NetBSD `sha256`, OpenBSD `cksum -a sha256`. `tools/sha256check.sh` + FreeBSD/NetBSD `sha256`, OpenBSD `cksum -a sha256`. `tools/posix/sha256check.sh` finds whichever is present. - `nproc` is coreutils, so absent on macOS and BSD, where it is `sysctl -n hw.ncpu`. @@ -88,7 +109,7 @@ outstanding: Claude Code's project memory is kept in the repo and moved with: ```sh -tools/memory-sync.sh status -tools/memory-sync.sh export # after a session that learned something; then commit -tools/memory-sync.sh import # after cloning or pulling elsewhere +tools/posix/memory-sync.sh status +tools/posix/memory-sync.sh export # after a session that learned something; then commit +tools/posix/memory-sync.sh import # after cloning or pulling elsewhere ``` diff --git a/docs/layout.md b/docs/layout.md index 3f9b67e..9e1c3b0 100644 --- a/docs/layout.md +++ b/docs/layout.md @@ -26,7 +26,7 @@ schos/ │ suites, sign.pl, vectors.pl, and the PowerShell harnesses. │ Their binaries build into build/tools/ -- this directory │ used to hold both, which is the one rule this layout has. -│ tools/loc.ps1 counts how much of the tree is first-party. +│ tools/windows/loc.ps1 counts how much of the tree is first-party. ├─ sysroot/ Staging for the disk image. etc/ is hand-maintained; │ bin/ lib/ sbin/ are populated by `make sysroot-install`. ├─ dist/ Upstream tarball cache. Survives `make clean`. @@ -156,7 +156,7 @@ match or the kernel fails to link. **`STAGE2_SECTORS` now lives in exactly one place: the root `Makefile`.** It used to be written out by hand in five — `boot/bootasm.S`, `boot/stage2main.c`'s -`readseg()`, the `dd ... seek=` offset, and twice more inside `tools/mkiso.sh` +`readseg()`, the `dd ... seek=` offset, and twice more inside `tools/posix/mkiso.sh` (its stage2 size assertion and `-boot-load-size`). This note used to warn you to keep three of them in step and did not know about the other two. diff --git a/docs/roadmap.md b/docs/roadmap.md index b7f92ce..deb504d 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -281,13 +281,13 @@ into `sysroot/`, which is linked into the kernel binary for a ramdisk-root build. That combination is a licensing accident waiting to happen, for a test that was passing every time. -**What replaced it:** `tools/bootcheck.ps1` with its `-Sock`, `-Evdev` and `-Ps` -modes, plus `tools/splashshot.ps1` for the boot path. These are narrower and do +**What replaced it:** `tools/windows/bootcheck.ps1` with its `-Sock`, `-Evdev` and `-Ps` +modes, plus `tools/windows/splashshot.ps1` for the boot path. These are narrower and do not prove the whole stack composes, which is the honest cost of the removal. **The lesson worth keeping** is the shape of the test, not the program: the next full-stack test should be something large that we did not write, driven to a -real pixel-level assertion rather than a log line. `tools/splashshot.ps1`'s +real pixel-level assertion rather than a log line. `tools/windows/splashshot.ps1`'s colour counting exists because a log-only harness once passed on a blank screen. ### Phase 8 — The system layer: `schinit`, firmware, and a crash channel diff --git a/ports/mk/port.mk b/ports/mk/port.mk index 52c666b..c13ddd2 100644 --- a/ports/mk/port.mk +++ b/ports/mk/port.mk @@ -26,7 +26,7 @@ BUILDROOT := $(TOPDIR)/build/ports # Verifying a downloaded tarball. Not `sha256sum -c -`: that command does not # exist on macOS or the BSDs, and each of them spells it differently. The # helper picks whichever of the five possibilities the host actually has. -SHA256CHECK := $(TOPDIR)/tools/sha256check.sh +SHA256CHECK := $(TOPDIR)/tools/posix/sha256check.sh # Port name is the directory name — no per-port boilerplate needed. PORT := $(notdir $(CURDIR)) diff --git a/tools/memory-sync.sh b/tools/posix/memory-sync.sh similarity index 90% rename from tools/memory-sync.sh rename to tools/posix/memory-sync.sh index d7eb1ec..1ad3da1 100644 --- a/tools/memory-sync.sh +++ b/tools/posix/memory-sync.sh @@ -1,9 +1,9 @@ #!/bin/sh # Move Claude Code's project memory between this repo and the local machine. # -# tools/memory-sync.sh export memory on this machine -> .claude/memory/ -# tools/memory-sync.sh import .claude/memory/ -> this machine -# tools/memory-sync.sh status show both sides, change nothing +# tools/posix/memory-sync.sh export memory on this machine -> .claude/memory/ +# tools/posix/memory-sync.sh import .claude/memory/ -> this machine +# tools/posix/memory-sync.sh status show both sides, change nothing # # Why this exists # --------------- @@ -36,9 +36,9 @@ usage() { [ $# -eq 1 ] || usage -# Repo root: this script lives in tools/, so the parent of its directory. +# Repo root: this script lives in tools/posix/, so two levels up. script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) -repo=$(CDPATH= cd -- "$script_dir/.." && pwd) +repo=$(CDPATH= cd -- "$script_dir/../.." && pwd) repo_mem="$repo/.claude/memory" # The absolute path Claude Code itself sees. Under Git Bash `pwd` gives diff --git a/tools/mkiso.sh b/tools/posix/mkiso.sh similarity index 98% rename from tools/mkiso.sh rename to tools/posix/mkiso.sh index 8562d17..d9d593d 100644 --- a/tools/mkiso.sh +++ b/tools/posix/mkiso.sh @@ -1,7 +1,7 @@ #!/bin/sh # Build a bootable SchOS ISO. # -# tools/mkiso.sh [output.iso] +# tools/posix/mkiso.sh [output.iso] # # The disc boots through El Torito's "no emulation" mode, which is the only # one of the three that fits how SchOS actually loads itself. diff --git a/tools/mktree.sh b/tools/posix/mktree.sh similarity index 100% rename from tools/mktree.sh rename to tools/posix/mktree.sh diff --git a/tools/mutate.sh b/tools/posix/mutate.sh similarity index 100% rename from tools/mutate.sh rename to tools/posix/mutate.sh diff --git a/tools/schfs_roundtrip.sh b/tools/posix/schfs_roundtrip.sh similarity index 81% rename from tools/schfs_roundtrip.sh rename to tools/posix/schfs_roundtrip.sh index 3cffcd7..4f9b706 100644 --- a/tools/schfs_roundtrip.sh +++ b/tools/posix/schfs_roundtrip.sh @@ -32,6 +32,27 @@ TREE=$3 WORK=$(mktemp -d) trap 'rm -rf "$WORK"' EXIT +# Symlinks are load-bearing here, so a host that cannot create them cannot run +# this test at all. +# +# Windows is that host. Git Bash needs developer mode or MSYS=winsymlinks to +# make one, and even where it can, mkschfs's mingw build cannot *see* one -- +# lstat degrades to stat and S_ISLNK is always false, by design and with a +# comment saying so. The round-trip would therefore be comparing a tree with no +# symlinks against an image with no symlinks and calling that a pass, which is +# worse than not running: it is coverage that reports itself as present and is +# not. +# +# Skipping with exit 0 so `make schfs-check` still means something on Windows +# -- the B-tree, object and space suites are all host-independent and do run. +if ! ln -s target "$WORK/.symlink-probe" 2>/dev/null; then + echo "SchFS round-trip: SKIPPED -- this host cannot create symlinks." + echo " The generated tree needs them, and mkschfs cannot see them here" + echo " anyway. Run this on Linux, macOS or BSD for real coverage." + exit 0 +fi +rm -f "$WORK/.symlink-probe" + if [ -z "$TREE" ]; then # Generated by a separate script so the same tree can be rebuilt by hand # when debugging a failure, without running the whole round-trip. diff --git a/tools/sha256check.sh b/tools/posix/sha256check.sh similarity index 100% rename from tools/sha256check.sh rename to tools/posix/sha256check.sh diff --git a/tools/crashqr.py b/tools/python/crashqr.py similarity index 100% rename from tools/crashqr.py rename to tools/python/crashqr.py diff --git a/tools/mklogo.py b/tools/python/mklogo.py similarity index 100% rename from tools/mklogo.py rename to tools/python/mklogo.py diff --git a/tools/qrcheck.py b/tools/python/qrcheck.py similarity index 100% rename from tools/qrcheck.py rename to tools/python/qrcheck.py diff --git a/tools/schfs_fsck.c b/tools/schfs_fsck.c index 824e6cb..72151f4 100644 --- a/tools/schfs_fsck.c +++ b/tools/schfs_fsck.c @@ -32,6 +32,43 @@ #include #include +/* --extract on Windows. + * + * mingw has no POSIX mkdir(path, mode), no symlink() and no link(), because + * Windows has no equivalent that can be created without either a privilege or + * a reparse point. Everything else here -- --info, --check, --ls, --stat, + * --cat, --tree -- is pure reading and works unchanged; it was only --extract + * that would not compile, which took the whole tool with it and with it + * `make schfs-check`. + * + * Directories map cleanly: _mkdir takes no mode, and Windows has no POSIX + * permission bits to apply anyway. Symlinks and hard links do not map, so they + * fail loudly and say why. Silently writing a regular file in their place would + * produce an extracted tree that differs from the image while reporting + * success, which is worse than not extracting at all -- the entire point of + * --extract is comparing the result against what produced it. + */ +#ifdef _WIN32 +#include +#define mkdir(path, mode) _mkdir(path) + +static int symlink(const char *target, const char *path) +{ + (void)target; + fprintf(stderr, "schfs_fsck: %s: cannot create a symlink on Windows\n", path); + errno = ENOSYS; + return -1; +} + +static int link(const char *from, const char *to) +{ + (void)from; + fprintf(stderr, "schfs_fsck: %s: cannot create a hard link on Windows\n", to); + errno = ENOSYS; + return -1; +} +#endif + #include "../kernel/fs/schfs/btree.c" #include "../kernel/fs/schfs/space.c" #include "../kernel/fs/schfs/vol.c" diff --git a/tools/bootcheck.ps1 b/tools/windows/bootcheck.ps1 similarity index 99% rename from tools/bootcheck.ps1 rename to tools/windows/bootcheck.ps1 index ad4f3ca..4dc2d42 100644 --- a/tools/bootcheck.ps1 +++ b/tools/windows/bootcheck.ps1 @@ -76,7 +76,8 @@ function Find-Qemu { } $ErrorActionPreference = 'Stop' -$root = Split-Path $PSScriptRoot -Parent +# Repo root is two levels up: this script lives in tools/windows/. +$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent $hda = Join-Path $root 'schos.img' # The root filesystem. SchFS is the only root there is, so this is not a # choice -- a kernel handed anything else on device 1 panics in forkret(). diff --git a/tools/crashshot.ps1 b/tools/windows/crashshot.ps1 similarity index 97% rename from tools/crashshot.ps1 rename to tools/windows/crashshot.ps1 index 0a5d13e..ce8b847 100644 --- a/tools/crashshot.ps1 +++ b/tools/windows/crashshot.ps1 @@ -41,7 +41,8 @@ function Find-Qemu { } $ErrorActionPreference = 'Stop' -$root = Split-Path $PSScriptRoot -Parent +# Repo root is two levels up: this script lives in tools/windows/. +$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent $hda = Join-Path $root 'schos.img' # The root filesystem. SchFS is the only root there is: the kernel mounts # device 1 in forkret() and panics if it is not a SchFS volume, so this is diff --git a/tools/dispshot.ps1 b/tools/windows/dispshot.ps1 similarity index 97% rename from tools/dispshot.ps1 rename to tools/windows/dispshot.ps1 index cd70308..e1884c3 100644 --- a/tools/dispshot.ps1 +++ b/tools/windows/dispshot.ps1 @@ -46,7 +46,8 @@ function Find-Qemu { } $ErrorActionPreference = 'Stop' -$root = Split-Path $PSScriptRoot -Parent +# Repo root is two levels up: this script lives in tools/windows/. +$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent $hda = Join-Path $root 'schos.img' # The root filesystem. SchFS is the only root there is: the kernel mounts # device 1 in forkret() and panics if it is not a SchFS volume, so this is diff --git a/tools/fbshot.ps1 b/tools/windows/fbshot.ps1 similarity index 97% rename from tools/fbshot.ps1 rename to tools/windows/fbshot.ps1 index 13d23d5..2999503 100644 --- a/tools/fbshot.ps1 +++ b/tools/windows/fbshot.ps1 @@ -40,7 +40,8 @@ function Find-Qemu { } $ErrorActionPreference = 'Stop' -$root = Split-Path $PSScriptRoot -Parent +# Repo root is two levels up: this script lives in tools/windows/. +$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent $hda = Join-Path $root 'schos.img' # The root filesystem. SchFS is the only root there is: the kernel mounts # device 1 in forkret() and panics if it is not a SchFS volume, so this is diff --git a/tools/loc.ps1 b/tools/windows/loc.ps1 similarity index 98% rename from tools/loc.ps1 rename to tools/windows/loc.ps1 index e0de76a..f9d1287 100644 --- a/tools/loc.ps1 +++ b/tools/windows/loc.ps1 @@ -22,7 +22,8 @@ param( ) $ErrorActionPreference = 'Stop' -$root = Split-Path $PSScriptRoot -Parent +# Repo root is two levels up: this script lives in tools/windows/. +$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent # What counts as ours. Everything else in the tree is either somebody else's # source or generated output, and mixing either in makes the total meaningless. diff --git a/tools/makeiso.ps1 b/tools/windows/makeiso.ps1 similarity index 98% rename from tools/makeiso.ps1 rename to tools/windows/makeiso.ps1 index 78d0a28..23423c6 100644 --- a/tools/makeiso.ps1 +++ b/tools/windows/makeiso.ps1 @@ -41,7 +41,8 @@ function Find-Qemu { } $ErrorActionPreference = 'Stop' -$root = Split-Path $PSScriptRoot -Parent +# Repo root is two levels up: this script lives in tools/windows/. +$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent Push-Location $root function Fail($msg) { diff --git a/tools/splashshot.ps1 b/tools/windows/splashshot.ps1 similarity index 98% rename from tools/splashshot.ps1 rename to tools/windows/splashshot.ps1 index 7546d01..c697ea7 100644 --- a/tools/splashshot.ps1 +++ b/tools/windows/splashshot.ps1 @@ -44,7 +44,8 @@ function Find-Qemu { } $ErrorActionPreference = 'Stop' -$root = Split-Path $PSScriptRoot -Parent +# Repo root is two levels up: this script lives in tools/windows/. +$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent $log = Join-Path $root 'build/splashshot.log' $dir = Join-Path $root $OutDir diff --git a/tools/textshot.ps1 b/tools/windows/textshot.ps1 similarity index 97% rename from tools/textshot.ps1 rename to tools/windows/textshot.ps1 index 3de8286..b178eba 100644 --- a/tools/textshot.ps1 +++ b/tools/windows/textshot.ps1 @@ -46,7 +46,8 @@ function Find-Qemu { } $ErrorActionPreference = 'Stop' -$root = Split-Path $PSScriptRoot -Parent +# Repo root is two levels up: this script lives in tools/windows/. +$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent $hda = Join-Path $root 'schos.img' # The root filesystem. SchFS is the only root there is: the kernel mounts # device 1 in forkret() and panics if it is not a SchFS volume, so this is diff --git a/tools/ttyshot.ps1 b/tools/windows/ttyshot.ps1 similarity index 97% rename from tools/ttyshot.ps1 rename to tools/windows/ttyshot.ps1 index a2a0483..155f564 100644 --- a/tools/ttyshot.ps1 +++ b/tools/windows/ttyshot.ps1 @@ -39,7 +39,8 @@ function Find-Qemu { } $ErrorActionPreference = 'Stop' -$root = Split-Path $PSScriptRoot -Parent +# Repo root is two levels up: this script lives in tools/windows/. +$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent $hda = Join-Path $root 'schos.img' # The root filesystem. SchFS is the only root there is: the kernel mounts # device 1 in forkret() and panics if it is not a SchFS volume, so this is