3

As I understand, to have gcc on an armv5 board compiling executables while using my x86 machine to compile that arm native gcc, I need this setup:

  • Machine configuring the toolchain components: the config machine : x86_64
  • Machine building the toolchain components: the build machine : x86_64
  • Machine running the toolchain: the host machine : ARM
  • Machine the toolchain is generating code for: the target machine : ARM

Based on reading the cross-ng docs here, I should use a cross-native setup, but when I attempt to enable that using ct-ng menuconfig I need to enable:

  • experimental in Paths and misc options -> Try features marked as EXPERIMENTAL

  • Toolchain options -> Type (Cross) -> Cross-native (NO CODE!) (EXPERIMENTAL)

But of course Cross-Native doesn't work since there is no code for it. Googling leads me to this and this discussion on a mailing list saying that I should try to do this using a Canadian build style but I am somewhat lost as to what tuple's and whatnot to use for the Build System and Host System in crosstool-ng's menuconfig, or if this is still the correct way to go considering how both discussions are over 3 years old.

This post on SO seems to imply that the build system and host system tuples should be arm-unknown-linux-gnueabi?

To be clear, I have been able to compile and run executables using a cross compiler generated from crosstool-ng already, now I want to have a compiler on that armv5 system.

Edit: So I just added the normal cross compiler (arm-unknown-linux-gnueabi) generated by crosstools-ng to the tuple in Toolchain options -> General toolchain options -> Host system -> Tuple and was able to compile gcc as well as have it execute on the arm. Example

I now just need to fix the library situation and that should be that.

4

1 回答 1

0

这个答案是我关于交叉编译工具链的一般工作流程的原始问题的扩展。

我有正确的一般想法,您必须Canadian-Build将主机系统元组作为arm-unknown-linux-gnueabi我之前制作的交叉编译器。确保将其包含在您的路径中或在 /bin 中进行一些符号链接,或者您想要处理它。

在使用普通 HDD 的 Ubuntu Vmware 虚拟机中使用 3/4 个 I5-3570k 内核和 ~2GB 内存进行构建时,我不得不等待大约 30 分钟。使用 SSD 可能会显着提高速度。

完成此操作后,您应该有一个 Crosstools-NG 为您制作的输出目录,其中包括 ARM 架构的工具链。file filename您可以通过在任何二进制文件上运行来验证这一点。

现在,对于图书馆的情况,这花了我一段时间并给我带来了一些混乱。在工具链输出中应该有一个 rootfs 文件夹。该文件夹包含您将为其编译的目标的预期根文件系统(在本例中为 arm)。您需要/lib从用户那里复制文件夹以及 lib,镜像此 rootfs 文件夹的文件夹层次结构。

objdump -p filename您可以通过执行并查看NEEDED指向应位于 rootfs 中的所需库的条目来验证您是否正确设置了库。

如果您使用的是基于busybox 的rootfs,那么假设您没有静态编译它,那么您可能已经正确设置了库,因为您需要它们用于busybox。我首先对busybox进行了静态构建,以确保我可以让系统启动到shell,然后使用工具链rootfs文件夹中的库进行非静态构建以对库进行软启动。一旦我得到一个动态链接的busybox系统工作,只需将交叉编译的工具链放到你的rootfs中的任意位置(/usr/home/toolchain对我来说)就足够了,之后你应该使用工具链,就像x86系统一样,引用路径和符号链接以及你想做的任何事情。

于 2015-03-28T19:20:52.323 回答