Files
shturman/lima/shturman.yaml
T
kk0t9 586ba29821 feat(v0.3): lima/E2E блок power-safe (N циклов + abort + power-cut)
P7.4: lima/run.sh раскладывают watchdog (system.conf.d) + savetime.service/.timer.
run.sh блок power-safe: N=3 цикла зажигания (ACC-off→ShutdownImminent→stop stage1→
umount/remount /data→restart; маркер+счётчик целы), abort до PONR (re-power→
ShutdownAborted, /data RW), power-cut-сим (SIGKILL до fsync→fsck clean, night present),
watchdog/savetime конфиг. shellcheck чист.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Alexander <akotenev2003@gmail.com>
2026-06-24 23:20:33 +03:00

87 lines
4.7 KiB
YAML

# Lima-шаблон Штурмана: ARM64 Ubuntu, нативно к таргету RK3588 (dev-environment).
# Подъём: just vm-up. Сборка/деплой/E2E — just run / just e2e (внутри VM). Валидируется в части 2 Плана 5.
vmType: vz
cpus: 4
memory: "6GiB"
disk: "20GiB"
images:
- location: "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-arm64.img"
arch: "aarch64"
mounts:
# репозиторий (writable). location — под свою раскладку; в гостье — /shturman.
- location: "~/GitHub/shturman"
mountPoint: "/shturman"
writable: true
provision:
# OS-база (root). Бинари/юниты-старт — в just run/e2e (бинарей ещё нет на этом шаге).
- mode: system
script: |
#!/bin/bash
set -eux
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y \
dbus pipewire wireplumber weston \
can-utils python3 python3-venv \
systemd-zram-generator systemd-oomd fake-hwclock \
fonts-dejavu-core fonts-noto-core \
build-essential pkg-config curl \
libfontconfig1-dev libxkbcommon-dev libwayland-dev
# zram/vcan-модули не входят в базовый vz-образ Lima → доустановить linux-modules-extra
# (иначе zram-generator падает). vcan всё равно может отсутствовать — честная VM↔HW-граница.
apt-get install -y "linux-modules-extra-$(uname -r)" || true
# vcan (для Vehicle Simulator, v2 — поднимаем заранее для воспроизводимости)
modprobe vcan || true
ip link add dev vcan0 type vcan 2>/dev/null || true
ip link set up vcan0 || true
# loopback /data (ext4, power-safe) + data.mount
mkdir -p /var/lib/shturman
if [ ! -f /var/lib/shturman/data.img ]; then
truncate -s 1G /var/lib/shturman/data.img
mkfs.ext4 -q -L shturman-data /var/lib/shturman/data.img
fi
# systemd-юниты + конфиги из репозитория (зонтик + 3 фазовых таргета; *.service ловит splash/warmup)
install -m644 /shturman/systemd/shturman.target /etc/systemd/system/
install -m644 /shturman/systemd/shturman-stage0.target /shturman/systemd/shturman-stage1.target /shturman/systemd/shturman-stage2.target /etc/systemd/system/
install -m644 /shturman/systemd/data.mount /etc/systemd/system/
install -m644 /shturman/systemd/shturman-*.service /etc/systemd/system/
install -d /etc/dbus-1/system.d
install -m644 /shturman/systemd/dbus/ru.shturman.conf /etc/dbus-1/system.d/
install -d /etc/systemd/journald.conf.d
install -m644 /shturman/systemd/journald-shturman.conf /etc/systemd/journald.conf.d/shturman.conf
install -m644 /shturman/systemd/zram-generator.conf /etc/systemd/zram-generator.conf
install -d /etc/systemd/oomd.conf.d
install -m644 /shturman/systemd/oomd-shturman.conf /etc/systemd/oomd.conf.d/shturman.conf
# /run/shturman (кадры/маркеры, volatile) — tmpfiles на boot
install -d /etc/tmpfiles.d
install -m644 /shturman/systemd/tmpfiles-shturman.conf /etc/tmpfiles.d/shturman.conf
systemd-tmpfiles --create /etc/tmpfiles.d/shturman.conf || true
# watchdog (B05/A14, system.conf.d) + save-time .timer (B07; .service ловит *.service glob выше)
install -d /etc/systemd/system.conf.d
install -m644 /shturman/systemd/watchdog-shturman.conf /etc/systemd/system.conf.d/shturman-watchdog.conf
install -m644 /shturman/systemd/shturman-savetime.timer /etc/systemd/system/
# fake-hwclock → /data (не на rootfs; A07/A11). Сервис в Lima masked (Lima сам синхронит время) —
# на HW он размаскирован и читает FILE из /etc/default/fake-hwclock через EnvironmentFile.
echo 'FILE=/data/state/fake-hwclock.data' > /etc/default/fake-hwclock || true
rm -f /etc/fake-hwclock.data || true # стоковый файл на rootfs — A11: персист только в /data
systemctl daemon-reload
systemctl enable --now systemd-oomd.service || true # защита critical set от OOM (A09); политика — oomd.conf.d
# shturman.target включаем, но НЕ стартуем здесь — бинарей ещё нет (just run/e2e).
systemctl enable shturman.target || true
# Rust-тулчейн (user)
- mode: user
script: |
#!/bin/bash
set -eux
command -v cargo >/dev/null || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y