Thursday, 11 December 2014

Cross compile kernel modules from rootfs to target ARM


If you are compiling for x86 should specify the kernel headers directory as /lib/modules/linux-3.7.2-2-ARCH/build. For cross-compiling either we will be downloading the linux source or use the linux source provided by the SOC manufacturer. Kernel header of the downloaded linux source has to be specified for compilation. Suppose have your downloaded linux source under /opt directory then sample "Makefile" would look like this obj-m += name-of-driver.o make -C /opt/linux(specify full version) M=${PWD} modules. Have to install the cross compiler and export i.e. export PATH=$PATH:/absolute path where your cross-compiler binaries are present. While compiling using make utility provide make ARCH=arm(Target for which you are compiling) CROSS_COMPILE=arm-none-linux-gnueabi-. Once all these procedure are followed you will be successfully compiling your kernel module for target.





No comments:

Post a Comment