默认情况下,所有Yocto项目都带有-O2优化级别
如何使用-O0覆盖单个包?
从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'])}"
因此,如果要-O0
出于调试目的将其切换到,只需DEBUG_BUILD="1"
在配方中进行设置即可。如果-O2
由于错误代码而使配方损坏,请FULL_OPTIMISATION
适当覆盖。