Deeraj Soman
Deeraj Soman

Reputation: 73

Cross compiling for arm from x86

I am trying to insert a .ko kernel module into the linux running in arm processor. I built a .ko file in my desk PC which is a x86 one. How do I cross compile it to arm specs. I am new to this field.

Thanks in advance

Upvotes: 5

Views: 10252

Answers (2)

Pala
Pala

Reputation: 2191

For this you have to do the following steps.

  1. Check you have cross compiler tool chain or not. If you don't have cross compiler tool chain you can download from one of the free ARM cross compiler from net. You can generate your own cross tool chain using Buildroot tool. below you can get the link of Buildroot user manual. http://buildroot.uclibc.org/downloads/manual/manual.html#_using_buildroot

  2. Install cross tool chain in your host PC.

  3. Export the cross tool chain path in your host PC using export command.

  4. Change the make file of the kernel module to set the compiler as CROSS_COMPILE.

  5. Do make.

  6. Move the .ko file to target and insert it.

Upvotes: 5

Jeyaram
Jeyaram

Reputation: 9494

For that you need to download the ARM compilers first. I suggest you download the compiler from http://www.linaro.org/downloads/ then set the CROSS_COMPILE environment variable to arm-linux-gcc.

set the bin directory path in PATH variable.You can do it by export PATH=$PATH:/path/to/arm/binaries/

Finally compile the code then run in ARM.

use file <filename> whether it is ARM executable or not.

Upvotes: 7

Related Questions