Modules and Apps
Develop kernel modules and userspace applications with ELMOS.
Kernel Modules
Section titled “Kernel Modules”Create Module
Section titled “Create Module”./build/elmos module new <name>Generates template in examples/modules/<name>/ with Makefile and <name>.c.
Build Module
Section titled “Build Module”cd examples/modules/<name>make # Uses detected toolchainOutputs .ko file.
Example Template
Section titled “Example Template”#include <linux/module.h>#include <linux/kernel.h>
static int __init hello_init(void) { pr_info("Hello, ELMOS!\n"); return 0;}
static void __exit hello_exit(void) { pr_info("Goodbye, ELMOS!\n");}
module_init(hello_init);module_exit(hello_exit);MODULE_LICENSE("GPL");Load in QEMU
Section titled “Load in QEMU”After booting kernel:
insmod /path/to/module.kodmesg | tailUserspace Apps
Section titled “Userspace Apps”Create App
Section titled “Create App”./build/elmos app new <name>Generates template in examples/apps/<name>/ with Makefile and <name>.c.
Build App
Section titled “Build App”cd examples/apps/<name>make # Cross-compiles for targetOutputs executable.
Example Template
Section titled “Example Template”#include <stdio.h>
int main() { printf("Hello from ELMOS app!\n"); return 0;}Run in QEMU
Section titled “Run in QEMU”Copy to rootfs and execute:
# In hostcp examples/apps/<name>/<name> build/rootfs/
# In QEMU./<name>Cross-Compilation
Section titled “Cross-Compilation”- Auto-detects toolchain based on
./build/elmos arch - Sets
CROSS_COMPILEandPATH - Falls back to LLVM if no toolchain
Templates
Section titled “Templates”Customize templates in assets/templates/.
Examples
Section titled “Examples”See examples/ for sample modules (e.g., char-test, hello-world) and apps.