问题描述
我有兴趣在x86主机上交叉编译一个ARM目标的Linux内核。你有推荐的一些好的做法吗?你认为哪个是最好的交叉编译套件?
你已经定下了一个自定义的交叉编译环境?如果是的,你有什么建议?这是一个好主意吗?
我有两种方法用于ARM / Linux工具。最简单的就是直接下载预建的工具链。
Pro :它只是工作,你可以得到项目的有趣部分
Con :你被卡住了他们选择的任何一个版本的gcc / binutils / libc
如果稍后重要,请查看。该项目是一个类似于Linux内核配置应用程序的配置工具。设置哪些版本的gcc,binutils,libc(GNU或uCLibc),线程和Linux内核来构建和完成其他工作(即下载tar球,配置工具并构建它们)。
Pro :您完全可以在配置过程中获得所选内容
Con :您完全可以在配置过程中选择所需的内容。
意味着您对编译器/ binutil / libc及其相关功能/缺点/错误的选择承担全部责任。另外,正如评论中所提到的那样,在选择binutils,C库等版本时,会有一些痛苦,因为并不是所有的组合都必须一起工作,甚至是构建。
一种混合方式可能是从预先构建的工具开始,如有必要,可以通过crosstool-ng替换它们。
更新:答案最初使用作为预构建工具的示例链。 ARM的CodeSourcery工具可以免费,但它们现在称为Sourcery CodeBench,必须从Mentor Graphics购买。其他选项现在包括以及来自Android,Ubuntu等的特定分发工具。 p>
I am interested in cross-compiling a Linux kernel for an ARM target on a x86 host. Are there some good practices you recommend? Which is the best cross-compile suite in your opinion?Have you settled up a custom cross-compile environment? If yes, what advices do you have? Is it a good idea?
There are two approaches I've used for ARM/Linux tools. The easiest is to download a pre-built tool chain directly.
Pro: It just works and you can get on with the interesting part of your project
Con: You are stuck with whichever version of gcc/binutils/libc they picked
If the later matters to you, check out crosstool-ng. This project is a configuration tool similar to the Linux kernel configuration application. Set which versions of gcc, binutils, libc (GNU or uCLibc), threading, and Linux kernel to build and crosstool-ng does the rest (i.e. downloads the tar balls, configures the tools, and builds them).
Pro: You get exactly what you selected during the configuration
Con: You get exactly what you selected during the configuration
meaning you take on full responsibility for the choice of compiler/binutil/libc and their associated features/shortcomings/bugs. Also, as mentioned in the comments, there is some "pain" involved in selecting the versions of binutils, C library etc. as not all combinations necessarily work together or even build.
One hybrid approach might be to start with the pre-built tools and replace them later with a custom solution via crosstool-ng if necessary.
Update: The answer originally used the CodeSourcery tools as an example of a pre-built tool chain. The CodeSourcery tools for ARM were free to download from Mentor Graphics, but they are now called the Sourcery CodeBench and must be purchased from Mentor Graphics. Other options now include Linaro as well as distribution specific tools from Android, Ubuntu, and others.
这篇关于用于ARM架构的Linux交叉编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!