Build legacy drivers and publish per-OS packages with web activation and DEB

This commit is contained in:
2026-11-27 20:55:31 +00:00
96 changed files with 3204 additions and 25 deletions

24
cross/build-legacy.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# NDIS 3 binary candidate using historical NT4 x86 DDK, not modern NDIS block layout.
set -euo pipefail
cd "$(dirname "$0")/.."
out=$PWD/build/cross/legacy; mkdir -p "$out"; rm -f "$out"/{MARSNET3.SYS,MARSNET.EXE,MARSNET.INF}
dump=${MINGW_OBJDUMP:-objdump}
for t in "$dump" clang-cl lld-link python3; do command -v "$t" >/dev/null || { echo "Missing $t" >&2; exit 1; }; done
cache=${MARS_TOOLCHAIN_DIR:-$PWD/.toolchains}; root=$cache/legacy/nt4-extracted
if [[ -z ${NT4_DDK_INCLUDE:-} || -z ${NT4_NDIS_LIB:-} ]]; then [[ -f $root/READY ]] || ./cross/extract-nt4.sh; fi
rm -rf "$out/include"; lib=$(python3 cross/prepare-nt4.py "$root" "$out/include")
# Build without modern NTOSKRNL or CRT import libraries. Win9x NDIS loader only
# supports a subset of NT imports; structural checks don't prove loader compatibility.
for f in clients/windows/ndis3/miniport.c clients/windows/ndis3/legacy_core.c clients/windows/ndis5/frame_queue.c; do
clang-cl --target=i686-pc-windows-msvc /nologo /c /TC /Gz /GS- /Zl /O1 /Oi- /clang:-ffreestanding /clang:-fno-builtin /D_X86_=1 /Di386=1 /DNDIS_MINIPORT_DRIVER /DNDIS30_MINIPORT /DMARS_LEGACY_KERNEL /I"$out/include" /imsvc/usr/i686-w64-mingw32/include /Fo"$out/$(basename "$f" .c).obj" "$f"
done
lld-link /nologo /driver /subsystem:native,4.0 /osversion:4.0 /entry:DriverEntry@8 /nodefaultlib /machine:x86 /base:0x10000 /dynamicbase:no /nxcompat:no /safeseh:no /out:"$out/MARSNET3.SYS" "$out/miniport.obj" "$out/legacy_core.obj" "$out/frame_queue.obj" "$lib"
python3 cross/verify-pe.py "$out/MARSNET3.SYS" sys
"$dump" -p "$out/MARSNET3.SYS" > "$out/MARSNET3.imports.txt"
# Refuse unexpected DLL imports; older loaders cannot resolve newer kernel APIs.
if grep 'DLL Name:' "$out/MARSNET3.imports.txt" | grep -Eiv 'DLL Name:[[:space:]]+ndis\.sys[[:space:]]*$'; then echo 'Unexpected legacy kernel import' >&2; exit 1; fi
./cross/build-legacy-bridge.sh
cp build/cross/legacy-bridge/{MARSNET.EXE,MARSNET.imports.txt} "$out/"
cp clients/windows/ndis3/MARSNET.INF "$out/"
echo 'NDIS3 build candidate. Requires OS-specific Packet.dll/driver and VM validation. NT4 OEMSETUP not included.'