103 lines
6 KiB
Markdown
103 lines
6 KiB
Markdown
# PikeOS Subsystem Parity Program — Handoff
|
||
|
||
Status: **Phase 1 complete** (source copy + ADT port, all 3 archs build+boot green).
|
||
Phase 2 (tool reverse-engineering → parity specs) in progress via parallel analysis.
|
||
|
||
## Goal (user directive, 2026-07-11)
|
||
|
||
"All source code shall be copied to UniversalisOS, and all the tools and apps
|
||
shall be analysed and also reverse engineered in order to create exactly feature
|
||
parity on the build, test and config environments" — covering PikeOS
|
||
`src/{rpm,scov,share,config,cdk,build}`.
|
||
|
||
## What those six trees actually are (measured)
|
||
|
||
| Dir | Reality | Genuine source |
|
||
|-----|---------|----------------|
|
||
| rpm/ | installed binary RPM 4.x toolset + macros | macros/scripts ~2K LOC |
|
||
| scov/ | Rapita RVS (RapiCover/Test/Time/Task) — proprietary, binaries + vendored Python 3.6 stdlib (911K of its 1M LOC) | integration/templates/wrappers ~36K LOC |
|
||
| share/ | install share tree: HTML docs, grub2/qemu binaries, target XML defs, scripts | XML/scripts ~14K LOC |
|
||
| config/ | 23 RPM target/host macro files (ASCII) | 23 files |
|
||
| cdk/ | installed GCC 7.4.0 cross-toolchains (arm/ppc/x86) + newlib | ldscripts + headers ~80K LOC (rest is gcc/newlib runtime) |
|
||
| build/ | build logs + metadata, **plus build/adt: SYSGO ADT library** | adt = 8.7K LOC C |
|
||
|
||
## Phase 1 — DONE
|
||
|
||
### 1. Full source copy → `universalisos/pikeos-mirror/`
|
||
- **58,646 files** — 100% of text/source under `src/` (all subprojects incl.
|
||
sources/ukernel-*, demo/, target/, tfw/, documentation), byte-identical,
|
||
layout preserved, `MANIFEST.json` at the root. Only 6,634 binaries
|
||
(ELF/jar/image) excluded. Classification is content-based (NUL-byte sniff),
|
||
so extension-less files (rpm macros, rpmrc, config/*, Makefiles) are covered.
|
||
|
||
### 2. ADT library ported into the kernel → `kernel/src/core/adt/`
|
||
- All 60 files (34 .c + 20 .h + 6 package.mk) from build/adt: stand (mem*/str*/
|
||
strto*/bsearch/sprintf/snprintf), avl, base (saturated arith + assert),
|
||
crc32, lheap, kdev config-format, list.
|
||
- Hard naming rule applied: every `p4`/`P4` token renamed (P4X_→UOSX_,
|
||
p4_strto*→uos_strto*, P4_MEM_KERN_*→UOS_MEM_KERN_*); zero p4 tokens remain.
|
||
- Kernel pointer-check hook retargeted from `kernel/p4const.h` to new
|
||
`include/universalisos/uos_kconst.h` (per-arch UOS_MEM_KERN_BASE/END).
|
||
- `__assert_fail` backend added in `adt_base.c` (prints via uart_puts, parks CPU)
|
||
so ADT is self-contained on every arch.
|
||
- Build wiring: Makefile gained a `.c` rule, ADT include dirs, `ADT_OBJS`
|
||
(wildcard `core/adt/*/*.c`) linked into every arch.
|
||
- Collision resolved the parity-correct way: armv7's hand-written asm
|
||
`string.S` (memcpy/memset/strlen) dropped from objects.mk — ADT stand is now
|
||
the single source of those globals on all archs (file kept in-tree as ref).
|
||
- Verified: all 3 archs build exit 0; nm shows adt_* / memcpy / __assert_fail in
|
||
each ELF; **live boots still green** — armv7 reaches `[apex] OK` + WASM guest,
|
||
riscv `[apex] OK` ×2 partitions, aarch64 `[apex] OK` + vTimer ack.
|
||
|
||
## Phase 2 — specs from reverse engineering
|
||
|
||
- `docs/parity/CDK_CONFIG_BUILD_PARITY_SPEC.md` — DONE (cdk inventory: gcc
|
||
7.4.0/binutils 2.31, 7 slots, PikeOS ldscript semantics, libgcc_cert 22 fns;
|
||
targetdefinition-1.1 schema; package.mk contract; uos-cdk/uos-target design)
|
||
- `docs/parity/SCOV_PARITY_SPEC.md` — DONE (RVS 4 tools, dual-pass
|
||
instrumentation, rvs_ipoint.h ABI, map/.mdb formats; uos-cover design)
|
||
- `docs/parity/RPM_PARITY_SPEC.md` — subagent still running
|
||
|
||
## Phase 3 — implementation (in progress)
|
||
|
||
DONE:
|
||
- `tools/uos-target/uos-target.py` — validate/list/show/env/check/crosscheck.
|
||
All 8 targets validate; crosscheck passes vs PikeOS's own config/rpm macro
|
||
files (arm_v7hf + the riscv slot PikeOS defined-but-didn't-ship).
|
||
- `share/xsd/uos/targetdefinition-1.1.xsd` — re-namespaced schema (structure 1:1).
|
||
- `share/definition/*.target.xml` — 8 instances (7 mirrored + new riscv_rv64).
|
||
- `tools/uos-cdk/uos-cdk-gen` — generates `cdk/<arch>/<proc>` + `target/<arch>/<proc>`
|
||
under the repo prefix; PikeOS tool names (`arm_v7hf-gcc`) wrap host cross
|
||
toolchains with the exact PikeOS flag sets. Version deviation documented in
|
||
cdk/VERSIONS.md (pin 7.4.0/2.31 -> host gcc 15/16 fallback per spec §4.1).
|
||
`UOS_PREFIX=$PWD uos-target check` = 15/15 OK on arm_v7hf/arm_v8hf/riscv_rv64;
|
||
env->compile loop verified per arch.
|
||
|
||
- `tools/uos-cover/libuoscov/` — on-target coverage runtime (SCOV spec §3.3):
|
||
`uos_ipoint.h` (full RapiCover ABI parity: UOS_I/E/T/F/C, CM/DM/DML for key
|
||
widths 8..1024) + `libuoscov.c` (map-mode runtime, .umap dump, weak map +
|
||
transport hooks) + host unit test (22/22 PASS). Cross-compiles freestanding
|
||
on armv7/aarch64/riscv64.
|
||
|
||
TODO (order): uos-pkg remaining slices (spec parser, RPM container format,
|
||
build engine, uosdb) → uos-cover host tools (uos-cins instrumenter, uos-xst
|
||
map linker, uos-covparse, uos-covexport, uos-report) → kernel Makefile
|
||
package.mk consumption (spec §4.3).
|
||
|
||
### uos-pkg progress (macro engine slice — DONE, 42/42)
|
||
- `tools/uos-pkg/uos-pkg.py` — rpm-4.2 macro processor: %name/%{name}/
|
||
%{builtin:arg}/%name(args)/%(...)/conditionals/option-forms/%% escape;
|
||
config stack = compiled-in defaults → macro files (rpmrc:355 order) → rpmrc
|
||
arch-config (optflags). Loads the REAL mirrored files unmodified.
|
||
- `tools/uos-pkg/test/diff_macros.py` — differential harness vs the mirrored
|
||
rpm 4.2 binary (`-E`): 42/42 PASS. Key oracle findings baked in: rpm 4.2
|
||
`--macros` does NOT load files (compiled-in defaults + rpmrc only); the 4.2
|
||
builtin set is limited (dirname/getenv/nil echo literally); suffix = no dot;
|
||
%{?c} no-colon yields the value; expand re-expands; %nil = %{!?nil} idiom.
|
||
|
||
## Gotchas
|
||
- The p4-token ban applies to ALL new code/docs, including ported SYSGO files.
|
||
- Rapita RVS is proprietary: we mirror its source for analysis but the parity
|
||
deliverable is a clean-room reimplementation (uos-cover), never vendored RVS.
|
||
- scov's 911K-LOC Python 3.6 stdlib is vendored noise — analyze RVS's own
|
||
integration code, not the stdlib.
|