CLLM
A bare-metal C unikernel for serving large language models — Multiboot-compliant, boots on x86 hardware (or in QEMU) without an operating system. Includes a custom HTTP server with llama.cpp-compatible REST API.
Status: Experimental. Boots and serves LLM inference on x86 bare metal or QEMU. Hobbyist, embedded, and educational use. Not production-ready. Track on GitHub: cognisoc/cllm — file issues, watch releases.
What is CLLM
CLLM is a Multiboot-compliant unikernel written in C that boots directly on bare metal (or in QEMU) and serves LLM inference over HTTP. It eliminates the operating system layer entirely — the kernel is the application.
The kernel includes a custom libc subset, PCI bus enumeration, an Intel e1000 NIC driver, an HTTP server with REST API endpoints, and a model loading interface compatible with llama.cpp.
Why a unikernel
For some workloads, an OS is overhead. CLLM is for people who want to:
- Understand how an OS interacts with hardware by writing one.
- Serve a model with the absolute minimum software stack between hardware and inference.
- Embed a model server in a headless appliance that boots straight into the model.
- Learn OS development using LLM inference as a concrete, modern use case.
CLLM is not a replacement for Ollama, vLLM, or TGI. It is an experiment in how little software is required to serve an LLM.
Architecture
+-----------------------------------------------------------+
| QEMU / Bare Metal (x86, Multiboot) |
+-----------------------------------------------------------+
| boot.S Multiboot entry, stack, serial init |
| kernel.c Kernel main, VGA terminal, serial I/O |
| memory.c Heap allocator (malloc/free) |
| string.c libc subset (snprintf, memcpy, ...) |
| network.c PCI enumeration + e1000 NIC driver |
| http.c / api.c HTTP server, request routing |
| api_v1.c llama.cpp-compatible REST API |
| llm.c Model loading and inference interface |
+-----------------------------------------------------------+
The kernel boots via Multiboot, initializes serial and VGA output, brings up an e1000 network interface via PCI, and enters a packet-processing loop that serves HTTP requests for LLM inference.
Quick start
# Prerequisites: gcc (with -m32 support), make, qemu-system-i386
sudo apt-get install gcc gcc-multilib make qemu-system-x86
# Build and run
git clone git@github.com:cognisoc/cllm.git
cd cllm
make run
Serial output appears on your terminal. Press Ctrl-A X to exit QEMU.
Build targets
| Target | Description |
|---|---|
make | Build release kernel (build/kernel.bin) |
make debug | Build with debug symbols |
make run | Build and boot in QEMU (serial on stdio) |
make run-vga | Build and boot in QEMU (VGA window) |
make run-debug | Build and boot paused for GDB on :1234 |
make clean | Remove build artifacts |
HTTP API
CLLM exposes a llama.cpp-compatible REST API on port 80, including:
POST /v1/completions— text completionPOST /v1/chat/completions— chat-style completionGET /v1/models— list loaded modelsGET /health— health check
The shape of the responses matches llama.cpp’s server mode, so existing clients (OpenAI SDK, LangChain, LlamaIndex) work unchanged.
Hardware
Currently tested on:
- CPU: x86 (32-bit Multiboot)
- NIC: Intel e1000 (QEMU’s default emulated NIC)
- RAM: 256MB minimum, more recommended for larger models
- Disk: none (model loaded from initrd or network)
ARM64 and VirtIO NIC support is on the roadmap.
When to Use CLLM
CLLM is the right tool when you are:
- Learning OS or kernel development and want a concrete, runnable project that does something useful.
- Building an embedded LLM appliance that boots straight into the model with no OS layer.
- Researching unikernel architectures for AI workloads.
- Wanting to understand what your OS is doing for you when you run Ollama.
CLLM is not the right tool when:
- You need production reliability, observability, or horizontal scaling. Use a Linux server + Ollama/vLLM.
- You need a real NIC driver beyond e1000. Most cloud NICs are virtio, not e1000.
- You need anything other than x86 32-bit. ARM64 and 64-bit x86 are not yet supported.
- You want a polished CLI. CLLM has a serial console and an HTTP API; that’s it.