Revert "The Final Kachow"

This reverts commit 8098b9fa53.
This commit is contained in:
firestar5683
2026-07-14 11:25:31 -05:00
parent 8098b9fa53
commit ca09e50081
6 changed files with 11 additions and 196 deletions
+3 -3
View File
@@ -2,7 +2,7 @@
set -euo pipefail
HOST="${1:-comma@192.168.3.110}"
IMAGE="${2:-/Users/dominickthompson/Desktop/system6.img.xz}"
IMAGE="${2:-/Users/dominickthompson/Desktop/system-23280e1073340afe23452627a53269fbdad7251620f722df502de1a071ffd88b.img.xz}"
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd -- "${SCRIPT_DIR}/../.." && pwd)"
@@ -16,8 +16,8 @@ REMOTE_RUNNER="${REMOTE_DIR}/run_flash.sh"
REMOTE_AGNOS="${REMOTE_DIR}/agnos.py"
PORT="8989"
EXPECTED_VERSION="12.8.26"
RAW_HASH="b0dac4105bf4e5cc72dd1e1da6a4482607f8bd5cd59815ead87a942d42cc1f9c"
EXPECTED_VERSION="12.8.25"
RAW_HASH="23280e1073340afe23452627a53269fbdad7251620f722df502de1a071ffd88b"
RAW_SIZE="5368709120"
if [[ ! -f "$IMAGE" ]]; then
+4 -81
View File
@@ -38,7 +38,6 @@ SETUP_WIFI_PATCH_MARKER = "JEEPNY_AVAILABLE = True"
SETUP_BRANDING_PATCH_MARKER = "STARPILOT_SETUP_BRANDING_V1"
SETUP_SSH_RESTORE_PATCH_MARKER = "STARPILOT_SETUP_SSH_RESTORE_V1"
WESTON_BG_PATCH_MARKER = "STARPILOT_WESTON_BG_ORIENTATION_V2"
COMMA_SH_DISPLAY_WAIT_PATCH_MARKER = "STARPILOT_DISPLAY_READY_WAIT_V1"
JEEPNY_VERSION = "0.9.0"
JEEPNY_WHEEL_URL = "https://files.pythonhosted.org/packages/b2/a3/e137168c9c44d18eff0376253da9f1e9234d0239e0ee230d2fee6cea8e55/jeepney-0.9.0-py3-none-any.whl"
JEEPNY_WHEEL_SHA256 = "97e5714520c16fc0a45695e5365a2e11b81ea79bba796e26f9f1d178cb182683"
@@ -156,62 +155,6 @@ def patched_weston_bg_exec_line() -> str:
return f"ExecStartPre=/bin/bash -c \"/usr/local/venv/bin/python -c '{python_cmd}'\""
def patch_comma_sh_display_wait(original: bytes) -> bytes:
text = original.decode("utf-8")
if COMMA_SH_DISPLAY_WAIT_PATCH_MARKER in text:
return original
old = """echo "waiting for magic"
for i in {1..200}; do
if systemctl is-active --quiet magic && [ -S /tmp/drmfd.sock ]; then
break
fi
sleep 0.1
done
if systemctl is-active --quiet magic && [ -S /tmp/drmfd.sock ]; then
echo "magic ready after ${SECONDS}s"
else
echo "timed out waiting for magic, ${SECONDS}s"
fi
"""
new = f"""# {COMMA_SH_DISPLAY_WAIT_PATCH_MARKER}
if systemctl cat magic.service >/dev/null 2>&1; then
echo "waiting for magic"
for i in {{1..200}}; do
if systemctl is-active --quiet magic && [ -S /tmp/drmfd.sock ]; then
break
fi
sleep 0.1
done
if systemctl is-active --quiet magic && [ -S /tmp/drmfd.sock ]; then
echo "magic ready after ${{SECONDS}}s"
else
echo "timed out waiting for magic, ${{SECONDS}}s"
fi
else
echo "magic unavailable; waiting for weston"
for i in {{1..200}}; do
if systemctl is-active --quiet weston-ready && [ -S /var/tmp/weston/wayland-0 ]; then
break
fi
sleep 0.1
done
if systemctl is-active --quiet weston-ready && [ -S /var/tmp/weston/wayland-0 ]; then
echo "weston ready after ${{SECONDS}}s"
else
echo "timed out waiting for weston, ${{SECONDS}}s"
fi
fi
"""
if old not in text:
raise RuntimeError("Unable to find comma.sh display readiness wait")
return text.replace(old, new, 1).encode("utf-8")
def patch_weston_service(original: bytes) -> bytes:
text = original.decode("utf-8")
if WESTON_BG_PATCH_MARKER in text:
@@ -821,15 +764,6 @@ def weston_service_has_expected_content(data: bytes) -> bool:
)
def comma_sh_has_expected_display_wait(data: bytes) -> bool:
return (
COMMA_SH_DISPLAY_WAIT_PATCH_MARKER.encode("utf-8") in data
and b"systemctl cat magic.service" in data
and b"systemctl is-active --quiet weston-ready" in data
and b"[ -S /var/tmp/weston/wayland-0 ]" in data
)
def parse_inode(debugfs_output: str) -> int:
m = re.search(r"Inode:\s+(\d+)", debugfs_output)
if not m:
@@ -1139,12 +1073,12 @@ def main() -> int:
MAGIC_PATH_IN_IMAGE: "comma_magic",
BG_PATH_IN_IMAGE: "comma_bg",
}
expected_hashes: dict[str, str] = {}
preserved_hashes: dict[str, str] = {}
for image_path, label in preserved_paths.items():
preserved_file = work_dir / f"{label}.preserved"
print(f"Recording existing {image_path} for preservation", flush=True)
run_debugfs(debugfs, patched_img, f"dump -p {image_path} {preserved_file}", write=False)
expected_hashes[image_path] = sha256_file(preserved_file)
preserved_hashes[image_path] = sha256_file(preserved_file)
original_updater = work_dir / "comma_updater.orig"
patched_updater = work_dir / "comma_updater.patched"
@@ -1152,15 +1086,6 @@ def main() -> int:
original_weston = work_dir / "weston_service.orig"
patched_weston = work_dir / "weston_service.patched"
verify_weston = work_dir / "weston_service.verify"
patched_comma_sh = work_dir / "comma_sh.patched"
original_comma_sh = work_dir / "comma_sh.preserved"
comma_sh_patched_data = patch_comma_sh_display_wait(original_comma_sh.read_bytes())
patched_comma_sh.write_bytes(comma_sh_patched_data)
print("Writing patched /usr/comma/comma.sh display readiness wait", flush=True)
write_regular_file_to_image(debugfs, patched_img, COMMA_SH_PATH_IN_IMAGE, patched_comma_sh, "100775", 0, 0)
expected_hashes[COMMA_SH_PATH_IN_IMAGE] = sha256_file(patched_comma_sh)
print("Extracting weston.service from image", flush=True)
run_debugfs(debugfs, patched_img, f"dump -p {WESTON_SERVICE_PATH_IN_IMAGE} {original_weston}", write=False)
@@ -1203,10 +1128,8 @@ def main() -> int:
for image_path, label in preserved_paths.items():
verify_file = work_dir / f"{label}.verify"
run_debugfs(debugfs, patched_img, f"dump -p {image_path} {verify_file}", write=False)
if image_path == COMMA_SH_PATH_IN_IMAGE and not comma_sh_has_expected_display_wait(verify_file.read_bytes()):
raise RuntimeError("comma.sh display readiness verification failed")
if sha256_file(verify_file) != expected_hashes[image_path]:
raise RuntimeError(f"{image_path} does not match the expected generated payload")
if sha256_file(verify_file) != preserved_hashes[image_path]:
raise RuntimeError(f"{image_path} changed unexpectedly; protected StarPilot payload files must stay byte-identical")
if args.set_version:
version_file = work_dir / "VERSION.patched"
-65
View File
@@ -1,65 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
HOST="${1:-comma@192.168.3.110}"
SSH_OPTS=(-o BatchMode=yes -o ConnectTimeout=5)
if [[ -n "${SSH_KEY:-}" ]]; then
SSH_OPTS+=(-i "$SSH_KEY" -o IdentitiesOnly=yes)
fi
ssh "${SSH_OPTS[@]}" "$HOST" 'bash -s' <<'REMOTE_SCRIPT'
set -u
echo "===== Device ====="
printf "AGNOS: "
cat /VERSION
printf "Model: "
tr -d '\000' </sys/firmware/devicetree/base/model
printf '\nUptime: '
cut -d' ' -f1 /proc/uptime
echo
echo "===== Boot Summary ====="
systemd-analyze time
echo
echo "===== Slowest Units ====="
systemd-analyze blame | head -n 20
echo
echo "===== Critical Chain ====="
systemd-analyze critical-chain graphical.target
echo
echo "===== Display Startup ====="
systemctl show comma.service weston.service weston-ready.service magic.service \
-p Id -p LoadState -p ActiveState -p ActiveEnterTimestampMonotonic \
-p ExecMainStartTimestampMonotonic -p ExecMainExitTimestampMonotonic --no-pager
if systemctl cat magic.service >/dev/null 2>&1; then
echo "Display path: magic.service"
else
echo "Display path: weston fallback (magic.service is not installed)"
fi
for socket_path in /tmp/drmfd.sock /var/tmp/weston/wayland-0; do
if [[ -S "$socket_path" ]]; then
echo "$socket_path: ready"
else
echo "$socket_path: missing"
fi
done
echo
echo "===== comma.sh Readiness Logic ====="
if grep -q STARPILOT_DISPLAY_READY_WAIT_V1 /usr/comma/comma.sh; then
sed -n '/STARPILOT_DISPLAY_READY_WAIT_V1/,+50p' /usr/comma/comma.sh
else
sed -n '/waiting for magic/,+20p' /usr/comma/comma.sh
if ! systemctl cat magic.service >/dev/null 2>&1; then
echo "WARNING: comma.sh waits 20 seconds for a service that is not installed"
fi
fi
REMOTE_SCRIPT
@@ -1,43 +0,0 @@
import pytest
from tools.agnos.patch_system_reset_image import (
COMMA_SH_DISPLAY_WAIT_PATCH_MARKER,
comma_sh_has_expected_display_wait,
patch_comma_sh_display_wait,
)
ORIGINAL_DISPLAY_WAIT = b'''#!/usr/bin/env bash
echo "waiting for magic"
for i in {1..200}; do
if systemctl is-active --quiet magic && [ -S /tmp/drmfd.sock ]; then
break
fi
sleep 0.1
done
if systemctl is-active --quiet magic && [ -S /tmp/drmfd.sock ]; then
echo "magic ready after ${SECONDS}s"
else
echo "timed out waiting for magic, ${SECONDS}s"
fi
exec /data/continue.sh
'''
def test_patch_comma_sh_display_wait_uses_available_display_service():
patched = patch_comma_sh_display_wait(ORIGINAL_DISPLAY_WAIT)
assert COMMA_SH_DISPLAY_WAIT_PATCH_MARKER.encode() in patched
assert b"systemctl cat magic.service" in patched
assert b"systemctl is-active --quiet magic" in patched
assert b"systemctl is-active --quiet weston-ready" in patched
assert b"[ -S /var/tmp/weston/wayland-0 ]" in patched
assert comma_sh_has_expected_display_wait(patched)
assert patch_comma_sh_display_wait(patched) == patched
def test_patch_comma_sh_display_wait_rejects_unknown_layout():
with pytest.raises(RuntimeError, match="display readiness wait"):
patch_comma_sh_display_wait(b"#!/usr/bin/env bash\nexec /data/continue.sh\n")