Cross-compile & deploy tooling for VNPT fiber modem series running embedded Linux. Supports three modem models across MIPS, ARMv7, and AArch64 — each with a dedicated Python build script, Makefile, and hardware reference notes.
| Directory | Model | Architecture | C Library | Kernel | Access |
|---|---|---|---|---|---|
h-cross/ |
VNPT HG1040-H | MIPS 34Kc big-endian | uClibc 0.9.33.2 | 2.6.36 | Telnet 23 |
ns-cross/ |
VNPT 040-NS | ARM Cortex-A53 AArch32 | glibc 2.22 | 4.4.115 | SSH 22 |
xgs-cross/ |
VNPT XSW240-N (050-XGS) | ARM Cortex-A53 AArch64 | glibc 2.32 | 5.4.55 | Telnet 23 |
Each subdirectory is self-contained. Pick the one matching your modem.
# First-time: check or install the cross-compiler
python h_build.py setup # H modem
python ns_build.py setup # NS modem
python xgs_build.py setup # XGS modem
# Set your device address (saves to .hm / .ns / .xgs config file)
python h_build.py config --save -H YOUR_MODEM_IP -U admin -P YOUR_PASSWORD
# Build + upload + run in one step
python h_build.py deploy hello.c
# Build only
python h_build.py build hello.c
# Interactive shell on device
python h_build.py shellcd h-cross
make # build (static, stripped)
make deploy # build + upload + run
make DEVICE=YOUR_IP deploy # with explicit device address
make shell # interactive shell
make help # all targets and variablesCredentials are resolved in this order for each script:
CLI flags (-H / -U / -P)
→ environment variables (H_HOST / H_USER / H_PASS, etc.)
→ config file (.hm, .ns, or .xgs in current directory)
→ built-in defaults (set YOUR_MODEM_IP / YOUR_PASSWORD in the script)
To save config persistently:
python h_build.py config --save -H YOUR_MODEM_IP -U admin -P YOUR_PASSWORDEach modem uses a different upload strategy (no FTP — device bftpd writes to flash on PUT):
| Modem | Primary | Fallback |
|---|---|---|
| H (MIPS) | echo-hex over telnet | TFTP server on host |
| NS (AArch32) | echo-hex over SSH | HTTP server + device wget |
| XGS (AArch64) | HTTP server + device wget | base64 over telnet |
The download subcommand fetches a URL to the device:
# H modem: host fetches URL, relays to device (H has no wget/curl)
python h_build.py download https://example.com/tool
# NS / XGS: device fetches directly via wget/curl
python ns_build.py download https://example.com/tool
python xgs_build.py download https://example.com/tool-msoft-floatis required — EN751221 kernel has no hardware FPU. FPU instructions → SIGILL.-staticis strongly recommended — device uses uClibc 0.9.33.2; glibc/musl dynamic binaries will not run.- Use
mips-*toolchain (big-endian), nevermipsel-*(little-endian).
-mfloat-abi=softis required — kernel 4.4.115 built withoutCONFIG_VFP. VFP instructions → SIGILL.- Do NOT use
-mfloat-abi=softfp— it silently emits VFP compute instructions → SIGILL. - Use
arm-linux-gnueabi(soft-float), neverarm-linux-gnueabihf(wrong dynamic linker).
- Standard AArch64 — hardware FP enabled by default, no special float flags needed.
- Dynamic builds work fine (glibc 2.32 on device).
# H modem (MIPS big-endian) — LLVM/clang + muslsf sysroot
brew install llvm lld@20
curl -L https://musl.cc/mips-linux-muslsf-cross.tgz | tar xz -C /opt/homebrew/opt/
# h_build.py auto-detects this combination
# NS modem (AArch32 soft-float)
brew tap messense/macos-cross-toolchains
brew install arm-unknown-linux-gnueabi
# XGS modem (AArch64)
brew install aarch64-unknown-linux-gnusudo apt-get install gcc-mips-linux-gnu binutils-mips-linux-gnu # H modem
sudo apt-get install gcc-arm-linux-gnueabi binutils-arm-linux-gnueabi # NS modem
sudo apt-get install gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu # XGS modembin-cross-modem/
├── README.md
├── .gitignore
├── test_optim.c # cross-platform correctness + perf test (all 3 targets)
│
├── h-cross/
│ ├── h_build.py # build / upload / run script for H modem
│ ├── Makefile
│ ├── hello.c # minimal test binary
│ └── NOTES.md # hardware reference, toolchain details, library list
│
├── ns-cross/
│ ├── ns_build.py # build / upload / run script for NS modem
│ ├── Makefile
│ ├── hello.c
│ ├── test.c
│ └── NOTES.md
│
└── xgs-cross/
├── xgs_build.py # build / upload / run script for XGS modem
├── Makefile
├── hello.c
└── NOTES.md
Each NOTES.md contains confirmed hardware data collected from live devices:
- CPU / SoC identification, exact RAM, kernel version, build toolchain
- Complete toolchain selection guide with ABI pitfalls
- Upload method details and writable directory inventory
- Full library list (
/lib/*.so) with link flags and documentation links - System parameters: socket buffers, resource limits, open ports, MTD layout
- C coding guide for the specific architecture (alignment, endianness, kernel limits)
- Performance optimization guide with hardware-specific compiler flags
MIT