From: Mathias Kresin Date: Mon, 9 Jul 2018 18:48:56 +0000 (+0200) Subject: kernel: only optimized for size if small_flash X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=8ada2bc12434d33e121a036374546c0086175967;p=openwrt%2Fstaging%2Fjow.git 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 (backported from cf7154db07c0b8746be290c9e11dcab3c91d237e) --- 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 diff --git a/target/linux/apm821xx/config-4.14 b/target/linux/apm821xx/config-4.14 index c756c8a4f9..756806620d 100644 --- a/target/linux/apm821xx/config-4.14 +++ b/target/linux/apm821xx/config-4.14 @@ -47,9 +47,9 @@ CONFIG_BLK_MQ_PCI=y # CONFIG_BLUESTONE is not set CONFIG_BOOKE=y CONFIG_BOOKE_WDT=y -# CONFIG_BOUNCE is not set +CONFIG_BOUNCE=y CONFIG_BUCKMINSTER=y -# CONFIG_CANYONLANDS is not set +CONFIG_CANYONLANDS=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="rootfstype=squashfs noinitrd" CONFIG_CMDLINE_BOOL=y diff --git a/target/linux/at91/config-4.9 b/target/linux/at91/config-4.9 index 1e8bfd99bb..45faf55155 100644 --- a/target/linux/at91/config-4.9 +++ b/target/linux/at91/config-4.9 @@ -58,8 +58,6 @@ CONFIG_BLK_DEV_SD=y # CONFIG_BPF_SYSCALL is not set # CONFIG_BRIDGE is not set CONFIG_CACHE_L2X0=y -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_CLKDEV_LOOKUP=y CONFIG_CLKSRC_OF=y CONFIG_CLKSRC_PROBE=y diff --git a/target/linux/ath25/config-4.14 b/target/linux/ath25/config-4.14 index 4d3f0c697e..b97de27756 100644 --- a/target/linux/ath25/config-4.14 +++ b/target/linux/ath25/config-4.14 @@ -23,7 +23,9 @@ CONFIG_ARCH_USE_QUEUED_RWLOCKS=y CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ATH25=y +CONFIG_ARM_AMBA=y CONFIG_BLK_MQ_PCI=y +CONFIG_BUILD_BIN2C=y CONFIG_CEVT_R4K=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="console=ttyS0,9600 rootfstype=squashfs,jffs2" diff --git a/target/linux/generic/config-4.14 b/target/linux/generic/config-4.14 index 41c9774aa3..b37eac4118 100644 --- a/target/linux/generic/config-4.14 +++ b/target/linux/generic/config-4.14 @@ -717,8 +717,6 @@ CONFIG_CARDBUS=y # CONFIG_CB710_CORE is not set # CONFIG_CC10001_ADC is not set # CONFIG_CCS811 is not set -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set # CONFIG_CC_STACKPROTECTOR is not set CONFIG_CC_STACKPROTECTOR_NONE=y # CONFIG_CC_STACKPROTECTOR_REGULAR is not set diff --git a/target/linux/generic/config-4.9 b/target/linux/generic/config-4.9 index 5e2b25f31e..ea71560cad 100644 --- a/target/linux/generic/config-4.9 +++ b/target/linux/generic/config-4.9 @@ -680,8 +680,6 @@ CONFIG_CARDBUS=y # CONFIG_CAVIUM_OCTEON_SOC is not set # CONFIG_CB710_CORE is not set # CONFIG_CC10001_ADC is not set -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_CC_STACKPROTECTOR is not set CONFIG_CC_STACKPROTECTOR_NONE=y # CONFIG_CC_STACKPROTECTOR_REGULAR is not set diff --git a/target/linux/lantiq/config-4.14 b/target/linux/lantiq/config-4.14 index 12264413d2..aec0efa408 100644 --- a/target/linux/lantiq/config-4.14 +++ b/target/linux/lantiq/config-4.14 @@ -20,8 +20,6 @@ CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_USE_QUEUED_RWLOCKS=y CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y CONFIG_CLKDEV_LOOKUP=y CONFIG_CLONE_BACKWARDS=y diff --git a/target/linux/layerscape/armv8_32b/config-4.9 b/target/linux/layerscape/armv8_32b/config-4.9 index 8187d1884f..d41d5aefab 100644 --- a/target/linux/layerscape/armv8_32b/config-4.9 +++ b/target/linux/layerscape/armv8_32b/config-4.9 @@ -145,8 +145,6 @@ CONFIG_CAN_RAW=y # CONFIG_CAN_SJA1000 is not set # CONFIG_CAN_SOFTING is not set # CONFIG_CAN_TI_HECC is not set -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set # CONFIG_CFS_BANDWIDTH is not set CONFIG_CGROUPS=y CONFIG_CGROUP_CPUACCT=y diff --git a/target/linux/layerscape/armv8_64b/config-4.9 b/target/linux/layerscape/armv8_64b/config-4.9 index 89edbc89b0..bb75759ec7 100644 --- a/target/linux/layerscape/armv8_64b/config-4.9 +++ b/target/linux/layerscape/armv8_64b/config-4.9 @@ -157,8 +157,6 @@ CONFIG_CAVIUM_ERRATUM_22375=y CONFIG_CAVIUM_ERRATUM_23144=y CONFIG_CAVIUM_ERRATUM_23154=y CONFIG_CAVIUM_ERRATUM_27456=y -CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_CEPH_LIB=y # CONFIG_CEPH_LIB_PRETTYDEBUG is not set # CONFIG_CEPH_LIB_USE_DNS_RESOLVER is not set diff --git a/target/linux/mediatek/mt7622/config-4.14 b/target/linux/mediatek/mt7622/config-4.14 index 55377abfee..86951e198a 100644 --- a/target/linux/mediatek/mt7622/config-4.14 +++ b/target/linux/mediatek/mt7622/config-4.14 @@ -89,8 +89,6 @@ CONFIG_BT_HCIUART=y CONFIG_BT_HCIUART_SERDEV=y CONFIG_BT_HCIVHCI=y CONFIG_BUILD_BIN2C=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CLKDEV_LOOKUP=y CONFIG_CLKSRC_MMIO=y CONFIG_CLOCK_THERMAL=y diff --git a/target/linux/ramips/mt7620/config-4.14 b/target/linux/ramips/mt7620/config-4.14 index d60696b225..89de071446 100644 --- a/target/linux/ramips/mt7620/config-4.14 +++ b/target/linux/ramips/mt7620/config-4.14 @@ -22,8 +22,6 @@ CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_AT803X_PHY=y CONFIG_BLK_MQ_PCI=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y CONFIG_CEVT_SYSTICK_QUIRK=y CONFIG_CLKDEV_LOOKUP=y diff --git a/target/linux/ramips/mt76x8/config-4.14 b/target/linux/ramips/mt76x8/config-4.14 index 614c366d1e..81e0848931 100644 --- a/target/linux/ramips/mt76x8/config-4.14 +++ b/target/linux/ramips/mt76x8/config-4.14 @@ -22,8 +22,6 @@ CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_AT803X_PHY=y CONFIG_BLK_MQ_PCI=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y CONFIG_CEVT_SYSTICK_QUIRK=y CONFIG_CLKDEV_LOOKUP=y diff --git a/target/linux/ramips/rt288x/config-4.14 b/target/linux/ramips/rt288x/config-4.14 index a4b49790a3..de4dffe885 100644 --- a/target/linux/ramips/rt288x/config-4.14 +++ b/target/linux/ramips/rt288x/config-4.14 @@ -21,8 +21,6 @@ CONFIG_ARCH_USE_QUEUED_RWLOCKS=y CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_BLK_MQ_PCI=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y # CONFIG_CEVT_SYSTICK_QUIRK is not set CONFIG_CLKDEV_LOOKUP=y diff --git a/target/linux/ramips/rt288x/target.mk b/target/linux/ramips/rt288x/target.mk index 2ca5ecfbb3..11b5a0b520 100644 --- a/target/linux/ramips/rt288x/target.mk +++ b/target/linux/ramips/rt288x/target.mk @@ -4,6 +4,7 @@ SUBTARGET:=rt288x BOARDNAME:=RT288x based boards +FEATURES+=small_flash CPU_TYPE:=24kc DEFAULT_PACKAGES += kmod-rt2800-soc wpad-mini diff --git a/target/linux/ramips/rt305x/config-4.14 b/target/linux/ramips/rt305x/config-4.14 index dadf88e032..346a8a8814 100644 --- a/target/linux/ramips/rt305x/config-4.14 +++ b/target/linux/ramips/rt305x/config-4.14 @@ -12,8 +12,6 @@ CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y CONFIG_CEVT_SYSTICK_QUIRK=y CONFIG_CLKDEV_LOOKUP=y diff --git a/target/linux/ramips/rt305x/target.mk b/target/linux/ramips/rt305x/target.mk index 300639fa38..e36fa637b1 100644 --- a/target/linux/ramips/rt305x/target.mk +++ b/target/linux/ramips/rt305x/target.mk @@ -4,7 +4,7 @@ SUBTARGET:=rt305x BOARDNAME:=RT3x5x/RT5350 based boards -FEATURES+=usb ramdisk +FEATURES+=usb ramdisk small_flash CPU_TYPE:=24kc DEFAULT_PACKAGES += kmod-rt2800-soc wpad-mini diff --git a/target/linux/ramips/rt3883/config-4.14 b/target/linux/ramips/rt3883/config-4.14 index f663d49865..93d803e2ed 100644 --- a/target/linux/ramips/rt3883/config-4.14 +++ b/target/linux/ramips/rt3883/config-4.14 @@ -22,8 +22,6 @@ CONFIG_ARCH_USE_QUEUED_RWLOCKS=y CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_BLK_MQ_PCI=y -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y # CONFIG_CEVT_SYSTICK_QUIRK is not set CONFIG_CLKDEV_LOOKUP=y diff --git a/target/linux/ramips/rt3883/target.mk b/target/linux/ramips/rt3883/target.mk index a2631d1ac7..2cc19858e4 100644 --- a/target/linux/ramips/rt3883/target.mk +++ b/target/linux/ramips/rt3883/target.mk @@ -4,7 +4,7 @@ SUBTARGET:=rt3883 BOARDNAME:=RT3662/RT3883 based boards -FEATURES+=usb pci +FEATURES+=usb pci small_flash CPU_TYPE:=74kc DEFAULT_PACKAGES += kmod-rt2800-pci kmod-rt2800-soc wpad-mini diff --git a/target/linux/rb532/config-4.9 b/target/linux/rb532/config-4.9 index 9290a1869a..a02dc03bb3 100644 --- a/target/linux/rb532/config-4.9 +++ b/target/linux/rb532/config-4.9 @@ -16,7 +16,6 @@ CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ATA=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_SD=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y CONFIG_CLONE_BACKWARDS=y CONFIG_CPU_GENERIC_DUMP_TLB=y