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 <tao.zeng@amlogic.com>
Change-Id: I80b85b006ddec3bbcfb9c8921eb59577af49ad0d
This commit is contained in:
Tao Zeng
2020-08-07 17:31:08 +08:00
committed by Chris
parent e6a1386f32
commit 313fd8232d

View File

@@ -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