Files
shenlei 530a3690da
Offline project checks / check (push) Canceled after 0s
feat: add WCN3990 Wi-Fi bringup service, battery protection, and bringup automation
- Add phone-dsp.openrc to initialize Hexagon DSP, rmtfs, pd-mapper, and ath10k_snoc
- Update phone-battery-guard threshold to 80% with power supply node fallbacks
- Enhance phone-cellular-setup with battery gate checks, RF locks, and unit tests
- Include bringup, flashing, and inspection automation scripts for platina
- Update candidate IPA v2.6 patches and package locks
2026-11-12 14:54:23 +09:00

88 lines
2.3 KiB
Python

#!/usr/bin/env python3
"""
Clean unmount of /sysroot, trigger pmos_continue_boot, and wait for SSH.
"""
import os
import socket
import subprocess
import sys
import time
TARGET_IP = "172.16.42.1"
SSH_KEY = "/Users/shenlei/Work/sshKey/oracle_tokyo_ARM.key"
def log(msg):
print(f"[{time.strftime('%H:%M:%S')}] {msg}", flush=True)
def telnet_send(cmds):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(5.0)
s.connect((TARGET_IP, 23))
time.sleep(0.3)
try:
s.recv(4096)
except socket.timeout:
pass
for cmd in cmds:
log(f"Telnet: {cmd}")
s.sendall((cmd + "\n").encode("utf-8"))
time.sleep(0.5)
s.close()
def run_ssh(cmd, timeout=15):
ssh_cmd = [
"ssh",
"-o", "StrictHostKeyChecking=no",
"-o", "UserKnownHostsFile=/dev/null",
"-o", "ConnectTimeout=5",
"-i", SSH_KEY,
f"server@{TARGET_IP}",
cmd
]
return subprocess.run(ssh_cmd, capture_output=True, text=True, timeout=timeout)
def main():
log("1. Preparing clean continue boot from initramfs...")
cmds = [
"sync",
"umount /sysroot 2>/dev/null",
"/sbin/pmos_continue_boot"
]
try:
telnet_send(cmds)
log("Triggered pmos_continue_boot successfully!")
except Exception as e:
log(f"Telnet send error (may be expected if telnet died immediately): {e}")
log("2. Waiting for OpenRC userspace boot (watching SSH port 22)...")
start = time.time()
ssh_up = False
while time.time() - start < 60:
# Check if port 22 is responsive
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(1.0)
try:
s.connect((TARGET_IP, 22))
s.close()
log(f"SUCCESS: SSH port 22 is OPEN after {int(time.time() - start)}s!")
ssh_up = True
break
except Exception:
pass
time.sleep(1)
if not ssh_up:
log("ERROR: Timed out waiting for SSH port 22.")
sys.exit(1)
time.sleep(2)
log("3. Testing SSH login...")
res = run_ssh("uname -a; uptime; lsmod; free -m")
log(f"Return code: {res.returncode}")
log(f"STDOUT:\n{res.stdout}")
if res.stderr:
log(f"STDERR:\n{res.stderr}")
if __name__ == "__main__":
main()