Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override optimization level for a single package in bit-bake recipe?

All Yocto projects by default comes with -O2 optimization level

How to override this for a single package with -O0 ?

like image 831
Rajesh Gopu Avatar asked Oct 18 '25 12:10

Rajesh Gopu


1 Answers

From bitbake.conf:

export BUILD_CFLAGS = "${BUILD_CPPFLAGS} ${BUILD_OPTIMIZATION}"
FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION', 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}"

So if you want to switch it to -O0 for debugging purposes, just set DEBUG_BUILD="1" in the recipe. If the recipe is broken with -O2 because of bad code, override FULL_OPTIMISATION appropriately.

like image 83
Ross Burton Avatar answered Oct 22 '25 05:10

Ross Burton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!