Build System Overview

Document Revision: 26h1.0


1. Prerequisites

ToolMinimum versionNotesRequired
CMake3.10Build system generatortrue
Compiler and toolstoolchain-specificSee toolchains.mdpartly
NinjaanyRecommended generatoroptional
dasdloadanyNeeded for image generation (optional)optional
Hercules4.xHelpful for developmentoptional

2. Output Artifacts

ArtifactDescriptionConverted from
core.zxfoundationloader00.sysStage 0 IPL record (tape format)zxfl_stage1.elfzxfl_stage1.bin
core.zxfoundationloader01.sysStage 1 flat binaryzxfl_stage2.elf
core.zxfoundation.nucleusKernel ELF64 (SHA-256 checksums patched in)N/A
sysres.3390Hercules 3390 DASD imageN/A
bin2recHost toolN/A
zxsignHost toolN/A

3. CMake Modules

ModulePurpose
cmake/dependencies.cmakeHost dependency checks
cmake/configuration.cmakeOPT_LEVEL, DSYM_LEVEL cache variables
cmake/platform.cmakePlatform detection
cmake/standard.cmakeC standard enforcement
cmake/hosttools.cmakeBuild bin2rec and zxsign with host compiler
cmake/source.cmakeKernel source file lists (ZX_SOURCES_64)
cmake/zxfl-compile.cmakeZXFL Stage 0 and Stage 1 targets
cmake/zxfoundation-compile.cmakeKernel nucleus target
cmake/run.cmakedasd target — generates sysres.3390

4. Build Order

CMake enforces the following dependency chain:

tools  (bin2rec, zxsign — host compiler)
  │
  ├─► zxfl_stage1.elf
  │     └─► zxfl_stage1.bin  (objcopy)
  │           └─► core.zxfoundationloader00.sys  (bin2rec)
  │
  ├─► zxfl_stage2.elf
  │     └─► core.zxfoundationloader01.sys  (objcopy)
  │
  └─► core.zxfoundation.nucleus
        └─► zxsign patches .zxvl_checksums in-place
              └─► sysres.3390  (dasdload)

Host tools are always compiled first with ZX_HOST_CC. The kernel and loader are compiled with the cross-compiler.


5. Configuration Variables (non-toolchain-specific, for toolchain-specific, see toolchains.md)

VariableDefaultDescription
OPT_LEVEL2-O level for all targets
DSYM_LEVEL0-g level (0 = no debug info)

Override at configure time:

cmake -B build \
  -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain/zxfoundation-clang.cmake \
  -DOPT_LEVEL=3