- .cargo/config.toml: rust-lld linker pinned for x86_64 + aarch64 musl targets (RUSTFLAGS no longer needed) - scripts/d2000-deploy.ps1: build -> AArch64 ELF check -> scp deploy - docs/d2000-dev-plan.md: M2 done; rustup mirror gotcha documented (cached channel manifest pins absolute mirror URLs; patch it to static.rust-lang.org when a component 404s) - verified: target/aarch64-unknown-linux-musl/release/el6695-rt is a static AArch64 ELF (e_machine=0xB7), ~1MB
30 lines
1.4 KiB
PowerShell
30 lines
1.4 KiB
PowerShell
#Requires -Version 5.1
|
|
# Build + deploy el6695-rt for Phytium D2000 (aarch64-unknown-linux-musl).
|
|
# Usage: .\d2000-deploy.ps1 [-JumpHost user@host] [-TargetHost user@ip] [-RemoteDir /root/gateway]
|
|
param(
|
|
[string]$JumpHost = 'tonycao@192.168.58.8', # TODO: replace with jump host #2 for D2000
|
|
[string]$TargetHost = 'root@192.168.68.100', # TODO: replace with D2000 address
|
|
[string]$RemoteName = 'el6695_rt_d2000',
|
|
[string]$RemoteDir = '/root/gateway',
|
|
[string]$Variant = '800b' # payload variant marker for filename only
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
$repo = 'C:\Users\tonycao\work\ethercat-linux'
|
|
$bin = Join-Path $repo 'target\aarch64-unknown-linux-musl\release\el6695-rt'
|
|
|
|
Write-Host '=== D2000 (aarch64) build ==='
|
|
cargo build --release --target aarch64-unknown-linux-musl --manifest-path (Join-Path $repo 'Cargo.toml')
|
|
if ($LASTEXITCODE -ne 0) { throw 'build failed' }
|
|
|
|
# verify ELF arch = AArch64 (0xB7)
|
|
$d = [System.IO.File]::ReadAllBytes($bin)
|
|
if ($d[18] -ne 0xB7 -or $d[19] -ne 0x00) { throw 'not an AArch64 binary!' }
|
|
Write-Host ('aarch64 ELF OK, {0} bytes' -f $d.Length)
|
|
|
|
Write-Host '=== deploy ==='
|
|
$remote = "$RemoteDir/$RemoteName"
|
|
scp -o ConnectTimeout=10 -o BatchMode=yes -J $JumpHost $bin "${TargetHost}:$remote"
|
|
ssh -o BatchMode=yes -J $JumpHost $TargetHost "chmod +x $remote; $remote --help 2>&1 | head -3 || true"
|
|
Write-Host "deployed to ${TargetHost}:$remote"
|