From a7e20d807d45f59203952c61afef6e48b8b1e2ed Mon Sep 17 00:00:00 2001 From: Myfro9 <36755290+Myfro9@users.noreply.github.com> Date: Mon, 20 Jul 2026 08:11:51 -0500 Subject: [PATCH] imx6: document VM bootstrap, stop hardcoding the cross-compile VM's IP The VMware segment changed, so the VM moved from 192.168.223.128 to 192.168.154.128 and every hardcoded reference was stale. A freshly-installed VM also has neither sshd nor the toolchain, which previously only surfaced half-way through a modify_imx6 iteration. - fpga-imx6-flow: new "VM prerequisite check" section -- how to detect a missing sshd (Connection refused) and reach the guest over vmrun/VMware Tools when SSH is impossible, plus the Yocto SDK install + ARM-ELF verification step. Records the real gotchas hit during install: unattended-upgrades holding the dpkg lock, EOL xenial repos, and CRLF breaking scripts pushed into the guest. - smod_atsc_dev SKILL/imx6.md: refer to CROSS_VM_HOST/USER/PASS, no literal IP. - imx6_app.py: drop the stale 192.168.223.128 default so a missing CROSS_VM_HOST fails loudly instead of dialing the wrong host. Machine-local values (IP, credentials, vmx/vmrun paths, toolchain prefix) live in ~/skills_env.md, which stays out of git. Co-Authored-By: Claude Opus 4.8 --- fpga-imx6-flow/SKILL.md | 55 ++++++++++++++++++++++++++++--- smod_atsc_dev/SKILL.md | 2 +- smod_atsc_dev/references/imx6.md | 3 +- smod_atsc_dev/scripts/imx6_app.py | 4 ++- 4 files changed, 56 insertions(+), 8 deletions(-) diff --git a/fpga-imx6-flow/SKILL.md b/fpga-imx6-flow/SKILL.md index 073f00b..3489df0 100644 --- a/fpga-imx6-flow/SKILL.md +++ b/fpga-imx6-flow/SKILL.md @@ -139,7 +139,7 @@ it, then resume the **same `--thread-id`** with a JSON payload. Repeat until exi | `meets_requirement` | 符合设计要求? | Judge the analysis against the design requirement | `{"meets": true}` or `{"meets": false}` | | `propose` | 分析原因,提出修改方案 | Diagnose root cause; decide what to change + next program mode | `{"reason":"...","need_fpga": true/false,"need_imx6": true/false,"program_mode":"bitstream"或"flash"}` | | `modify_fpga` | 改 RTL→综合→出 bit/flash | Edit RTL, run Vivado synth/impl, produce bit + flash files | `{"bit_path":"...","flash_path":"...","program_mode":"flash"}` | -| `modify_imx6` | VM 改 app→交叉编译 | In the Ubuntu VM (`bowei@192.168.223.128`) edit app + cross-compile | `{"app_path":"..."}` | +| `modify_imx6` | VM 改 app→交叉编译 | In the Ubuntu VM (`CROSS_VM_USER@CROSS_VM_HOST`, see `~\skills_env.md`) edit app + cross-compile | `{"app_path":"..."}` | Resume command: @@ -196,11 +196,56 @@ push it to the imx6). All of this is **network-based and fast** — no slow seri The old memory "imx6 not reachable over the network" is **outdated**; the mgmt port is reachable. Login: **`root`**, password = `SMOD_SSH_PASS` in `~\skills_env.md`. (The serial console still works too but its login auto-logs-out and is flaky; prefer network SSH for imx6 shell/log reads.) -- **Cross-compile VM: `bowei@192.168.223.128`** (Ubuntu; password = `CROSS_VM_PASS` in - `~\skills_env.md` — read it from there, don't guess/brute-force). Toolchain env-setup: - `/opt/fsl-imx-x11/4.1.15-2.0.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi`. +- **Cross-compile VM (VMware, Ubuntu 16.04.3)**: host/user/password = `CROSS_VM_HOST` / + `CROSS_VM_USER` / `CROSS_VM_PASS` in `~\skills_env.md` — read them from there, don't + guess/brute-force and **don't hardcode the IP** (it moved from `192.168.223.128` to + `192.168.154.128` when the VMware segment changed). Toolchain env-setup: + `CROSS_VM_ENV_SETUP` (currently + `/opt/fsl-imx-x11/4.1.15-2.0.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi`). If VM SSH gives `kex_exchange_identification: Connection closed`, the VM's sshd is down/hung — - ask the user to `sudo systemctl restart sshd`. + `sudo systemctl restart ssh`. If it gives **`Connection refused`**, sshd isn't installed at + all → see *VM prerequisite check* below. + +**VM prerequisite check (do this BEFORE the first cross-compile of a session)** + +A freshly-installed VMware Ubuntu has **neither sshd nor the toolchain**. Check both up +front — discovering it half-way through `modify_imx6` wastes a whole loop iteration: + +```bash +# 1. is sshd even listening? (Connection refused => not installed) +ssh -o ConnectTimeout=5 $CROSS_VM_USER@$CROSS_VM_HOST 'ls -d /opt/fsl-imx-x11/*' +``` + +- **`Connection refused`** → sshd not installed. You **cannot** fix this over SSH; use + **`vmrun`** (VMware Tools channel, `VMRUN_PATH` + `CROSS_VM_VMX` in `~\skills_env.md`): + ``` + vmrun -T ws -gu -gp CopyFileFromHostToGuest /tmp/s.sh + vmrun -T ws -gu -gp runProgramInGuest /bin/bash /tmp/s.sh + vmrun -T ws -gu -gp CopyFileFromGuestToHost /tmp/out.log + ``` + Then in the guest: `sudo apt-get install -y openssh-server && sudo systemctl enable --now ssh`. +- **`ls: No such file`** (SSH works, no `/opt/fsl-imx-x11/*`) → toolchain missing, install it. + +*Installing the toolchain* — the Yocto/FSL SDK installer lives with the project notes at +`…\my_exciter\Notes_imx6\agt_devlp_ext_260616\fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa7hf-neon-toolchain-4.1.15-2.0.0.sh` +(776 MB). `scp` it to the VM, verify `md5sum` matches the local copy, then: + +```bash +chmod +x toolchain.sh && sudo ./toolchain.sh -y -d /opt/fsl-imx-x11/4.1.15-2.0.0 +``` + +`-y` makes it non-interactive; `-d` must match `CROSS_VM_ENV_SETUP`'s parent. Verify by +compiling a throwaway `.c` and confirming `file` reports **`ELF 32-bit LSB … ARM, EABI5`** — +a successful `gcc --version` alone does not prove the sysroot is wired up. + +Gotchas seen on a real install (2026-07-20): +- `apt-get` may fail with `Could not get lock /var/lib/dpkg/lock` because **`unattended-upgrades` + runs on boot**. Don't kill it — poll `fuser /var/lib/dpkg/lock` until it clears (~90 s). +- Xenial is EOL. `us.archive.ubuntu.com` still served it here, but if `apt-cache policy + openssh-server` shows no candidate, rewrite `/etc/apt/sources.list` to + `old-releases.ubuntu.com` (back it up first). +- Scripts pushed via `CopyFileFromHostToGuest` must have **LF** line endings; CRLF makes + bash fail obscurely. Write them with `[System.IO.File]::WriteAllText`, not `Set-Content`. **SSH library quirk (critical)** - The imx6's SSH server is **old (legacy ciphers + `ssh-rsa` host key)**. paramiko **5.0 fails** diff --git a/smod_atsc_dev/SKILL.md b/smod_atsc_dev/SKILL.md index b293982..bf1122f 100644 --- a/smod_atsc_dev/SKILL.md +++ b/smod_atsc_dev/SKILL.md @@ -32,7 +32,7 @@ FPGA 做 8VSB 调制 / DPD / AGC / TS 前处理,imx6 跑 `atsc_app`(配置 A | Vivado | 见 `~\skills_env.md` 的 `VIVADO_ROOT`(其下 `bin\vivado.bat`)——路径因机器而异,不要写死盘符 | | imx6 源码 | `my_exciter\imx6\src\atsc_app`(Makefile 在该目录根) | | imx6 设备 | `192.168.1.143`,用户 `root`,密码见 `~\skills_env.md` 的 `SMOD_SSH_PASS`(网页 + SSH;Windows 主机 `192.168.1.125` 同网段) | -| 交叉编译 VM | `bowei@192.168.223.128`,密码见 `~\skills_env.md` 的 `CROSS_VM_PASS`,构建目录 `~/atsc_head_build` | +| 交叉编译 VM | 主机/用户/密码见 `~\skills_env.md` 的 `CROSS_VM_HOST` / `CROSS_VM_USER` / `CROSS_VM_PASS`(IP 会变,不要写死),构建目录 `~/atsc_head_build` | | 工具链 | `/opt/fsl-imx-x11/4.1.15-2.0.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi` | | app 部署路径 | `/aw/anywave/app/imx_atsc_app`(先写 `imx_atsc_app_head`,再 `cp -a` 覆盖 active) | | app 日志 | `/var/module_log/imx_atsc_app.log` | diff --git a/smod_atsc_dev/references/imx6.md b/smod_atsc_dev/references/imx6.md index c650537..dd2bb05 100644 --- a/smod_atsc_dev/references/imx6.md +++ b/smod_atsc_dev/references/imx6.md @@ -17,7 +17,8 @@ ## 交叉编译 -工具链在 VM `bowei@192.168.223.128`(密码见 `~\skills_env.md` 的 `CROSS_VM_PASS`): +工具链在 Ubuntu VM 上(主机/用户/密码见 `~\skills_env.md` 的 `CROSS_VM_HOST` / +`CROSS_VM_USER` / `CROSS_VM_PASS`——IP 随 VMware 网段变动,不要写死): ``` /opt/fsl-imx-x11/4.1.15-2.0.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi diff --git a/smod_atsc_dev/scripts/imx6_app.py b/smod_atsc_dev/scripts/imx6_app.py index 0465219..ef9191e 100644 --- a/smod_atsc_dev/scripts/imx6_app.py +++ b/smod_atsc_dev/scripts/imx6_app.py @@ -55,7 +55,9 @@ def _env_lookup(key, default=None): REPO = r"E:\Xilinx_design\smod\SMOD_ATSC\my_exciter" APP_SUBDIR = "imx6/src/atsc_app" -VM_HOST = _env_lookup("CROSS_VM_HOST", "192.168.223.128") +# No default: the VM's IP moves with the VMware segment, so a stale fallback would +# silently connect to the wrong host (or hang). Fail loudly instead. +VM_HOST = _env_lookup("CROSS_VM_HOST") VM_USER = _env_lookup("CROSS_VM_USER", "bowei") VM_PASS = _env_lookup("CROSS_VM_PASS") VM_BUILD_DIR = "atsc_head_build" # relative to the VM home dir