Operating system for the Dioptase system
The Makefile in Dioptase-OS/ builds a test program from a C file under tests/
links it with kernel sources to produce kernel-mode bin/hex outputs in build/.
These tools are expected to be built already (default VERSION=release):
../Dioptase-Languages/Dioptase-C-Compiler/build/$(VERSION)/bcc../Dioptase-Assembler/build/$(VERSION)/basm../Dioptase-Emulators/Dioptase-Emulator-Full/target/$(VERSION)/Dioptase-Emulator-Full
make bios.hexbuilds the BIOS image atbuild/bios.hex.make allbuilds the fixed kernel image and every program with aroot/*/Makefile, placing guest executables underroot/sbin/.make bios.labelswrites label lines (#...) frombuild/bios.hextobuild/bios.labels.make <test>.bincompilesDioptase-OS/tests/<test>.c, compiles allkernel/*.c, assembles them along with anykernel/*.s, and writesbuild/<test>.bin.make <test>.hexwrites the kernel hex image tobuild/<test>.hex.make <test>.labelswrites label lines (#...) frombuild/<test>.hextobuild/<test>.labels.make <test>buildsbuild/bios.hex+build/<test>.binand runs the full emulator.- If
tests/<test>.direxists,make <test>also writes the final SD1 image tobuild/<test>.sd1.out.ext2and attempts to extract it intotests/<test>.out.dir. make <test>.testruns the emulatorTEST_RUNStimes, writestests/<test>.raw, filters lines starting with***intotests/<test>.out, compares totests/<test>.ok, and printssuccesses/runs. A run fails on timeout, non-zero exit, or iftests/<test>.rawcontainsWarningorSpuriousorPANIC.make <test>.failis the same as.testbut stops on the first failure.make testruns every test that has a checked-intests/<test>.okortests/<test>.panicbaseline through the quiet.summary-testpath.make extruns the ext2-related baseline-checked subset:ext_read,ext_new_file,ext_write,ext_rename, andext_delete.make threadsruns every baseline-checkedthreads_*test.make datastructsruns the baseline-checked utility tests:hashmap_test,queue_test, andstring.make heapruns the baseline-checkedheap_*allocator tests. Heap panic-mode negative checks run only whenHEAP_DEBUG=yes.make cleanremoves build outputs and temporary assembly outputs.
VERSION(defaultrelease) selects the toolchain and emulator build.NUM_COREScontrols how many emulator cores to run.TEST_RUNScontrols the number of test iterations.SCHEDULERcontrols the emulators scheduling for multicore runs. Options arefree,random, andrr(round robin)TIMEOUT_SECONDScontrols the per-run timeout for.test/.fail.HEAP_DEBUG=yespasses-DHEAP_DEBUG=1to kernel/test C builds and enables heap bitmap/poison diagnostics.make testandmake heapskip theheap_*.panicnegative tests when this is notyes.BLOCK_SIZEcontrols the ext2 block size used for tests withtests/<test>.dir.- The aggregate targets
make test,make ext,make threads,make datastructs, andmake heapall honorTEST_RUNS,TIMEOUT_SECONDS,BLOCK_SIZE,NUM_CORES,SCHEDULER,EMU_VGA,EMU_AUDIO,EMU_AUDIO_FAST, andTRACE_INTS. EMU_FLAGScan include--trace-intsif you want information printed about each interrupt.EMU_VGA=yesappends--vgato the emulator flags and assembleskernel/config.sandbios/config.swith-DUSE_VGA=1. Otherwise those files are assembled with-DUSE_VGA=0.EMU_AUDIO=yesappends--audioto the emulator flags and assembleskernel/config.sandbios/config.swith-DUSE_AUDIO=1. Otherwise those files are assembled with-DUSE_AUDIO=0. If the cached emulator binary predates audio CLI support, the harness rebuilds it before running.EMU_AUDIO_FAST=yesappends--audio-fastinstead of--audioand also assembleskernel/config.sandbios/config.swith-DUSE_AUDIO=1. This mode is for host listening only; it intentionally changes guest-visible audio timing so playback stays close to wall clock even when emulation is slow.
- Generated assembly files are named
*.sand kept after assembly. - Kernel C assembly outputs live under
build/kernel/to keep them separate from the root test's assembly file. - The aggregate test targets only include tests with checked-in
.okor.panicbaselines, just likemake test. superblockis left as an explicit one-off target instead of part ofmake extbecause its checked-in baseline depends on the ext2 image geometry.- Tests with
tests/<test>.diruse that directory to build an ext2 image for SD1; the harness tries to extract the final SD1 contents intotests/<test>.out.dirafter emulator runs so filesystem side effects can be inspected on the host. - The makefile also compiles the BIOS. The emulator is run with the BIOS in ram and the kernel on the sd card, the bios loads the kernel and then jumps to it
- The makefile was generated by Codex, and I occasionally use Codex to generate comments/documentation
- The heap, threads, semaphores, and ref counting are ports of Gheith's kernel