[Buildroot] auto-detecting toolchain metadata?

Hollis Blanchard hollis_blanchard at mentor.com
Tue Nov 22 15:44:57 UTC 2016


On 11/22/2016 12:29 AM, Thomas Petazzoni wrote:
> On Mon, 21 Nov 2016 17:04:57 -0800, Hollis Blanchard wrote:
>>> with that output to be used as a base defconfig, then that would be
>>> tremendously useful, indeed.
>> My use case is slightly different; I already have a defconfig; I just
>> want this script to replace the toolchain-related bits of it. Would
>> editing defconfig "in place" (e.g. create .defconfig.new, copy it over
>> the original) be acceptable?
> How are you going to filter out all the toolchain-related options from
> the original defconfig? It's not like all of them are prefixed by
> "BR2_TOOLCHAIN" for example. So I hardly see how you can achieve what
> you want in a reliable way.
My defconfig contains this:
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="$(ARCH)-linux-gnu"
BR2_TOOLCHAIN_EXTERNAL_GCC_4_9=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_7=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y

There are no other toolchain-related options (prefixed with 
BR2_TOOLCHAIN or otherwise). Can you elaborate on why I can't just 
replace these?
>> Here's one complexity: once we know the version, which GCC_AT_LEAST_X_Y
>> should be emitted? (Probably the same question for the other "AT_LEAST"
>> variables too.)
>>
>> We could make a new list that matches toolchain/toolchain-common.in, but
>> that will undoubtedly lead to mismatches in the future...
>>
>> We could just auto generate every major/minor version from 4.0 up to
>> <toolchain version>, but then how many minors for each major? 10? That
>> would yield 4.0 -> 4.10, 5.0 -> 5.10, 6.0 -> 6.10, ...
> For gcc versions >= 5, we don't have an option for each minor version.
> So it's actually pretty easy:
>
>   if major < 5:
>     option = BR2_TOOLCHAIN_GCC_AT_LEAST_<major>_<minor>
>   else
>     option = BR2_TOOLCHAIN_GCC_AT_LEAST_<major>
Oops, yeah, I only need to generate the options for defconfig, not 
.config. That will be much easier, thanks. :-)

Hollis Blanchard <hollis_blanchard at mentor.com>
Mentor Graphics Emulation Division




More information about the buildroot mailing list