code wiki / _hdl_build / nx_deploy_stage_cli_driver_t188.nx
nx_deploy_stage_cli_driver_t188.nx source
↩ module page · 30 lines · 1791 B
1import "nx_ccbuild_lib.nx"
2import "nx_gate_verdict.nx"
3func cli188_show(path:*u8)->i64{
4 let fd:i64=sys_openat_rd(path);if fd<0{return fd}
5 let b:*u8=sys_mmap(4096);var n:i64=sys_read(fd,b,4096)
6 while n>0{sys_write(1,b,n);n=sys_read(fd,b,4096)};sys_close(fd);return 0
7}
8func main()->i64{
9 sys_chdir("/volume1/homes/elderwesto/nishihost/buildroot")
10 let c:*i64=gv_ctr();let env:*i64=sys_mmap(8) as *i64;env[0]=0
11 let err:i64=sys_openat_wr("knowledge/gates/stage-cli-compiler-t188.log",MODE_0644)
12 let built:i64=cb_build("_build/nx_compile_x86.sov.elf","runtime/_hdl_build/nx_deploy_stage_cli_t188.nx","_build/stage-cli-t188.s","_build/stage-cli-t188.elf",env,err,"_build/stage-cli-t188.tmp","knowledge/gates/stage-cli-asm-t188.log")
13 gv_check("chosen compiler builds stage CLI",built==0,c)
14 if built==0{
15 let out:i64=sys_openat_wr("knowledge/gates/stage-cli-run-t188.log",MODE_0644)
16 let av:*i64=sys_mmap(40) as *i64
17 av[0]="_build/stage-cli-t188.elf" as i64;av[1]="stage" as i64;av[2]="_build/nx_mgmt_api.sov.elf" as i64
18 av[3]="knowledge/gates/stage-cli-quote\"back\\t188.elf.new" as i64;av[4]=0
19 let run:i64=cb_run("_build/stage-cli-t188.elf",av,env,out,err)
20 sys_close(out);cli188_show("knowledge/gates/stage-cli-run-t188.log")
21 gv_check("CLI stages quoted path and emits full receipt",run==0,c)
22 av[1]="--kat" as i64;av[2]=0
23 let out2:i64=sys_openat_wr("knowledge/gates/stage-cli-kat-t188.log",MODE_0644)
24 let run2:i64=cb_run("_build/stage-cli-t188.elf",av,env,out2,err)
25 sys_close(out2);cli188_show("knowledge/gates/stage-cli-kat-t188.log")
26 gv_check("legacy stage selftest preserved",run2==0,c)
27 }
28 sys_close(err);cli188_show("knowledge/gates/stage-cli-compiler-t188.log")
29 return gv_verdict("chosen-stage-cli",c,"Private source, executable and receipt; no activation")
30}