Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Mic92/zig.ko
Linux kernel module written in Zig
https://github.com/Mic92/zig.ko
Last synced: 3 months ago
JSON representation
Linux kernel module written in Zig
- Host: GitHub
- URL: https://github.com/Mic92/zig.ko
- Owner: Mic92
- License: gpl-2.0
- Created: 2019-08-11T10:45:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-11T11:05:46.000Z (over 5 years ago)
- Last Synced: 2024-05-02T00:19:16.320Z (7 months ago)
- Language: Makefile
- Homepage:
- Size: 10.7 KB
- Stars: 82
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# Linux kernel module written in Zig
This is a proof-of-concept on how to integrate [zig](https://ziglang.org/) into
Linux kernel modules.## USAGE
This assumes that you kernel headers installed.
In Debian based systems can be done using `apt-get install linux-headers-$(uname -r)`.```console
$ make
$ sudo insmod ./zig.ko
$ sudo rmmod zig
$ dmesg | grep 'kernel!'
[41188.642871] Hello kernel!
[41190.975214] Goodbye kernel!
```If your Linux distribution does not install kernel headers to
`/lib/modules/*/build`, you can also set the `KERNELDIR` environment variable:```console
make KERNELDIR=/path/to/headers/build
```On NixOS spawn a nix-shell from the project root:
```console
nix-shell --command "make"
```You might need to replace the Linux package in `default.nix` with the package matching your
loaded kernel.