sync: SHANGHAI-U9 2026-08-19 硬编码审计:imx6_app REPO / fpga_ru --host 改读 skills_env.md(新增 SMOD_REPO_ROOT)
This commit is contained in:
@@ -30,6 +30,25 @@ import socket
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
def _env_lookup(key, default=None):
|
||||||
|
"""Machine-relative value: real env var first, then ~/skills_env.md."""
|
||||||
|
v = os.environ.get(key)
|
||||||
|
if v:
|
||||||
|
return v
|
||||||
|
path = os.path.join(os.path.expanduser("~"), "skills_env.md")
|
||||||
|
try:
|
||||||
|
with open(path, encoding="utf-8") as f:
|
||||||
|
for line in f:
|
||||||
|
m = re.match(rf"\s*{key}\s*=\s*(\S+)", line)
|
||||||
|
if m:
|
||||||
|
return m.group(1)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
if default is None:
|
||||||
|
sys.exit(f"missing {key}: add it to ~/skills_env.md or set it as an env var")
|
||||||
|
return default
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------ protocol constants
|
# ------------------------------------------------------------------ protocol constants
|
||||||
|
|
||||||
HEAD, TAIL = 0xAA, 0xBB
|
HEAD, TAIL = 0xAA, 0xBB
|
||||||
@@ -246,7 +265,7 @@ def do_finish(dev, timeout):
|
|||||||
def main():
|
def main():
|
||||||
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||||
ap.add_argument("--mcs", required=True, help="path to the quickboot <tag>_update.mcs")
|
ap.add_argument("--mcs", required=True, help="path to the quickboot <tag>_update.mcs")
|
||||||
ap.add_argument("--host", default="192.168.1.143")
|
ap.add_argument("--host", default=_env_lookup("SMOD_BOARD_IP", "192.168.1.143"))
|
||||||
ap.add_argument("--port", type=int, default=1234)
|
ap.add_argument("--port", type=int, default=1234)
|
||||||
ap.add_argument("--yes", action="store_true", help="skip the confirmation prompt")
|
ap.add_argument("--yes", action="store_true", help="skip the confirmation prompt")
|
||||||
ap.add_argument("--dry-run", action="store_true", help="validate and frame the mcs, contact nothing")
|
ap.add_argument("--dry-run", action="store_true", help="validate and frame the mcs, contact nothing")
|
||||||
|
|||||||
@@ -52,7 +52,10 @@ def _env_lookup(key, default=None):
|
|||||||
return default
|
return default
|
||||||
|
|
||||||
|
|
||||||
REPO = r"E:\Xilinx_design\smod\SMOD_ATSC\my_exciter"
|
# Machine-relative: the exciter checkout lives wherever this box keeps it.
|
||||||
|
# Recorded as SMOD_REPO_ROOT in ~/skills_env.md; the literal stays as the
|
||||||
|
# fallback so existing boxes keep working without touching that file.
|
||||||
|
REPO = _env_lookup("SMOD_REPO_ROOT", r"E:\Xilinx_design\smod\SMOD_ATSC\my_exciter")
|
||||||
APP_SUBDIR = "imx6/src/atsc_app"
|
APP_SUBDIR = "imx6/src/atsc_app"
|
||||||
|
|
||||||
# No default: the VM's IP moves with the VMware segment, so a stale fallback would
|
# No default: the VM's IP moves with the VMware segment, so a stale fallback would
|
||||||
|
|||||||
Reference in New Issue
Block a user