Skip to content

Latest commit

 

History

History
54 lines (38 loc) · 901 Bytes

File metadata and controls

54 lines (38 loc) · 901 Bytes

wsl-kernel-module

A simple WSL kernel module meant as a demonstration on how to develop linux kernel modules under WSL.

Version

This was developed for WSL2 Kernel 5.15.19.X but should work on all versions as long as you up/downgrade the submodule.

How to use

Please note that you might have to change the WSL submodule branch depending on your WSL instance. It should match whatever is returned when typing:

uname -r

Compile / Configure Kernel

Copy your config over:

zcat /proc/config.gz > .config

Compile the kernel:

make -j $(nproc)

Install:

sudo make -j $(nproc) modules_install

Compile Module

cd kernel_module
make

Congratulations, you should now have a working kernel module called main.ko. Try loading it via:

sudo insmod main.ko

and look at what it prints via:

dmesg