Home:ALL Converter>Cross Compile Linux Kernel Module

Cross Compile Linux Kernel Module

Ask Time:2014-01-07T18:41:14         Author:tzippy

Json Formatter

I am looking into cross compiling a kernel module for an ARM linux. I have my toolchain installed. But there's something I am not quite getting from various how-tos. The module I want to build is gadgetfs.

The kernel version on my host is 3.5.0-34-generic while on the target it's 3.6.9-0.1

Now what kernel sources or headers do I actually need to download and install, and where? I downloaded linux-3.6.9.tar.bz2 from kernel.org and extracted it. In drivers/usb/gadget/ there's a Makefile and according to this site I need to append these lines to it, then run make:

KDIR := /lib/modules/`uname -r`/build
PWD := `pwd`
obj-m := dummy_hcd.o gadgetfs.o
default: 
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

But what do i have to replace uname -r with? Cause this would give me my host's kernel version. But my target version is different. Where is the /lib/modules/3.6.9 folder? CROSS_COMPILE and ARCH is both set.

Author:tzippy,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/20969523/cross-compile-linux-kernel-module
yy