kernel: add Kbuild option for kernel optimization level
Richard Wiley [Tue, 7 Aug 2012 17:42:51 +0000 (10:42 -0700)]
Adds a kernel config option to lower the kernel compile optimization
level from O2 to O1 for clearer GDB debugging. Default on for simulation
builds, default off for others.

Change-Id: I17fd63b5b391984d28b275e516df89d6a223021c
Reviewed-on: http://git-master/r/121822
Reviewed-by: Chao Xu <cxu@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ken Adams <kadams@nvidia.com>
Tested-by: Richard Wiley <rwiley@nvidia.com>
Reviewed-by: Mark Stadler <mastadler@nvidia.com>
Reviewed-by: Bo Yan <byan@nvidia.com>

Rebase-Id: Ra7c14ac91b0cfbe441dbfea33f0d5b1a6fd44d5f

Makefile
lib/Kconfig.debug

index 4d6b136..d2fe1a3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -573,8 +573,12 @@ all: vmlinux
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 KBUILD_CFLAGS  += -Os $(call cc-disable-warning,maybe-uninitialized,)
 else
+ifdef CONFIG_LESS_GCC_OPT
+KBUILD_CLFAGS  += -O1
+else
 KBUILD_CFLAGS  += -O2
 endif
+endif
 
 # conserve stack if available
 # do this early so that an architecture can override it.
index d317c1a..8c1ea13 100644 (file)
@@ -162,6 +162,12 @@ config DEBUG_KERNEL
          Say Y here if you are developing drivers or trying to debug and
          identify kernel problems.
 
+config LESS_GCC_OPT
+       bool "Compile with -O1 for debugging
+       depends on DEBUG_KERNEL
+       default y if TEGRA_SIMULATION_PLATFORM
+       default n if !TEGRA_SIMULATION_PLATFORM
+
 config DEBUG_SHIRQ
        bool "Debug shared IRQ handlers"
        depends on DEBUG_KERNEL && GENERIC_HARDIRQS