Cross Compiling Linux Arm Kernel with new driver module
You have done two mistake in kernel building procedure.
1)before make menuconfig
you need to have a .config
file should exit in source-code.
How u can get it
1) make ARCH=arm board_defconfig
check your default config in /arch/arm/configs
e.g make ARCH=arm versatile_defconfig
this will write default
configuration to .config
2)if you dont know your default configuration you can get it in target board Filesystem.
it will be in /proc/config.gz copy to your host untar it and copy as .config
in top source-code.
or it may present in /boot/config.x.x.x
if dont follow above step make ARCH=arm menuconfig this will copy host x86 config file from /boot/config-x.x.x which will be wrong config file
Once above step is done then next step make ARCH=arm menuconfig here enable your driver.
2nd mistake is make ARCH=arm CROSS_COMPILE=/home/z3/bin/arm- modules_install
This will install modules in /lib/modules of x86 host machine.
so follow below one
make ARCH=arm CROSS_COMPILE=(path to arm) uImage modules
create a directory to install your dynamic loadable modules
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules_install INSTALL_MOD_PATH=<path to install modules>
Then you need to copy modules to your target.
For more details you can refer this Just black screen after running Qemu
Cross compiling a kernel module ARM
For a quick fix, change your Makefile as below.
KERNEL_DIR=/home/user/script_emulation/AODV/kernel
KERNEL_INC=$(KERNEL_DIR)/include THIS_DIR=$(shell pwd)
obj-m += kaodv.o kaodv-objs := kaodv-mod.o kaodv-debug.o kaodv-netlink.o kaodv-queue.o kaodv-ipenc.o kaodv-expl.o
default:
$(MAKE) ARCH=arm CROSS_COMPILE=arm-oe-linux-gnueabi- -C $(KERNEL_DIR) SUBDIRS=$(THIS_DIR) modules
Also make sure you set the cross compiler toolchain path before running make using
export PATH = $PATH:PathToToolchain.
Also check whether the kernel you have compiled earlier is also compiled for ARM Architecture.
Cross compile Kernel drivers
Those are x86 compiler options.
You probably need to add ARCH=arm
.
Cross Compile Linux Kernel Module
You need to cross compile (or download pre-compiled) matching version of Linux for your target on your host machine with right configuration since Linux doesn't have a stable binary API. Host's kernel version is not relevant.
After having target build available on your host you can build a module via
make -C kernel_build_dir M=`pwd` ARCH=arm CROSS_COMPILE=<...> modules
under that module's directory.
Related Topics
Setting Up Jenkins Slave on MAC Os
How to Enable/Disable Kernel Kaslr, Smep and Smap
Bash Script to Run a Constant Number of Jobs in the Background
How to Run Command During Docker Build Which Requires a Tty
Objdump and Resolving Linkage of Local Function Calls
Linux Iterate Over Files in Directory
Interrupting Syscalls in Threads on Linux
How to Set Emacsclient Background as Emacs Background
How to Build an If Condition in Shell to Check Whether Curl Succeeded
How to Extract One Column from Multiple Files, and Paste Those Columns into One File
Error While Installing Respinned/Customized Centos
Unwanted Line Break Using Echo and Cat
Use Sed to Delete Certain Lines Using an Index with the Line Numbers to Delete