From cf7154db07c0b8746be290c9e11dcab3c91d237e Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Mon, 9 Jul 2018 20:48:56 +0200 Subject: kernel: only optimized for size if small_flash Add a new config option to allow to select the default compile optimization level for the kernel. Select the optimization for size by default if the small_flash feature is set. Otherwise "Optimize for performance" is set. Add the small_flash feature flag to all (sub)targets which had the optimization for size in their default kernel config. Remove CC_OPTIMIZE_FOR_* symbols from all kernel configs to apply the new setting. Exceptions to the above are: - lantiq, where the optimization for size is only required for the xway_legacy subtarget but was set for the whole target - mediatek, ramips/mt7620 & ramips/mt76x8 where boards should have plenty of space and an optimization for size doesn't make much sense - rb532, which has 128MByte flash Signed-off-by: Mathias Kresin --- config/Config-kernel.in | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'config') diff --git a/config/Config-kernel.in b/config/Config-kernel.in index d2d1909956..58f7d60094 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -806,3 +806,25 @@ config KERNEL_DEVKMEM Say Y here if you want to support the /dev/kmem device. The /dev/kmem device is rarely used, but can be used for certain kind of kernel debugging operations. + +# +# compile optimiziation setting +# +choice + prompt "Compiler optimization level" + default KERNEL_CC_OPTIMIZE_FOR_SIZE if SMALL_FLASH + +config KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE + bool "Optimize for performance" + help + This is the default optimization level for the kernel, building + with the "-O2" compiler flag for best performance and most + helpful compile-time warnings. + +config KERNEL_CC_OPTIMIZE_FOR_SIZE + bool "Optimize for size" + help + Enabling this option will pass "-Os" instead of "-O2" to + your compiler resulting in a smaller kernel. + +endchoice -- cgit v1.2.3