尝试在 Windows 子系统中编译内核模块以获得 Linux 错误

Trying to compile kernel module in Windows Subsystem for Linux error

当我 运行 从这个网站创建这个 makefile 后 http://www.tldp.org/LDP/lkmpg/2.6/html/x181.html

当我 运行 在 WSL 中获得 make -C /lib/modules/4.4.0-17134-Microsoft/build M=/mnt/c/Users/tdwil/OneDrive/code/Documents/cfiles/systems/linuxkernel modules

make[1]: *** /lib/modules/4.4.0-17134-Microsoft/build: No such file or directory. Stop.

Makefile:5: recipe for target 'all' failed

make: *** [all] Error 2

这是因为在 WSL 中无法进行 make 吗?还是我输入的目录有误?

首先,你在WSL上没有Linuxheader。 Windows 的另一个问题是 Linux 内核有几个大小写不同的文件名。

最好在 Linux 机器或 VM 上编译内核或内核模块。