[Buildroot] [PATCH] add pre-build script

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Thu Feb 14 17:04:02 UTC 2013

Dear Spenser Gilliland,

On Thu, 14 Feb 2013 10:28:24 -0600, Spenser Gilliland wrote:

> I'm not doing this with the specific implementation posted.  I'm just
> saying it would be a nice feature to have.  Many device trees specify
> processor/arch features and optimized cflags can be constructed from
> this data.
> I currently do this outside of buildroot and just provide
> BR2_TARGET_OPTIMIZATION on the make command line from the buildscripts
> for the hardware.
> It would be nice to have buildroot completely self contained and not
> require the software developers to download the additional hardware
> files.

Indeed, but the pre-build script approach you posted would not allow to
customize the CFLAGS. The CFLAGS are part of Buildroot .config file,
which is loaded at the time you run "make". So when your pre-build
script gets executed by Buildroot, make has already loaded the value of

You would have to make a specific script that returns custom CFLAGS,
and add some code in Buildroot that does:

CUSTOM_CFLAGS = $(shell ./your/custom/script)

Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.

More information about the buildroot mailing list