简体   繁体   中英

cross compile raspberry pi kernel module

So I have been trying to learn more about developing linux drivers with Linux Device Drivers version 3. Using a spare Rasberry Pi (b) I had kicking around.

I used http://www.raspberrypi.org/documentation/linux/kernel/building.md to build the the kernel in my ~/kernelWork/kernel folder. I have also compiled the kernel and have it running on my raspberry pi to avoid compatibility issues.

The issue I have is I know I need to cross compile the module source to work with the ARM architecture, but I'm not sure where to point the -C flag of the command

make -C ~/kernel-2.6 M=`pwd` modules

command to make my module with. I took a look into my arch folder of my kernel, and looked in the ARM directory included there, but from there I'm not sure where to go.

So in short, after I have built my kernel where do I point the -C flag to cross compile my module.

I had to set my Makefile to cross compile with the settings

all:
    make ARCH=arm CROSS_COMPILE=${CCPREFIX} -C /home/jacob/kernelWork/kernel M=$(PWD) modules


clean:
    make -C /home/jacob/kernelWork/kernel M=$(PWD) clean

As well as setting my environment variables KERNEL_SRC and CCPREFIX to my kernel source, and the raspberry compiler I pulled from the git source. This page has the full details

http://bchavez.bitarmory.com/archive/2013/01/16/compiling-kernel-modules-for-raspberry-pi.aspx

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