如何将工具链交叉编译到 ARMv5 平台? [英] How to cross compile a toolchain to an ARMv5 platform?

查看:25
本文介绍了如何将工具链交叉编译到 ARMv5 平台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想设置一个工具链来在 x86 主机上交叉编译到 ARMv5 目标(我已经有了它并且它正在工作),而是一个在 ARMv5 平台上编译到 ARMv5 目标(本身)的工具链.我知道我总是可以交叉编译所有我需要的应用程序,但我希望在系统上运行一个编译器,所以我会很好地了解如何对其他板(如 Rasberry Pi 和 Beaglebone)执行相同的操作,并且因为它只是看起来很酷.

I am not looking to setup a toolchain to cross compile on an x86 host to an ARMv5 target (I already have that and it's working), but a toolchain to compile on an ARMv5 platform to an ARMv5 target(itself). I know I can always just cross compile all my needed applications, but I want to have a compiler run on the system so I will have a good idea of how to do the same for other boards like the Rasberry Pi and Beaglebone, and because it just seems pretty cool.

我研究了 crosstool-ng,但据我所知,它似乎只适用于 x86 主机到各种目标,而不是各种主机适用于各种目标.

I have looked into crosstool-ng but as I understand it seems to only work for an x86 host to various targets, instead of various hosts for various targets.

是否有任何推荐的工作流程?我想看看处理像 Beaglebone 这样的板的发行版的人是如何做的,但我似乎找不到任何相关信息,他们是否使用了某些专有解决方案?

Is there any recommended workflow for this? I was thinking of seeing how the people who handle distributions for boards like the Beaglebone do it, but I can't seem to find any information on that, are they using some proprietary solution?

有问题的工具链是 这个 来自 Sourcery CodeBench Lite,其中包含源代码,但似乎仅通过已编译的交叉编译器运行它是行不通的.

The toolchain in question is this one from Sourcery CodeBench Lite which includes the source, but it seems that just running this through the already compiled cross compiler doesn't work.

我发现了一些相关的问题,但似乎没有一个问题能解决问题,是否有相关指南?对于所有像我一样在谷歌上搜索的人,如果这会出现在你的结果中,这里有一些相关的问题:

I found some related questions but it seems that none of them got it going all the way, is there a guide for this out there somewhere? For all of you googling this like I am, and if this were to pop up in your results, here are some of the related questions:

交叉编译本机带有crosstool-ng的gcc for arm,有工具链,哪些架构依赖,哪些构建、托管和目标?

如何使用 crosstool-NG 更改 GCC 的加拿大交叉"编译的主机类型

交叉编译 gcc

使用代码源编译 GCC

使用交叉编译器为 arm 编译原生 GCC

推荐答案

在对库和工具链进行了大量摸索之后,我自己设法做到了这一点.

I managed to do this myself after a ton of futzing around with libraries and toolchains.

您需要首先设置一个交叉编译器来为 ARM926J CPU 编译 ARMv5 可执行文件.为什么是 ARMv5 和 ARM926J?因为我使用的是 SAM9N12,它利用了 ARM926J 代码(J for Jazelle 运行本机 JVM),其核心是 ARMv5 架构.

You need to first setup a cross compiler to compile ARMv5 executables for the ARM926J CPU. Why ARMv5 and ARM926J? Because I am using the SAM9N12 which utilizes the ARM926J code (J for Jazelle which runs a native JVM), with that core being an ARMv5 architecture.

您可以从 ARM 的基于启动板的 GCC 存储库 中获取交叉编译器,也可以自己制作一个使用 Crosstools-NG.建议使用 Crosstools-NG,因为您可以使用自己的标准 C 库(与 uClib 或 musl 相比,GNU 的版本是可怕的).

You can get the cross compiler either from ARM's launchpad based GCC repo or make one yourself using Crosstools-NG. Using Crosstools-NG is recommended because you can use your own standard C library (GNU's version is monstrous compared to uClib or musl).

最后,您需要使用交叉编译器来制作本机 ARM 编译器.通常,您可以使用 Crosstools-NG 执行此操作,但未实现 cross-native 选项,因此您必须执行所谓的 Canadian-Build工作正常,但做了一些多余的步骤.

Lastly, you need to use your cross compiler to make a native ARM compiler. Normally, you would be able to do this with Crosstools-NG but the cross-native option is not implemented, so you have to do what is called a Canadian-Build which works just fine but does some redundant steps.

由于此问题仅用于了解要使用的一般工作流程,因此我将保持原样并将您推荐给我的 其他问题 专门询问如何使用 Canadian-Build with Crosstools-NG 考虑到 Cross-Native 尚未实现.

Since this question specified only for an idea of what general workflow to use, I will leave this as is and refer you to my other question asking specifically how to use Canadian-Build with Crosstools-NG considering Cross-Native is not implemented yet.

这篇关于如何将工具链交叉编译到 ARMv5 平台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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