[openwrt/openwrt] kernel: support setting extra CFLAGS for kernel compilation

LEDE Commits lede-commits at lists.infradead.org
Mon Jun 20 13:18:10 PDT 2022


rmilecki pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/907d7d747243044f86588f0d82993e8c106cb02c

commit 907d7d747243044f86588f0d82993e8c106cb02c
Author: Rafał Miłecki <rafal at milecki.pl>
AuthorDate: Wed Jun 15 12:36:36 2022 +0200

    kernel: support setting extra CFLAGS for kernel compilation
    
    They may be used e.g. to optimize kernel size or performance.
    
    Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 config/Config-devel.in | 4 ++++
 include/kernel.mk      | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/config/Config-devel.in b/config/Config-devel.in
index 126462bfc3..a068f694e5 100644
--- a/config/Config-devel.in
+++ b/config/Config-devel.in
@@ -74,6 +74,10 @@ menuconfig DEVEL
 		  Store ccache in this directory.
 		  If not set, uses './.ccache'
 
+	config KERNEL_CFLAGS
+		string "Kernel extra CFLAGS" if DEVEL
+		default ""
+
 	config EXTERNAL_KERNEL_TREE
 		string "Use external kernel tree" if DEVEL
 		default ""
diff --git a/include/kernel.mk b/include/kernel.mk
index ffc9ea5260..d99dd0a534 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -101,7 +101,7 @@ endif
 KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS)
 
 KERNEL_MAKE_FLAGS = \
-	KCFLAGS="$(call iremap,$(BUILD_DIR),$(notdir $(BUILD_DIR))) $(call qstrip,$(CONFIG_EXTRA_OPTIMIZATION))" \
+	KCFLAGS="$(call iremap,$(BUILD_DIR),$(notdir $(BUILD_DIR))) $(call qstrip,$(CONFIG_EXTRA_OPTIMIZATION)) $(call qstrip,$(CONFIG_KERNEL_CFLAGS))" \
 	HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
 	CROSS_COMPILE="$(KERNEL_CROSS)" \
 	ARCH="$(LINUX_KARCH)" \




More information about the lede-commits mailing list