metronome/hardware/eda/run.sh
Me Here bcfa5dd7f0 PM_K-1 hardware: reproducible EDA container (KiCad 9 + ngspice)
Pinned toolchain under hardware/eda/ so the design can be checked/simulated
identically in the future (system KiCad is 7.0, which has no CLI ERC):
- Containerfile: Ubuntu 24.04 + KiCad 9 (PPA) + ngspice + python3.
- run.sh: build-if-needed + run with the repo mounted; lands in hardware/kicad.
- sim/input_loading.cir: ngspice deck proving the line(25k) vs instrument(1M)
  input-loading decision — Hi-Z preserves a +16dB pickup resonance the 25k load
  flattens to -3dB.

Verified: KiCad 9.0.9, ngspice-42, ERC runs clean (0 violations) on
pm_k1_core.kicad_sch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-30 19:17:54 -05:00

24 lines
921 B
Bash
Executable file

#!/usr/bin/env bash
# Build (first time) and run the PM_K-1 EDA container with the repo mounted.
#
# ./run.sh # interactive shell in hardware/kicad/
# ./run.sh kicad-cli sch erc pm_k1_core.kicad_sch
# ./run.sh ngspice -b sim/some.cir
#
# Override the runtime with RUNTIME=docker ./run.sh ...
set -euo pipefail
IMG="pmk1-eda:9.0"
EDA_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # hardware/eda
REPO_DIR="$(cd "$EDA_DIR/../.." && pwd)" # repo root
RUNTIME="${RUNTIME:-podman}"
if ! "$RUNTIME" image inspect "$IMG" >/dev/null 2>&1; then
echo ">> building $IMG (first run, a few minutes)…" >&2
"$RUNTIME" build -t "$IMG" "$EDA_DIR"
fi
# Mount the whole repo so KiCad/ngspice see hardware/ ; land in hardware/kicad.
flags=(--rm -v "$REPO_DIR":/work:Z -w /work/hardware/kicad)
[[ -t 0 && $# -eq 0 ]] && flags+=(-it)
exec "$RUNTIME" run "${flags[@]}" "$IMG" "${@:-bash}"