kolibrios-gccgo-sdk
Bootstrap Go SDK for building KolibriOS applications with gccgo.
What This Repo Provides
- KolibriOS syscall ABI stubs and runtime glue (
platform/abi/) - Go bindings and higher-level wrappers (
platform/kos/) - Stdlib shims for the current bootstrap subset (
stdlib/) - Example apps and fuller utilities (
apps/,apps/examples/) - DLL-style libraries (
libs/) - Shared build logic and linker/startup templates (
tooling/) - Third-party sources vendored under
third_party/
Repository Layout
apps/- fuller KolibriOS utilities built on the same bootstrap SDKapps/cmm/- ports from C-- sources (prefixes removed)apps/examples/- curated public demo applicationsdocs/- bootstrap and build documentationlibs/- DLL-style library implementationstemplates/- app templates for new projectsplatform/abi/- syscall assembly stubs and runtime glue used during linkingplatform/kos/- raw Go bindings and small higher-level wrapperstooling/- shared bootstrap make logic and linker templatesstdlib/- bootstrap-compatible stdlib shim sourcesstdlib/ui/- minimal UI helpers built on top ofkosthird_party/- external dependency sources (for examplegithub.comandgopkg.in)build-app.sh- build a single appbuild-lib.sh- build a DLL-style librarynew-app.sh- scaffold a new example appnew-lib.sh- scaffold a new librarysysfuncs.txt- KolibriOS system function specificationAGENTS.md- repository instructions for future agent work
Build Requirements
The current build is intended for Linux or WSL. The supported bootstrap host is Ubuntu 24.04 or WSL Ubuntu 24.04.
Install the toolchain with your package manager:
gccgccgogcc-multilibgccgo-multilibmakenasmbinutilsmtoolsqemu-system-x86
To avoid system installs, you can drop prebuilt binaries into tooling/bin.
The build prefers these when present: gccgo-15/gccgo, gcc, ld, strip,
nasm, and objcopy.
The repo currently ships tooling/bin/nasm, tooling/bin/as,
tooling/bin/objcopy, tooling/bin/strip, and tooling/bin/ld for
Linux x86_64, plus
tooling/bin/i386-elf-objcopy for COFF conversion.
Quick Start
Use build-app.sh for apps and build-lib.sh for DLL-style .obj libraries.
Build one target by path:
./build-app.sh apps/examples/uiwindow
Build by short name (searched under apps/ and apps/examples/):
./build-app.sh uiwindow
Clean a target:
./build-app.sh uiwindow clean
Build a KolibriOS DLL-style .obj library:
./build-lib.sh mylib
Library targets should include tooling/kolibri-lib.mk in their Makefile and
provide an exports.txt file. Example:
# export_name(argcount) -> GoFunc
hello(0) -> Hello
version(0) -> Version
Each line maps an export name to a Go function. -> and = are both accepted
as separators. The optional (argcount) suffix is required when C stubs are
generated (default). If the right-hand side is omitted, the export name is used
as the Go function name. Prefix with @ to use a raw symbol name (no Go
prefixing).
The default build generates stdcall C stubs from exports.txt. Set
EXPORTS_STUBS_MODE=bootstrap in a library Makefile to build an entrypoint-style
library that calls runtime_kolibri_start for its exported function.
Build all apps/examples in one pass (full rebuild, then clean artifacts except
.kex):
./make-all.sh
Build with KPack compression (uses the bundled tooling/bin/kpack by default):
./build-app.sh --kpack uiwindow
./make-all.sh --kpack
Create a new scaffolded app:
./new-app.sh demo "KolibriOS Demo"
Create a new scaffolded library:
./new-lib.sh mylib
The output .kex is written next to each target, for example
apps/examples/uiwindow/uiwindow.kex.
Library .obj outputs are written next to each library target.
Notes
sysfuncs.txtis the source of truth for syscall numbers and register conventions.tooling/kolibri-app.mkandtooling/kolibri-lib.mkaccept orderedPACKAGE_DIRSand can resolve imports fromplatform/(first-party) andthird_party/.- The build defaults to
gccgo-15; override withGO=gccgoif your binary name differs. - Builds now reuse package and ABI artifacts from
.build-cache/by default. - Set
KEEP_PKG=0orKEEP_ABI=0to disable cache reuse for a build. - Set
FAST_PKG=1to avoid package rebuild cascades in batch builds. - Use
make clean-cacheormake distcleanin a target directory to drop the shared build cache. - Set
KPACK=1to runkpackon the final.kex(override the binary withKPACK_BIN=/path/to/kpack). - Library-only knobs (via
tooling/kolibri-lib.mk):OBJ_FORMAT=coff-i386(default),OBJ_WITH_LIBGCC=1,OBJ_EXTRA_OBJS=...,OBJ_REQUIRE_EXPORTS=0. - The bootstrap runtime now supports goroutines/channels and a multi-threaded
scheduler. Use
runtime.GOMAXPROCSto configure the runtime thread count. - See
apps/examples/goroutinesfor channel scheduling andapps/examples/threadsfor multi-thread slot sampling. - CI uploads built
.kexfiles directly as thekex-artifactsworkflow artifact and runskpackby default. Grab it from the latest run in the Actions build workflow: Actions build workflow. .kex,.obj,.gccgo.o,.gox,.o,.pkg/, and.build-cache/build outputs are ignored by git.- The bundled
tooling/bin/kpackis a Linux x86_64 binary; overrideKPACK_BINon other hosts.
Docs
docs/BUILD.mddocs/NATIVE_PORT.mddocs/NATIVE_OWNERSHIP.mddocs/NATIVE_GOTREE_PLAN.mddocs/NATIVE_BRINGUP_CHECKLIST.md
License
Unless otherwise noted, the original code and documentation in this repository are available under the MIT license in LICENSE.
Third-party materials keep their upstream license status. In particular, sysfuncs.txt is not relicensed under MIT; see THIRD_PARTY_LICENSES.md.