如何在buildroot中设置"BR2_PACKAGE_HOST_ENVIRONMENT_SETUP"

How to set "BR2_PACKAGE_HOST_ENVIRONMENT_SETUP" in buildroot

我想要针对不同平台的不同项目,因此我得出结论,最简单的方法可能就是让 buildroot 创建工具链,然后改变环境以使用所述工具链。

来自 buildroot manual 的第 8.14.1 节:

For your convenience, by selecting the option BR2_PACKAGE_HOST_ENVIRONMENT_SETUP, you can get setup-environment script installed in output/host/and therefore in your SDK. This script can be sourced with . your/sdk/path/environment-setup to export a number of environment variables that will help cross-compile your projects using the Buildroot SDK: the PATH will contain the SDK binaries, standard autotools variables will be defined with the appropriate values, and CONFIGURE_FLAGS will contain basic ./configure options to cross-compile autotools projects. It also provides some useful commands. Note however that once this script is sourced, the environment is setup only for cross-compilation, and no longer for native compilation.

好的,这听起来很像我想要的。但是,我还没有弄清楚如何设置BR2_PACKAGE_HOST_ENVIRONMENT_SETUP。在查看 make menuconfig 时,我没有发现任何类似的内容,我试图为该字符串搜索整个 buildroot 源代码树,但没有成功,只是将其导出为环境变量也没有产生不同的结果。那么,我该如何设置BR2_PACKAGE_HOST_ENVIRONMENT_SETUP呢?

我刚刚遇到了同样的问题。该选项是在 April 2020 中提交的,因此 buildroot-2020.02.8(撰写本文时的长期支持版本)不支持它,而在线提供的 PDF 版本较新——我怀疑您使用的是同一版本; buildroot 下载页面首先提供长期支持版本。