Cross compiling for arm from x86

 ̄綄美尐妖づ 提交于 2019-12-21 02:52:37

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/14765606/cross-compiling-for-arm-from-x86

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!