From 313fd8232da187c690eb8bb74f91f003aaac36a8 Mon Sep 17 00:00:00 2001 From: Tao Zeng Date: Fri, 7 Aug 2020 17:31:08 +0800 Subject: [PATCH] rodata: optimize memory usage of rodata section [1/5] PD#SWPL-31258 Problem: Kernel RO data is too large, about 4.5mb on 32bit and 5.9mb on 64bit kernel Solution: 1, remove all # lines in .config when generate /proc/config.gz, which can save about 20KB ro-memory. Verify: x301 Signed-off-by: Tao Zeng Change-Id: I80b85b006ddec3bbcfb9c8921eb59577af49ad0d --- kernel/Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kernel/Makefile b/kernel/Makefile index 108f5bee0111..ccbe2239751a 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -122,9 +122,21 @@ $(obj)/configs.o: $(obj)/config_data.h # config_data.h contains the same information as ikconfig.h but gzipped. # Info from config_data can be extracted from /proc/config* +ifdef CONFIG_AMLOGIC_MODIFY +# Amlogic: there are too many sentences marked by '#' in .config flies +# So we need to remove them when generate config.gz, this can help to save +# about 20KB memory in ro data +$(obj)/cfg_less.txt: $(KCONFIG_CONFIG) FORCE + $(shell sed '/#/d' $(KCONFIG_CONFIG) > $(src)/cfg_less.txt) + +targets += config_data.gz +$(obj)/config_data.gz: $(obj)/cfg_less.txt FORCE + $(call if_changed,gzip) +else targets += config_data.gz $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE $(call if_changed,gzip) +endif filechk_ikconfiggz = (echo "static const char kernel_config_data[] __used = MAGIC_START"; cat $< | scripts/basic/bin2c; echo "MAGIC_END;") targets += config_data.h