简体   繁体   中英

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. How can I do that?

My current command to compile the kernel (which defaults to 64bit) is:

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.

You need to cross compile the module. Please take a look at this page http://kernelnewbies.org/FAQ/KernelCrossCompilation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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