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
No. Its because cross compiler(including clang) can generate binaries from host gcc for a target. There is no compiler which can generate x86 instructions from arm.
Save this answer. Install gcc-arm-linux-gnueabi and binutils-arm-linux-gnueabi packages, and then just use arm-linux-gnueabi-gcc instead of gcc for compilation. This brings in the complete cross-compile environment, including binutils. On Ubuntu 13.10 you get gcc-4.7 for 'gnueabi' and gcc-4.8 for 'gnueabihf'.
Use GCC to cross-compile binaries for different architectures from a single build machine. If you're a developer creating binary packages, like an RPM, DEB, Flatpak, or Snap, you have to compile code for a variety of different target platforms. Typical targets include 32-bit and 64-bit x86 and ARM.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With