Custom CFLAGS when cross-compiling OpenWrt

Dear all,

I would like to (cross-)compile Openwrt for RPI 4 using the following CFLAGS="-march=armv8-a+crc+simd -mtune=cortex-a72 -ftree-vectorize -O2 -pipe -fomit-frame-pointer"

What is the recommended approach to ensure that kernel, modules and apps are compiled using these CFLAGS?

Thank you,
alex

You need to compile from source. In make menuconfig you can go to Advanced Developer Options and then Target Options at the bottom to change the CFLAGS.

1 Like

Excellent, thank you so much!

I realize that this is a nearly 2-year-old thread now, but my reply is still applicable for others coming across this thread. For ARM devices it is not recommended to set -march= or -mtune= CFLAGS, ... use -mcpu= instead. See this link.