Skip to content

compile.sh

Top-level build orchestrator for the Asuro kernel.

Overview

compile.sh is the main entry point for building the Asuro operating system. It sequentially invokes each stage of the build pipeline, halting on the first failure. After all stages complete (or a failure occurs), it calls compile_finish.sh to generate a build-status badge and set the exit code.

Prerequisites

  • All sub-scripts must be present in the same directory as compile.sh.
  • The Docker build container must provide: bash, nasm, fpc, gcc, ld, grub-mkrescue, git, wget, and standard POSIX utilities.

Inputs

None directly. Each sub-script reads its own inputs from the source tree.

Outputs

  • All artifacts produced by the sub-scripts (object files, kernel binary, ISO image, version info, badges, documentation).
  • Final exit code: 0 on success, 1 on failure.

Behavior

  1. Clears the lib/ directory to ensure a clean build.
  2. Defines a helper function runOrFail that runs a command and increments ERRCOUNT on failure.
  3. Resolves its own directory (TOOLCHAIN_DIR) so sub-scripts can be located by absolute path.
  4. Declares an ordered list of build steps (script name and error message pairs):
  5. compile_stub.sh -- Assemble boot stubs.
  6. compile_vergen.sh -- Generate version information.
  7. compile_lvgl.sh -- Compile the LVGL graphics library.
  8. compile_wasuro.sh -- Pull the Wasuro WASM runtime sources.
  9. compile_sources.sh -- Compile Free Pascal kernel sources.
  10. compile_link.sh -- Link all object files into kernel.bin.
  11. compile_isogen.sh -- Create the bootable ISO image.
  12. compile_docs.sh -- Generate project documentation.
  13. Iterates through the steps. If ERRCOUNT is non-zero, all remaining steps are skipped.
  14. Calls compile_finish.sh with either "success" or "failed" depending on whether any errors were recorded.
  15. Changes directory back up one level (cd ..).

Notes

  • compile_finish.sh is sourced (. script) rather than executed as a sub-process, so its exit call terminates the entire pipeline.
  • The build is fail-fast: the first failing step prevents all subsequent steps from running, but the finish step always runs to produce a status badge.