AnsweredAssumed Answered

Change Yocto Project Kernel Compile Optimization Level

Question asked by James Burnworth on Dec 6, 2017
Latest reply on Dec 7, 2017 by James Burnworth

I'm trying to debug a kernel module and as such, need to compile it without optimizations.  I'm using the Yocto Project and can't get the module to compile with a -O0 flag despite trying several things.  So far I've tried adding the following to my local.conf.

EXTRA_IMAGE_FEATURES = "debug-tweaks tools-profile dbg-pkgs"


PACKAGE_DEBUG_SPLIT_STYLE = 'debug-file-directory'

I've also added the following to my kernel recipe in addition to the changes above.


None of this has worked.  If I run objdump -g on the .ko file in question I still find -O2 is being used.  This leads to the debugger jumping all around when I'm trying to step through source. 


Is there a way to override the kernel compile optimization level in the Yocto Project?


For kernel module debugging I'm following this guide from DS-MDK and the imx_rpmsg_tty module. 


I'm working with this SOM.

CL-SOM-iMX7 | NXP (Freescale) i.MX 7 | System-on-Module | Computer-on-Module | CompuLab 


I've attached my local.conf, my kernel recipe, and my kernel .config.  Let me know if you need any more information.


Thanks for the help,