diff mbox

[U-Boot,3/3] kconfig: add CONFIG_CC_OPTIMIZE_FOR_SIZE

Message ID 1408704149-14704-4-git-send-email-yamada.m@jp.panasonic.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Masahiro Yamada Aug. 22, 2014, 10:42 a.m. UTC
Copy the Kconfig option from "init/Kconfig" of Linux v3.16 tag
and adjust the help document.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

 Kconfig  | 10 ++++++++++
 Makefile |  6 +++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

Comments

Tom Rini Aug. 29, 2014, 2:41 p.m. UTC | #1
On Fri, Aug 22, 2014 at 07:42:29PM +0900, Masahiro Yamada wrote:

> Copy the Kconfig option from "init/Kconfig" of Linux v3.16 tag
> and adjust the help document.
> 
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/Kconfig b/Kconfig
index ea2c836..cbb691e 100644
--- a/Kconfig
+++ b/Kconfig
@@ -46,6 +46,16 @@  config LOCALVERSION_AUTO
 
 	  which is done within the script "scripts/setlocalversion".)
 
+config CC_OPTIMIZE_FOR_SIZE
+	bool "Optimize for size"
+	depends on !SPL_BUILD
+	default y
+	help
+	  Enabling this option will pass "-Os" instead of "-O2" to gcc
+	  resulting in a smaller U-Boot image.
+
+	  This option is enabled by default for U-Boot.
+
 endmenu		# General setup
 
 menu "Boot images"
diff --git a/Makefile b/Makefile
index 2938dec..95e298b 100644
--- a/Makefile
+++ b/Makefile
@@ -533,7 +533,11 @@  else
 include/config/auto.conf: ;
 endif # $(dot-config)
 
-KBUILD_CFLAGS += -Os #-fomit-frame-pointer
+ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
+KBUILD_CFLAGS	+= -Os
+else
+KBUILD_CFLAGS	+= -O2
+endif
 
 ifdef BUILD_TAG
 KBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'