为另一种架构重建 linux 内核模块

Rebuild linux kernel module for another architecture

假设我有 machine with some version of Linux kernel. And I have directory with kernel sources of another version. The kernel was built for arch 并加载到适当的设备。
现在我只需要在这个大目录中重建一个内核模块。
我阅读了 this post 并尝试了

make path/to/the/module/itself.ko

,但它为 amd64 构建模块。

当我尝试时

make M=path/to/the/module/

它给出了一堆与 arch 相关的 C 错误。

有人可以解释一下如何轻松使用这个 ARM 就绪环境来重建一些内核模块吗?

你可以试试:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- M=path/to/the/module/

另请阅读:

Cross compiling a kernel module

gcc-arm-linux-gnueabi command not found