A minimalist userspace runtime that loads and executes baka binaries — a freestanding ELF-derived binary format designed for self-contained, relocatable applications.
tsundere-runtime reads a compiled .baka artifact, validates its header,
maps it into memory with appropriate permissions (executable .text, readable
.data), resolves the baka_main entry symbol, and transfers control. It
ships with a small SDK (baka_sdk) for authoring baka applications in C or Zig.
The project is written entirely in Zig and targets Linux on x86_64 in its current prototype stage.
- Custom binary loader. Parses raw ELF headers, walks the section header table, the string table, and the symbol table to locate sections and entry symbols at runtime.
- Two input shapes. Accepts either a native baka binary (magic
0x62616B61) or a standard ELF executable carrying a.baka_headersection, resolving the entry point via the.symtabsymbol table. - Memory-mapped execution. Uses
mmap/mprotectto map binaries read-only and selectively promote the.textsection toREAD|EXECon page boundaries. - baka SDK. A header (
baka.h) and Zig module (baka.zig) defining theBakaHeader,BakaElfHeader,BakaElfSection, andBakaElfSymbollayouts, plus anAPIstruct exposing host-provided functions (e.g.text_render) to guest applications. - Freestanding guest toolchain. A linker script (
linker.lds) places the baka header at offset0x0and.textat0x40, producing raw position-independent blobs suitable for direct execution.
.
├── build.zig # Top-level build: emits the `tsundere` executable
├── build.zig.zon # Zig package manifest
├── src/
│ ├── tsundere_runtime.zig # Entry point: arg parse, mmap, mprotect, run
│ ├── loader/
│ │ ├── loader.zig # baka header validation + baka_main dispatch
│ │ └── elf_loader.zig # ELF section / symbol resolution
│ └── os/
│ └── os.zig # Thin mmap / mprotect platform layer
└── baka_sdk/
├── baka.h # C API and struct definitions for guests
├── baka.zig # Zig API and struct definitions for guests
├── build.zig # Build for a freestanding baka guest
├── linker.lds # Linker script for baka binaries
└── example/
├── main.c # Example guest application
├── Makefile # gcc + ld + objcopy build for the example
└── linker.lds
- Zig 0.16.0 or later (the runtime build).
- gcc / ld / objcopy (only if you wish to build the C example guest with the provided Makefile).
zig build # produces zig-out/bin/tsundere
zig build run -- path/to/app.bakacd baka_sdk/example
make # produces app.baka from main.ccd baka_sdk
zig build # produces app.bakatsundere <app.baka>
The runtime opens the given path, mmaps it privately, aligns the .text
section to the page boundary, marks it executable, and jumps to baka_main.
A guest application receives a pointer to an API struct and may invoke
host-provided callbacks:
void baka_main(const API* api) {
api->text_render(0, 0, "hello from baka");
}This is a prototype. The loader is intentionally naive: it identifies the
baka_main symbol, maps the binary, and runs it. Open work tracked in the
source includes:
- Routing all baka loads (including child baka) through the IO thread, with the first baka becoming the process-zero/root.
- Assembling a baka from multiple smol-baka fragments fetched over the Baka Delivery Network, requiring dynamic linking and relocation resolution.
- A controlled export mechanism so a parent baka can expose
AppBehaviourAPIs to child baka without breaching the per-arena sandboxing contract.
tsundere-runtime is the host half of a "baka" application ecosystem. Baka
apps are small, freestanding, self-describing binaries that declare their
memory and version requirements in a header the runtime can cheaply validate.
The long-term goal is a networked runtime where baka binaries are fetched,
assembled, sandboxed, and executed on demand — closer in spirit to a dynamic
linker fused with an HTTP client than to a traditional process loader.
To view the development source code and contribute, contact the author at:
souls.syntax [at] gmail [dot] com
Copyright (C) 2026 souls-syntax (Aakarsh).
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.
The author does not consent to the use of this project, its source code, its binary artifacts, or any derivative work thereof for the training, fine-tuning, evaluation, distillation, or benchmarking of machine learning models, large language models, or any other artificial intelligence system, whether for commercial, academic, or personal purposes. This prohibition applies regardless of license grants above and survives any redistribution or modification of the work. If the law of your jurisdiction treats such a clause as a non-negotiable term, then the license granted herein is void as to you and you must refrain from all use of the work.