nx_restage.nx
buildroot/runtime/nx_restage.nx
about
nx_restage.nx -- EAT THE DEPLOY-TOOLING DEBT (operator 2026-07-17 "eat the debt and build the tools"):
the missing primitive that restages a freshly-built elf into a build tree's _offc/. Without it,
buildroot/_offc generators go STALE vs runtime source (the F-004 stale-binary class: e.g. the compare
@verdict directive existed in nx_swcompare_sota.nx source but the staged _offc elf predated it, so the
SSOT verdict silently fell back to a hardcoded string). nx_fs_write refuses _offc (text + deny), nx_shelltool
is read-only, /api/build stages to nishihost not _offc -- so this closed gap blocked EVERY generator refresh.
nx_restage <target> [broot] broot default "buildroot" ("." = in-place / local test)
-> chdir broot; fork _offc/nx_sov_build_run.elf <target> --build-only (=> /tmp/<target>.sov.elf)
-> binary-safe copy to _offc/<target>.elf.new; VERIFY ELF magic + nonzero; atomic rename over _offc/<target>.elf
target sanitized [A-Za-z0-9_] (no path escape). Exit 0 restaged | 1 build/copy fail | 2 usage/bad-target.
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 1 imports · 1 importers
imports: nx_tool_run.nx
imported by: nx_restage_gate.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 13 | const K_MAGIC_262144: i64 = 262144 |
| 14 | const K_MAGIC_65536: i64 = 65536 |
functions
| 16 | func rp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } called by 1: main |
| 17 | func rpe(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(2,s,n); return 0 } called by 1: main |
| 18 | func rn(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{sys_write(1,"-" as *u8,1);m=0-m} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 } called by 1: main |
| 20 | func r_cat(dst: *u8, off: i64, src: *u8) -> i64 { var o: i64=off; var j: i64=0; while src[j]!=(0 as u8){dst[o]=src[j];o=o+1;j=j+1} return o } called by 1: main |
| 22 | func r_san(name: *u8) -> i64 |
| 38 | func main(argc: i64, argv: *i64) -> i64 |