Have build system use -mcpu=cortex-a72 for ALL packages built

I'd like to have all packages built use a custom C*FLAG of -mcpu=cortex-a72 thus providing optimized binaries for my RPi4. Is there a way in the nconfig to set this globally? If not, can someone recommend a method?

I did find the following which seems to only ass the CFLAGS to the kernel package, not to any package:

[*] Advanced configuration options (for developers)  --->
    (-mcpu=cortex-a72) Kernel extra CFLAGS

Thanks for suggestions!

I did find this link on the wiki but I don't know how to modify the file to use my -mcpu= preference.

EDIT: I tried modifying rules.mk appending my flag and that seems to be working:

...
TARGET_CFLAGS:=$(TARGET_OPTIMIZATION)$(if $(CONFIG_DEBUG), -g3) $(call qstrip,$(CONFIG_EXTRA_OPTIMIZATION))
TARGET_CFLAGS+=-mcpu=cortex-a72
TARGET_CXXFLAGS = $(TARGET_CFLAGS)
...

Go little lower, there's "Target Options" and inside of it "Target Optimizations".

1 Like

Nice, thank you for pointing that out. I do not want to modify rules.mk and using that variable is much more modular.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.