Kernel optimization

How to set -O3 optimization for OpenWrt's Linux kernel when building firmware?

Assuming you mean "compiling from source "(clone git repo and use make to build/compile the firmware) and not "a custom imagebuilder package":

in the make menuconfig menu, there is an option (top settings page, 3 or 4 from th top) that is something like "advanced settings for developers".enable it, thengo into that sub-menu and somewhere in it there will be an option for "kernel CFLAGS". Add -O3 there

1 Like

Does that option determine CPU_CFLAGS in include/target.mk?

No. In the same "advanced developer options" menu theres another option called "target options", enable it, enter that menu, then set flags like -O3 there. Thos should apply to everything built for the router except the kernel itself.

Somewhere in that developers submenu there is also an option that is "extra CFLAGS" option or something similiar. Those will AFAIK apply to both the kernel and "everything else in the target".

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