简体   繁体   English

为32位cpu编译Linux内核模块

[英]Compile Linux kernel module for 32bit cpu

I am learning how to make a Linux kernel module and i want to compile it for a 32bit CPU. 我正在学习如何制作Linux内核模块,并且希望将其编译为32位CPU。 How can I do that? 我怎样才能做到这一点?

My current command to compile the kernel (which defaults to 64bit) is: 我当前用于编译内核的命令(默认为64位)是:

obj-m += test.o

all:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

In gcc, I would use the -m32 flag but in this case, I don't know how the Kernel compilation works, so I don't know what to change. 在gcc中,我将使用-m32标志,但是在这种情况下,我不知道内核编译的工作方式,因此我不知道要更改什么。

You need to cross compile the module. 您需要交叉编译模块。 Please take a look at this page http://kernelnewbies.org/FAQ/KernelCrossCompilation . 请查看此页面http://kernelnewbies.org/FAQ/KernelCrossCompilation

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM