Skip to content

Modules and Apps

Develop kernel modules and userspace applications with ELMOS.

Terminal window
./build/elmos module new <name>

Generates template in examples/modules/<name>/ with Makefile and <name>.c.

Terminal window
cd examples/modules/<name>
make # Uses detected toolchain

Outputs .ko file.

#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");

After booting kernel:

Terminal window
insmod /path/to/module.ko
dmesg | tail
Terminal window
./build/elmos app new <name>

Generates template in examples/apps/<name>/ with Makefile and <name>.c.

Terminal window
cd examples/apps/<name>
make # Cross-compiles for target

Outputs executable.

#include <stdio.h>
int main() {
printf("Hello from ELMOS app!\n");
return 0;
}

Copy to rootfs and execute:

Terminal window
# In host
cp examples/apps/<name>/<name> build/rootfs/
# In QEMU
./<name>
  • Auto-detects toolchain based on ./build/elmos arch
  • Sets CROSS_COMPILE and PATH
  • Falls back to LLVM if no toolchain

Customize templates in assets/templates/.

See examples/ for sample modules (e.g., char-test, hello-world) and apps.