ARM架构的Linux交叉编译 [英] Linux cross-compilation for ARM architecture

查看:46
本文介绍了ARM架构的Linux交叉编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对在 x86 主机上为 ARM 目标交叉编译 Linux 内核感兴趣.你有什么好的做法推荐吗?您认为哪个是最好的交叉编译套件?您是否设置了自定义交叉编译环境?如果是,您有什么建议?这是个好主意吗?

解决方案

对于 ARM/Linux 工具,我使用了两种方法.最简单的方法是直接下载预先构建的工具链.
优点:它可以正常工作,您可以继续进行项目中有趣的部分
缺点:你被他们选择的任何版本的 gcc/binutils/libc 困住

如果后者对您很重要,请查看 crosstool-ng.这个项目是一个类似于Linux内核配置应用的配置工具.设置要构建的 gcc、binutils、libc(GNU 或 uCLibc)、线程和 Linux 内核的哪个版本,而 crosstool-ng 会完成其余的工作(即下载 tar 球、配置工具并构建它们).
专业版:您获得的正是您在配置过程中选择的内容
缺点:您得到的正是您在配置过程中选择的内容

意味着您对编译器/binutil/libc 及其相关功能/缺点/错误的选择承担全部责任.此外,正如评论中提到的,选择 binutils、C 库等的版本会涉及一些痛苦",因为并非所有组合都必须一起工作甚至构建.

一种混合方法可能是从预先构建的工具开始,然后在必要时通过 crosstool-ng 用自定义解决方案替换它们.

更新:答案最初使用 CodeSourcery 工具作为一个预建工具链的例子.用于 ARM 的 CodeSourcery 工具可免费下载来自 Mentor Graphics,但它们现在被称为 Sourcery CodeBench,必须从 Mentor Graphics 购买.其他选项现在包括 Linaro 以及来自 Android、Ubuntu 和其他发行版的特定工具.>

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交叉编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆