universalisos/docs/parity/CDK_CONFIG_BUILD_PARITY_SPEC.md

30 KiB
Raw Permalink Blame History

UniversalisOS Parity Specification — CDK, Target Definition & Config Environment, Build System

Status: Analysis of mirrored PikeOS 5.0 (D5.0) sources → feature-parity design for UniversalisOS. Source of truth: ~/portugalfuturista/universalisos/pikeos-mirror/ (byte-identical copy of the PikeOS installation tree; see MANIFEST.json: 3810 files across cdk/ (724), share/ (126), build/ (60), config/ (23), rpm/ (16), scov/ (2861)). Scope of this document: (1) CDK inventory, (2) target-definition XML schema, (3) package.mk build-system contract, (4) UniversalisOS equivalent design (uos-cdk, uos-target, kernel Makefile integration).

Naming rule: the banned two-character token for the reference product never appears in UniversalisOS artifacts; the reference product is called PikeOS, and UniversalisOS replacements use the uos_ / uos- prefix.


1. CDK Inventory

1.1 Layout

Mirror path: pikeos-mirror/cdk/. The CDK is organised as cdk/<arch>/<proc>/ with exactly seven toolchain slots:

Slot (dir) Target triple (<triple>/) GCC dir Wordsize Endian FPU
cdk/arm/v7hf arm-unknown-eabihf lib/gcc/arm-unknown-eabihf/7.4.0 32 little yes (vfpv3-d16)
cdk/arm/v8hf aarch64-unknown-elf lib/gcc/aarch64-unknown-elf/7.4.0 64 little yes
cdk/ppc/e500 powerpc-unknown-elfspe lib/gcc/powerpc-unknown-elfspe/7.4.0 32 big yes (SPE)
cdk/ppc/e500mc powerpc-unknown-elf lib/gcc/powerpc-unknown-elf/7.4.0 32 big yes
cdk/ppc/e500mc-4g powerpc-unknown-elf lib/gcc/powerpc-unknown-elf/7.4.0 32 big yes
cdk/ppc/e5500 powerpc64-unknown-elf lib/gcc/powerpc64-unknown-elf/7.4.0 64 big yes
cdk/x86/amd64 x86_64-unknown-elf lib/gcc/x86_64-unknown-elf/7.4.0 64 little yes

Evidence: directory tree under pikeos-mirror/cdk/; triples confirmed by config/rpm/targets/*-linux (%_pikeos_target_config), wordsize/endian/FPU by the same files (%_pikeos_wrdsz, %_pikeos_cpu_endian, %_pikeos_has_fpu, %_pikeos_cpu_arch = armv7-a / armv8-a / rv64g).

Notable: config/rpm/targets/ also defines slots for targets not present in the mirrored CDK — riscv_rv64-linux (triple riscv64-unknown-elf, rv64g, 64-bit, little-endian), mips_isa32be/le, ppc_e6500, ppc_oea, sparc_v8, x86_i686, and -diab (Wind River Diab) variants of the e500mc slots. The RISC-V slot is directly relevant because UniversalisOS already targets riscv64 (see §4.1).

1.2 Toolchain versions

Component Version Evidence
GCC 7.4.0 lib/gcc/<triple>/7.4.0/ in all seven slots
GNU binutils (ld) 2.31 stray build-path comment inside cdk/arm/v7hf/arm-unknown-eabihf/lib/ldscripts/armelf_pikeos_eabi.x line 120: .../BUILD/binutils-2.31/ld/scripttempl/DWARF.sc
newlib / libc not shipped in the mirror no libc.a/libm.a/include/stdio.h under cdk/; only GCC private headers (include/) and fixincludes output (include-fixed/ with the standard fixincludes README) are present. The CDK is therefore a freestanding kit; C library comes from the target pool / personalities (POSIX etc.), not from the CDK.
libgcc not shipped as a binary archive in the mirror; instead a certifiable-subset header is shipped (§1.4).
Installation prefix /opt/pikeos-D5.0 SEARCH_DIR("=/opt/pikeos-D5.0/cdk/...") in every PikeOS ldscript; config/rpm/common (%_pikeos_prefix /opt/pikeos-D5.0, %_pikeos_version D5.0)

Per-slot contents (identical shape in every slot):

cdk/<arch>/<proc>/
├── <triple>/lib/ldscripts/        # binutils emulation scripts (incl. PikeOS-specific ones, §1.3)
└── lib/gcc/<triple>/7.4.0/
    ├── include/                   # GCC private headers (std*.h, arch intrinsics, libgcc_cert.h where applicable)
    └── include-fixed/             # fixincludes output: limits.h, syslimits.h, README

The bin/ directory referenced by the target definitions (cdk/<arch>/<proc>/bin/<arch>_<proc>-gcc etc.) is not in the mirror — only libraries/headers/scripts were mirrored. Tool naming convention is nonetheless fully determined by the target XMLs (§2): <arch>_<proc>-{gcc,g++,ld,as,ar,nm,objcopy,objdump,ranlib,strip,gdb}.

1.3 PikeOS-specific linker scripts

Two PikeOS-specific ldscript families exist, one per ELF emulation:

  • ARM 32-bit: cdk/arm/v7hf/arm-unknown-eabihf/lib/ldscripts/armelf_pikeos_eabi.x (+ .xbn .xe .xn .xr .xs .xse .xu variants)
  • PowerPC 32-bit (both endianness emulations): elf32ppcpikeos.x and elf32lppcpikeos.x (+ same variant suffixes), present in ppc/e500, ppc/e500mc, ppc/e500mc-4g slots.

No PikeOS-specific script exists for aarch64 or x86_64 (they use stock aarch64elf*.x / elf_x86_64.x).

What the PikeOS scripts define (from armelf_pikeos_eabi.x and elf32lppcpikeos.x):

  • OUTPUT_FORMAT("elf32-littlearm", ...) / OUTPUT_FORMAT("elf32-powerpcle", ...); ENTRY(_start).
  • Two program headers only: PHDRS { text PT_LOAD FLAGS(5); data PT_LOAD FLAGS(6); } — RX text, RW data. No PT_GNU_STACK, no dynamic segment: a static, non-relocatable partition image.
  • Fixed text base: . = SEGMENT_START("text-segment", 0x08010000) + SIZEOF_HEADERS; — the default link address of a PikeOS user partition is 0x08010000.
  • Data segment page-aligned: . = ALIGN(0x1000); before data (matches align="0x1000" in the target XML).
  • PikeOS-specific section ._vm_stack, placed first in the data segment:
    ._vm_stack : { LONG(ABSOLUTE(_vm_stack_size)); LONG(ABSOLUTE(_vm_stack)); } : data
    
    This emits an 8-byte (2×32-bit) descriptor of the VM stack (size, address) at a fixed offset in the data segment so the kernel/PSSW loader can size and place the initial stack without symbol-table access. _vm_stack_size and _vm_stack are supplied by the crt/startup code.
  • Standard GNU sections: .text (with .glue_7t/.glue_7/.vfp11_veneer/.v4_bx on ARM, .glink on PPC), .rodata, .ARM.extab/.ARM.exidx with __exidx_start/__exidx_end (ARM only), .eh_frame_hdr, .eh_frame (__EH_FRAME__), .gcc_except_table, .preinit_array/.init_array/.fini_array with hidden start/end symbols, .ctors/.dtors, .data (__data_start, SORT(CONSTRUCTORS)), .bss (__bss_start, __bss_start__, _bss_end__, __bss_end__), _end/end.
  • /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }.
  • Variant suffix semantics (standard binutils): .x default, .xn = -n (text+data same page), .xr = -r, .xu = -Ur, .xs = shared, .xse = -z separate-code shared, .xe = -z separate-code, .xbn = -N. The PikeOS scripts ship only the non-shared subset (.x .xbn .xe .xn .xr .xs .xse .xu — no .xc/.xdw/.xwe which are the stock scripts' compressed-debug/wildcard variants).

1.4 PikeOS-specific headers: libgcc_cert.h

cdk/<slot>/lib/gcc/<triple>/7.4.0/include/libgcc_cert.h — present in arm/v7hf, ppc/e500, ppc/e500mc, ppc/e500mc-4g (byte-identical across slots), absent in arm/v8hf, ppc/e5500, x86/amd64 (64-bit targets don't need 64-bit soft-integer helpers).

Purpose (from its own prologue): "Certifiable subset of libgcc, handling of 64-bit integer arithmetics. And for 32-bit PowerPC, floating point conversion as well." It declares, with per-function requirement tags (/* RQ IF_GCC 4860 */ …) for certification traceability:

  • 64-bit shifts/neg/mul: __ashldi3, __ashrdi3, __lshrdi3, __negdi2, __muldi3
  • 64-bit div/mod: __udivmoddi4, __divmoddi4, __divdi3, __moddi3, __udivdi3, __umoddi3
  • 64-bit compare: __cmpdi2, __ucmpdi2
  • float↔64-bit-int conversions: __fixsfdi, __fixdfdi, __fixunssfdi, __fixunsdfdi, __floatdisf, __floatdidf, __floatundisf, __floatundidf

Semantics are pinned in the header (e.g. __fixsfdi returns 0x8000000000000000 on unrepresentable input; division helpers never receive NULL remainder pointers). This is the contract a certification-grade libgcc replacement must satisfy; UniversalisOS must provide a uos_libgcc_cert implementing exactly these 22 symbols with these semantics (see §4.1).

Other PikeOS-relevant headers in include/: nothing else PikeOS-specific — the rest is stock GCC 7.4.0 (std*.h, arm_acle.h, arm_neon.h, arm_cmse.h, unwind-arm-common.h on ARM; altivec.h, spe.h, ppc-asm.h, ppu_intrinsics.h, htmintrin.h on PPC; x86 intrinsics on amd64).


2. Target-Definition XML Schema

2.1 Instances

pikeos-mirror/share/definition/*.target.xml — seven files, one per CDK slot: arm_v7hf, arm_v8hf, ppc_e500, ppc_e500mc, ppc_e500mc-4g, ppc_e5500, x86_amd64. Each is a single empty element <TargetDefinition .../> carrying all data as attributes (no child elements).

Full attribute list (from arm_v7hf.target.xml, identical shape everywhere):

Attribute Example value Meaning
name arm_v7hf target identifier (= <arch>_<proc>)
description ARM v7 Architecture human-readable label
arch arm CPU family (arm / ppc / x86)
proc v7hf processor variant within family
architecture arm_v7hf full architecture id (== name)
wrdsz 32 word size in bits (32/64)
align 0x1000 mandatory alignment (hex) — page size used by the linker scripts
endian little little or big
pool target/arm/v7hf install pool path for target binaries, relative to prefix
ar PIKEOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-ar archiver
as .../arm_v7hf-gcc -c assembler (gcc driver in -c mode)
cc .../arm_v7hf-gcc C compiler
cpp .../arm_v7hf-gcc -E C preprocessor
cxx .../arm_v7hf-g++ C++ compiler
depcc .../arm_v7hf-gcc -M C dependency generator
depcxx .../arm_v7hf-g++ -M C++ dependency generator
gdb .../arm_v7hf-gdb debugger
ld .../arm_v7hf-ld linker
nm .../arm_v7hf-nm symbol lister
objcopy .../arm_v7hf-objcopy object copier/converter
objdump .../arm_v7hf-objdump object dumper
ranlib .../arm_v7hf-ranlib archive indexer
striptool .../arm_v7hf-strip strip tool (note: attribute is striptool, not strip)

Tool paths use the PIKEOS_PREFIX: URI scheme — a placeholder resolved against the installation prefix at use time. The tool basename convention is <arch>_<proc>-<tool>.

2.2 Schema (XSD)

pikeos-mirror/share/xsd/<product>/targetdefinition-1.1.xsd (the xsd/ subdirectory named after the reference product's two-character abbreviation), namespace http://www.sysgo.com/xsd/<product>/targetdefinition-1.1.xsd, elementFormDefault="qualified".

  • Simple types:
    • Hex — string matching 0[xX][0-9a-fA-F]+ (used by align).
    • Endian — enumeration little | big.
  • Complex type TypeTargetDefinitionall attributes listed in §2.1 are use="required", plus one optional attribute:
    • bclinker (optional) — linker for "bound component" / bytecode-style linking (not used by any shipped target XML).
  • Root element: <TargetDefinition type="TypeTargetDefinition"/>.

The schema is attribute-only: no child elements, no sequences — validation is a flat 23-attribute presence + type check.

2.3 Relationship to the RPM build config

pikeos-mirror/config/rpm/targets/<name>-linux files are the RPM-side mirror of the same data: %_pikeos_target_cpu, %_pikeos_target_proc, %_pikeos_target_arch (<cpu>_<proc>), %_pikeos_target_config (GNU triple), %_pikeos_cpu_endian, %_pikeos_cpu_arch (gcc -march value), %_pikeos_has_fpu, %_pikeos_fpu_id (e.g. vfpv3-d16 for v7hf), %_pikeos_wrdsz, %_pikeos_align, %_pikeos_cdk_dir, %_pikeos_arch_pool. config/rpm/common pins the prefix /opt/pikeos-D5.0 and version D5.0. Hosts supported for the toolchain itself: config/rpm/hosts/{cygwin,cygwin64,lin32,lin64,win32,win64}.

2.4 Config environment around the target definition

  • XSD libraryshare/xsd/<product>/ (target-definition, VMIT 4.5, types, romimage, trace-config, cat; <product> = the reference product's two-character abbreviation) and share/xsd/prj/ (project/component/profile/option schemas used by the IDE). The config pipeline is: XML → (pikeos-configconv) → binary config module (.mod) with CRC; pikeos-configmore generates C metadata/test code from XSDs; pikeos-make-cat builds catalog.xml for XSD resolution.
  • Binary config formatbuild/adt/kdev/include/adt/kdev/config-format.h: signature DRV_CONFIG_SIG = 0x148c7ab0, DRV_CONFIG_VERSION = 10, CRC starts at byte 16, flags DRV_CONFIG_FLAG_32BIT(4) / DRV_CONFIG_FLAG_64BIT(8) / DRV_CONFIG_FLAG_DISABLE_CHECKSUM(0x20), extension-array tags (DRV_EXT_TAG_NULL, build-id tag, …), 8-byte-aligned drv_bin_header. Wordsize/endian are baked in at conversion time (--endian=, --wordsize=).
  • share/configmore/dumpbin-xml/ — reference host tool reversing a binary config back to XML. Makefile variables: XSD (default $(PIKEOS_PREFIX)/share/xsd/<product>/vmit-4.5.xsd), XSDDIR, FORMAT, PIKEOS_PREFIX; consumes build/adt/{base,crc32,kdev}/package.mk; generates dumpbin-$(FORMAT).inc via pikeos-configmore --xsdinfo; test target converts test-vmit.xml/test-rbx.xml to .mod in all four endian×wordsize combos (l32 b32 l64 b64) and diffs the round-trip. dumpbin.c (1803 lines) is the generic dumper; panic.c/h, def.h are support.
  • share/configmore/offline-test/ — framework proving XML↔binary equivalence on the host. pikeos-configmore --test generates check calls against macros (C_UINT, C_STRING, …, declared in testframe.h, implemented in testframe.c); checks values, vector sizes, embedded binaries, recursive <any> XMLs, NULL-for-missing-optionals, ID/IDREF correspondence (AVL xref tree), header+CRC, array order. Makefile auto-detects host wordsize/endian via __SIZEOF_POINTER__/__BYTE_ORDER__ (WORDSZ, ENDIAN overridable). Test sets: TEST_ALL, per-set TEST_ALL_<set>, aux XSDs TEST_AUX_<set>; example set configtest with configtest.xml, configtest2.xml, subconfig.xsd.
  • share/profile/*.profile.xml — 16 IDE project profiles (namespace profile-4.3.xsd): pikeos (bare), pikeos-native, posix, apex, psp, integration{,-partition,-preconf}, kerneldriver, ddk-{kerneldriver,user-level}, fusion-{kernel,pssw,volume-provider}, volume-provider, systemextension. Profiles declare Parameters (e.g. PIKEOS_GDBSTUB, PIKEOS_WRITEABLE_TEXT, PIKEOS_INSTALL_DIRECTORY with poolpath values like CUSTOM_POOL/posix/object), Conditions, DerivedParameterTable/NewVariable, RestrictionTable, Separator, Option groups. They drive the IDE option UI and the generated build variables — the target XML's tools are what those builds invoke.
  • share/hwvirt-linux/ — Linux guest drivers for PikeOS hardware virtualization (pikeos/ dir: vmm*.c/h, plus the virtual-bus driver sources whose filenames begin with the reference product's two-character abbreviation followed by bus — that bus must be renamed uosbus in UniversalisOS — plus pikeos-headers/ with vmm-def.h, vmm-def-x5.h, *-def.h, *-ioring.h; patches/drivers-virt-pikeos.patch; README documents both ELinOS and generic-kernel integration via make M=... modules).
  • share/scripts/pikeos-tools.sh — 403-line shell utility library (project/environment management helpers).
  • share/boot/uboot.dts, share/mkblkimage/*.conf, share/grub2/, share/doc/libstdcxx-c++98/ — boot/ ancillary assets (out of scope for this spec, noted for completeness).

3. The package.mk Build-System Contract

3.1 Where it lives

pikeos-mirror/build/adt/<pkg>/package.mk for seven ADT (abstract-data-type) packages: base, crc32, avl, kdev, lheap, list, stand. Each package directory has the fixed shape:

build/adt/<pkg>/
├── package.mk
├── include/<pkg-or-ns>/...          # public headers (subdir namespace)
└── *.c                              # sources at package root

3.2 The contract (variable grammar)

A package.mk is a GNU-Make include fragment. For package family prefix adt and package name <p> it must define:

Variable Required Meaning
adt_packages += <p> yes self-registration into the family package list (append)
adt_<p>_srcdir yes absolute source dir, anchored at $(PIKEOS_PREFIX)/build/adt/<p>
adt_<p>_incdir yes $(adt_<p>_srcdir)/include
adt_<p>_incdir_subdirs yes header namespace subdirs (e.g. adt, adt/private, stand/internal)
adt_<p>_headers yes explicit public header list (relative to incdir)
adt_<p>_options yes list of build options the package offers; option base is mandatory and always present
adt_<p>_base_files yes C sources of the base option
adt_<p>_base_objects yes objects of the base option
adt_<p>_<opt>_files / adt_<p>_<opt>_objects per extra option sources/objects for each non-base option (e.g. adt_avl_remove_*, adt_stand_sprintf_*, adt_stand_snprintf_*)
adt_<p>_other optional miscellaneous files (present-but-empty in most packages)
adt_<p>_userlib yes 1 = usable from user-level libraries, 0 = header-only/not for userlib (list sets 0 and has empty base files)

Dependency enforcement is done imperatively at include time with make conditionals:

ifeq ($(filter base,$(adt_packages)),)
$(error adt/avl requires adt/base)
endif

i.e. a package asserts that its prerequisites were included earlier (order-sensitive inclusion). stand relaxes the check under DEVEL_BUILD=1.

3.3 How consumers use it

Both share/configmore/*/Makefiles demonstrate the consumer side:

include $(PIKEOS_PREFIX)/build/adt/base/package.mk
include $(PIKEOS_PREFIX)/build/adt/crc32/package.mk
include $(PIKEOS_PREFIX)/build/adt/kdev/package.mk
...
CPPFLAGS += $(addprefix -I, $(foreach i,$(adt_packages),$(adt_$(i)_incdir)))
ADT_OBJS := $(foreach i,$(adt_packages),$(adt_$(i)_base_objects))

and per-option selection by adding $(adt_<p>_<opt>_objects) when the option is enabled. Pattern rules copy needed *.c from $(adt_<p>_srcdir) into the build dir (%.c: $(adt_crc32_srcdir)/%.c → cp). The family prefix (adt_) is the namespacing mechanism — a different family (kernel, PSSW) would use its own prefix with the same grammar.

3.4 build/doc/templates

The mirror's build/ tree contains only build/adt/no build/doc/templates exists in the mirror (the 60 build files are exactly the 7 packages × {package.mk, sources, headers}). Templates for documentation are therefore out of mirror scope; the doc-asset conventions visible elsewhere are the @if INCLUDE_HEADER / @file / @purpose / @cfg_management $Id$ prologue blocks seen in libgcc_cert.h and config-format.h, and the @dspack/@dspackmod/@dsmodule/@dsid doc-system tags in config-format.h.


4. UniversalisOS Equivalent Design

4.1 uos-cdk — cross-development kit

Goal: a freestanding cross toolchain per UniversalisOS architecture, bit-compatible in behaviour with the PikeOS CDK for the three UniversalisOS arches (armv7, aarch64, riscv64), plus ppc/x86 slots for parity completeness.

Version pinning (match the mirrored kit exactly where the arch exists):

uos-cdk slot triple gcc binutils libc notes
arm/v7hf arm-unknown-eabihf 7.4.0 2.31 none in CDK (freestanding) -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard
arm/v8hf aarch64-unknown-elf 7.4.0 2.31 none -march=armv8-a
riscv/rv64 riscv64-unknown-elf 7.4.0 2.31 none -march=rv64g -mabi=lp64d; mirrors PikeOS's own config/rpm/targets/riscv_rv64-linux slot (triple/isa/endianness taken from that file) — fills the slot PikeOS defined but did not ship in the mirrored CDK
ppc/e500, ppc/e500mc, ppc/e500mc-4g, ppc/e5500, x86/amd64 as in §1.1 7.4.0 2.31 none parity-complete slots; build on demand

Rationale: gcc 7.4.0 + binutils 2.31 is the exact combination evidenced by the mirror (lib/gcc/*/7.4.0, binutils-2.31 path in the ldscript). Pinning these versions guarantees identical code generation, identical libgcc helper semantics, and identical linker-script emulation behaviour. If a host distro cannot build 7.4.0 any more, the fallback is the newest gcc that still accepts the same -march/-mfpu flags, with a documented deviation — but the pinned default stays 7.4.0/2.31.

Layout (drop-in compatible):

uos-cdk/<arch>/<proc>/
├── bin/<arch>_<proc>-{gcc,g++,ld,as,ar,nm,objcopy,objdump,ranlib,strip,gdb}
├── <triple>/lib/ldscripts/         # stock binutils scripts + uos scripts below
└── lib/gcc/<triple>/7.4.0/{include,include-fixed}/

uos linker scripts — replicate the two PikeOS script families as armelf_uos_eabi.x* and elf32{,l}ppcuos.x*, keeping byte-for-byte section semantics:

  • PHDRS { text PT_LOAD FLAGS(5); data PT_LOAD FLAGS(6); }
  • text base SEGMENT_START("text-segment", 0x08010000) + SIZEOF_HEADERS
  • ALIGN(0x1000) before data
  • the ._vm_stack descriptor section (LONG(_vm_stack_size); LONG(_vm_stack)) — rename symbols to _uos_vm_stack_size / _uos_vm_stack and keep the 2-word layout so the UniversalisOS loader reads the same fixed offset.
  • same __exidx_start/end, __EH_FRAME__, init/fini-array hidden symbols, __bss_start__/_bss_end__, _end, and /DISCARD/ list.
  • ship the same variant set (.x .xbn .xe .xn .xr .xs .xse .xu).

uos_libgcc_cert — implement the 22 functions of libgcc_cert.h (§1.4) as a standalone, MISRA-clean, fully-tested static library libuosgcc_cert.a for the 32-bit slots (arm/v7hf, ppc/e500*), with the exact edge-case semantics documented in the header (saturation values, non-NULL remainder). Ship the header as include/uos_libgcc_cert.h with the same declarations; keep requirement-trace tags as /* RQ UOS_GCC <n> */.

Prefix: install under /opt/universalisos-5.0/ (or $(UOS_PREFIX)); the PIKEOS_PREFIX: URI scheme becomes UOS_PREFIX:.

4.2 uos-target — target-definition loader/validator

Schema parity: adopt targetdefinition-1.1.xsd unchanged in structure, re-namespaced to http://www.universalisos.org/xsd/uos/targetdefinition-1.1.xsd. Keep every attribute (23 required + optional bclinker), the Hex pattern, and the Endian enum. Ship share/definition/*.target.xml instances for all slots, e.g.:

<TargetDefinition
    xmlns="http://www.universalisos.org/xsd/uos/targetdefinition-1.1.xsd"
    name="arm_v7hf" description="ARM v7 Architecture"
    arch="arm" proc="v7hf" architecture="arm_v7hf"
    wrdsz="32" align="0x1000" endian="little"
    pool="target/arm/v7hf"
    ar="UOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-ar"
    as="UOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-gcc -c"
    cc="UOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-gcc"
    cpp="UOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-gcc -E"
    cxx="UOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-g++"
    depcc="UOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-gcc -M"
    depcxx="UOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-g++ -M"
    gdb="UOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-gdb"
    ld="UOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-ld"
    nm="UOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-nm"
    objcopy="UOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-objcopy"
    objdump="UOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-objdump"
    ranlib="UOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-ranlib"
    striptool="UOS_PREFIX:cdk/arm/v7hf/bin/arm_v7hf-strip"/>

plus riscv_rv64.target.xml (new slot: arch="riscv" proc="rv64" wrdsz="64" endian="little" pool="target/riscv/rv64", tools riscv_rv64-*).

uos-target tool (host utility, C or Python):

  1. uos-target validate <file> — XSD-validate against the re-namespaced schema (23 required attributes, align matches 0[xX][0-9a-fA-F]+, endian ∈ {little,big}, wrdsz unsigned int).
  2. uos-target list / uos-target show <name> — enumerate share/definition/, pretty-print resolved fields.
  3. uos-target env <name> — resolve the UOS_PREFIX: scheme against UOS_PREFIX (env or /opt/universalisos-5.0) and emit shell/make variable exports: CC=... CXX=... LD=... AR=... NM=... OBJCOPY=... OBJDUMP=... RANLIB=... STRIP=... GDB=... AS=... CPP=... DEPCC=... DEPCXX=... plus UOS_ARCH, UOS_PROC, UOS_ARCHITECTURE, UOS_WRDSZ, UOS_ALIGN, UOS_ENDIAN, UOS_POOL.
  4. uos-target check <name> — verify every resolved tool path exists and is executable; verify pool dir exists.
  5. Cross-check mode: verify consistency between a target XML and its config/rpm-style macro file (cpu/proc/triple/endian/wrdsz must agree) so the two registries never drift, as they could in the original (where riscv existed only on the rpm side).

4.3 Kernel Makefile consumption of package.mk-style declarations

The UniversalisOS kernel Makefile (universalisos/kernel/Makefile) is currently Bao-style: ARCH/PLATFORM selectors, per-target build/$(ARCH)/$(PLATFORM) trees, object lists cpu-objs-y, plat-objs-y, core-objs-y, lib-objs-y appended by src/arch/$(ARCH)/arch.mk and src/platform/$(PLATFORM)/platform.mk. Adopt the PikeOS package.mk grammar (§3.2) as the package layer underneath the existing selectors, with family prefix uos:

Package layout:

kernel/pkg/<pkg>/
├── package.mk
├── include/...
└── *.c / *.S

package.mk grammar (uos family):

# kernel/pkg/avl/package.mk
ifeq ($(filter base,$(uos_packages)),)
$(error uos/avl requires uos/base)
endif

uos_packages += avl

uos_avl_srcdir  = $(UOS_KERNEL_ROOT)/pkg/avl
uos_avl_incdir  = $(uos_avl_srcdir)/include
uos_avl_incdir_subdirs = uos uos/private
uos_avl_headers = uos/avl.h uos/private/avl.h
uos_avl_options = base remove

uos_avl_base_files    = uos_avl_common.c uos_avl_start.c uos_avl_step.c uos_avl_root.c
uos_avl_base_objects  = $(uos_avl_base_files:.c=.o)
uos_avl_remove_files  = uos_avl_remove.c
uos_avl_remove_objects= $(uos_avl_remove_files:.c=.o)

uos_avl_userlib = 1

Kernel Makefile integration (concrete edits to kernel/Makefile):

  1. After the arch/platform includes, add a package-manifest include:
    UOS_KERNEL_ROOT := $(CURDIR)
    include pkg/manifest.mk        # includes each pkg/<p>/package.mk in dependency order
    
  2. Option selection variable, mirroring PikeOS's per-option object lists:
    UOS_PKG_OPTIONS ?= base          # e.g. "base remove sprintf snprintf"
    
    and a generator that, for each $(p) in $(uos_packages) and each $(o) in $(UOS_PKG_OPTIONS) filtered by $(uos_$(p)_options), appends $(uos_$(p)_$(o)_objects) (prefixed with the package's obj dir) to lib-objs-y.
  3. Include paths: CPPFLAGS += $(addprefix -I,$(foreach p,$(uos_packages),$(uos_$(p)_incdir))) — the exact consumer idiom from share/configmore/*/Makefile.
  4. Compile rule per package: $(OBJ_DIR)/pkg/$(p)/%.o: $(uos_$(p)_srcdir)/%.c with order-only mkdir, keeping the existing per-$(ARCH)/$(PLATFORM) isolation.
  5. Keep the imperative dependency checks ($(error ...) on missing prerequisites) — they are the PikeOS contract's enforcement mechanism and cost nothing.
  6. uos_<p>_userlib = 1 packages additionally feed a libuosuser.a archive target for partition/user-level consumers (parity with the userlib flag semantics).

Migration of the seven mirrored ADT packages (base, crc32, avl, kdev, lheap, list, stand): copy pikeos-mirror/build/adt/kernel/pkg/ (or a shared uos-adt/ repo), rename the adt_ prefix to uos_, rename include namespaces adt/uos/, and scrub the banned token from identifiers (e.g. the include guard of config-format.h, which is the banned token followed by X_KDEV_CONFIG_FORMAT_H, becomes UOS_KDEV_CONFIG_FORMAT_H; the static-assert macro in testframe.h, banned token followed by _STATIC_ASSERT, becomes UOS_STATIC_ASSERT). The kdev binary-config format constants (DRV_CONFIG_SIG 0x148c7ab0, version 10, CRC-from-byte-16, 32/64-bit flags) are re-implemented as UOS_CONFIG_SIG with a new signature value (format is structurally identical but must not collide with PikeOS binaries).

Config-tooling parity (follow-up work items, out of scope for the kernel Makefile but required for full parity):

  • uos-configconv (XML→binary, --endian/--wordsize/--bin/--map), uos-configmore (--xsdinfo, --test), uos-make-cat — the three host tools the share/configmore examples consume.
  • Port share/configmore/dumpbin-xmluos-vmit-dump and offline-testuos-config-offline-test unchanged in structure (they are self-contained examples and the best conformance harness for the binary format).
  • Port the 16 share/profile/*.profile.xml to the uos namespace, renaming variables PIKEOS_*UOS_* and pool paths CUSTOM_POOL/<x>/object unchanged in shape.
  • Port share/hwvirt-linux/ drivers, renaming the virtual bus (reference-product abbreviation + bus) → uosbus (file names, Kconfig symbols, device names) and headers pikeos-headers/uos-headers/.

5. Parity Gap Summary

PikeOS feature Mirror evidence UniversalisOS action
7-slot freestanding CDK, gcc 7.4.0 / binutils 2.31 cdk/*/lib/gcc/*/7.4.0, ldscript comment uos-cdk pins 7.4.0/2.31; add riscv/rv64 slot (spec'd by PikeOS's own config/rpm/targets/riscv_rv64-linux)
PikeOS ldscripts (2-PHDR, 0x08010000 base, ._vm_stack) armelf_pikeos_eabi.x*, elf32*ppcpikeos.x* armelf_uos_eabi.x* / elf32*ppcuos.x* with renamed stack symbols
Certifiable libgcc subset (22 fns) libgcc_cert.h in 4 slots libuosgcc_cert.a + uos_libgcc_cert.h, same semantics
Target-definition XML (23 req + 1 opt attr, XSD 1.1) share/definition/, share/xsd/<product>/targetdefinition-1.1.xsd uos-target loader/validator, re-namespaced schema, 8 instances
package.mk grammar (family prefix, options, dep checks, userlib flag) build/adt/*/package.mk adopt as uos_<pkg>_* in kernel/pkg/; wire into kernel/Makefile via pkg/manifest.mk + UOS_PKG_OPTIONS
Binary config format + conv/more/make-cat tools config-format.h, share/configmore/ uos-configconv/configmore/make-cat; new UOS_CONFIG_SIG; port dumpbin + offline-test harnesses
IDE profiles (16) share/profile/*.profile.xml port to uos namespace, PIKEOS_*UOS_*
Linux hw-virt drivers share/hwvirt-linux/ port, rename bus to uosbus

Document generated from the mirrored tree at ~/portugalfuturista/universalisos/pikeos-mirror/; all cited paths are relative to that root unless absolute.