Buildroot:仅安装和构建工具链

Buildroot: install and build the toolchain only

我只想为我的 Buildroot 项目安装和构建工具链。 make help 表明命令 make <options> toolchain 应该有效;但是,运行 该命令只是 returns Nothing to be done for 'toolchain'.output/host 永远不会创建。

您首先必须配置 Buildroot 以指示它您想要生成什么工具链。请参阅 Buildroot 用户手册中的 Buildroot quick start

如果您刚刚下载了 Buildroot,生成工具链的步骤是:

  1. 运行 make menuconfig
    • Target optionsselect你的硬件平台和ABI
    • Toolchain中配置你想要的工具链类型
    • 退出保存
  2. 运行 make toolchain

工具链在 output/host/.

Buildroot manual.

中记录了一种仅构建工具链的最新方法,它可以在 Buildroot 内部和外部使用。

尽管 Luca 的回答中的 make toolchain 确实构建了工具链,但它还将其他主机依赖项放入 output/host/,与 make sdk 相比,获得干净的工具链稍微困难一些下面,它在 output/images/:

中生成工具链压缩包

6.1.3. Build an external toolchain with Buildroot

The Buildroot internal toolchain option can be used to create an external toolchain. Here are a series of steps to build an internal toolchain and package it up for reuse by Buildroot itself (or other projects).

Create a new Buildroot configuration, with the following details:

  • Select the appropriate Target options for your target CPU architecture
  • In the Toolchain menu, keep the default of Buildroot toolchain for Toolchain type, and configure your toolchain as desired
  • In the System configuration menu, select None as the Init system and none as /bin/sh
  • In the Target packages menu, disable BusyBox
  • In the Filesystem images menu, disable tar the root filesystem

Then, we can trigger the build, and also ask Buildroot to generate a SDK. This will conveniently generate for us a tarball which contains our toolchain:

make sdk

This produces the SDK tarball in $(O)/images, with a name similar to arm-buildroot-linux-uclibcgnueabi_sdk-buildroot.tar.gz. Save this tarball, as it is now the toolchain that you can re-use as an external toolchain in other Buildroot projects.