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.cdn.openwrt.org/?a=commitdiff_plain;h=cf7154db07c0b8746be290c9e11dcab3c91d237e;p=openwrt%2Fstaging%2Fneocturne.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 --- 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/adm5120/Makefile b/target/linux/adm5120/Makefile index 56916bdcea..fbfaf6d23c 100644 --- a/target/linux/adm5120/Makefile +++ b/target/linux/adm5120/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk BOARD:=adm5120 BOARDNAME:=Infineon/ADMtek ADM5120 -FEATURES:=low_mem source-only +FEATURES:=low_mem small_flash source-only SUBTARGETS:=router_le router_be rb1xx INITRAMFS_EXTRA_FILES:= diff --git a/target/linux/adm5120/config-3.18 b/target/linux/adm5120/config-3.18 index 000424c2e4..231877e6a0 100644 --- a/target/linux/adm5120/config-3.18 +++ b/target/linux/adm5120/config-3.18 @@ -45,7 +45,6 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_ARM_AMBA=y CONFIG_BUILD_BIN2C=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="console=ttyAM0,115200 rootfstype=squashfs,jffs2" diff --git a/target/linux/at91/config-4.9 b/target/linux/at91/config-4.9 index 6ccc34b957..a44d3ac522 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/ath79/tiny/config-default b/target/linux/ath79/tiny/config-default index f5a485d083..01af54446d 100644 --- a/target/linux/ath79/tiny/config-default +++ b/target/linux/ath79/tiny/config-default @@ -1,5 +1,3 @@ -# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_BLK_MQ_PCI=y CONFIG_LEDS_RESET=y CONFIG_OF_ADDRESS_PCI=y diff --git a/target/linux/au1000/Makefile b/target/linux/au1000/Makefile index ddc28d0f09..3a79b4c316 100644 --- a/target/linux/au1000/Makefile +++ b/target/linux/au1000/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk ARCH:=mipsel BOARD:=au1000 BOARDNAME:=RMI/AMD AU1x00 -FEATURES:=squashfs usb pci source-only +FEATURES:=squashfs usb pci small_flash source-only SUBTARGETS:=au1500 au1550 MAINTAINER:=Florian Fainelli diff --git a/target/linux/au1000/config-3.18 b/target/linux/au1000/config-3.18 index cb2eee20eb..abce20a6ad 100644 --- a/target/linux/au1000/config-3.18 +++ b/target/linux/au1000/config-3.18 @@ -11,7 +11,6 @@ CONFIG_ARCH_PHYS_ADDR_T_64BIT=y CONFIG_ARCH_REQUIRE_GPIOLIB=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CEVT_R4K=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/mtdblock0 rootfstype=squashfs,jffs2" diff --git a/target/linux/generic/config-3.18 b/target/linux/generic/config-3.18 index 0f66960fdc..0eec5c65d6 100644 --- a/target/linux/generic/config-3.18 +++ b/target/linux/generic/config-3.18 @@ -580,7 +580,6 @@ CONFIG_CAVIUM_OCTEON_HELPER=y # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set # CONFIG_CAVIUM_OCTEON_SOC is not set # CONFIG_CB710_CORE is not set -# 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.14 b/target/linux/generic/config-4.14 index 3ed2fed7a6..e7304b41ce 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 83abfdc8ff..011172b7af 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 6f8ef627f7..b7695891df 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 0873b2a8c1..06a63057e8 100644 --- a/target/linux/layerscape/armv8_64b/config-4.9 +++ b/target/linux/layerscape/armv8_64b/config-4.9 @@ -156,8 +156,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/mcs814x/Makefile b/target/linux/mcs814x/Makefile index 0f69bbe322..f507842f09 100644 --- a/target/linux/mcs814x/Makefile +++ b/target/linux/mcs814x/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk ARCH:=arm BOARD:=mcs814x BOARDNAME:=Moschip MCS814x -FEATURES:=usb squashfs low_mem source-only +FEATURES:=usb squashfs low_mem small_flash source-only CPU_TYPE:=arm926ej-s MAINTAINER:=Florian Fainelli diff --git a/target/linux/mcs814x/config-3.18 b/target/linux/mcs814x/config-3.18 index 7f1c5705fd..0b74cd6996 100644 --- a/target/linux/mcs814x/config-3.18 +++ b/target/linux/mcs814x/config-3.18 @@ -26,7 +26,6 @@ CONFIG_ARM_L1_CACHE_SHIFT=5 # CONFIG_ARM_THUMB is not set CONFIG_BINFMT_MISC=y # CONFIG_CACHE_L2X0 is not set -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CLKDEV_LOOKUP=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="earlyprintk" diff --git a/target/linux/mediatek/mt7622/config-4.14 b/target/linux/mediatek/mt7622/config-4.14 index ce705e58f5..15cd47a4ae 100644 --- a/target/linux/mediatek/mt7622/config-4.14 +++ b/target/linux/mediatek/mt7622/config-4.14 @@ -88,8 +88,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/ppc40x/Makefile b/target/linux/ppc40x/Makefile index 3529bb3db5..ebe09988a8 100644 --- a/target/linux/ppc40x/Makefile +++ b/target/linux/ppc40x/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk ARCH:=powerpc BOARD:=ppc40x BOARDNAME:=AMCC/IBM PPC40x -FEATURES:=squashfs broken +FEATURES:=squashfs small_flash broken CPU_TYPE:=405 MAINTAINER:=Imre Kaloz diff --git a/target/linux/ppc40x/config-3.18 b/target/linux/ppc40x/config-3.18 index 85bbe0cb9b..fc53dde8c1 100644 --- a/target/linux/ppc40x/config-3.18 +++ b/target/linux/ppc40x/config-3.18 @@ -27,7 +27,6 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y CONFIG_AUDIT_ARCH=y CONFIG_BOOKE_WDT=y CONFIG_BOUNCE=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd" CONFIG_CMDLINE_BOOL=y diff --git a/target/linux/ppc44x/Makefile b/target/linux/ppc44x/Makefile index 07404d5b47..52772e4a8a 100644 --- a/target/linux/ppc44x/Makefile +++ b/target/linux/ppc44x/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk ARCH:=powerpc BOARD:=ppc44x BOARDNAME:=AMCC/IBM PPC44x -FEATURES:=squashfs broken +FEATURES:=squashfs small_flash broken CPU_TYPE:=440 MAINTAINER:=Imre Kaloz diff --git a/target/linux/ppc44x/config-3.18 b/target/linux/ppc44x/config-3.18 index 842d898c70..48880b6674 100644 --- a/target/linux/ppc44x/config-3.18 +++ b/target/linux/ppc44x/config-3.18 @@ -34,7 +34,6 @@ CONFIG_BOOKE=y CONFIG_BOOKE_WDT=y CONFIG_BOUNCE=y CONFIG_CANYONLANDS=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_CLONE_BACKWARDS=y CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/mtdblock1 rootfstype=squashfs,jffs2 noinitrd" CONFIG_CMDLINE_BOOL=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