[openwrt/openwrt] kernel: simplify SetInitramfs compression ALGO config setup

LEDE Commits lede-commits at lists.infradead.org
Sat Jul 6 07:20:53 PDT 2024


ansuel pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/00053299fa29092daf816a3119320ebb27e25393

commit 00053299fa29092daf816a3119320ebb27e25393
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Fri Jul 5 14:58:20 2024 +0200

    kernel: simplify SetInitramfs compression ALGO config setup
    
    Simplify SetInitramfs compression ALGO config setup by using Makefile
    foreach.
    While at it also make it more readable.
    
    Link: https://github.com/openwrt/openwrt/pull/12959
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 include/kernel-defaults.mk | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index 8407232109..4ccab2b7b5 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -80,13 +80,10 @@ endif
 	echo "# CONFIG_INITRAMFS_FORCE is not set" >> $(2)/.config
   endif
 	echo "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_NONE),CONFIG_INITRAMFS_COMPRESSION_NONE=y,# CONFIG_INITRAMFS_COMPRESSION_NONE is not set)" >> $(2)/.config
-	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),CONFIG_INITRAMFS_COMPRESSION_GZIP=y\nCONFIG_RD_GZIP=y,# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set\n# CONFIG_RD_GZIP is not set)" >> $(2)/.config
-	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),CONFIG_INITRAMFS_COMPRESSION_BZIP2=y\nCONFIG_RD_BZIP2=y,# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set\n# CONFIG_RD_BZIP2 is not set)" >> $(2)/.config
-	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),CONFIG_INITRAMFS_COMPRESSION_LZMA=y\nCONFIG_RD_LZMA=y,# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set\n# CONFIG_RD_LZMA is not set)" >> $(2)/.config
-	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),CONFIG_INITRAMFS_COMPRESSION_LZO=y\nCONFIG_RD_LZO=y,# CONFIG_INITRAMFS_COMPRESSION_LZO is not set\n# CONFIG_RD_LZO is not set)" >> $(2)/.config
-	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),CONFIG_INITRAMFS_COMPRESSION_XZ=y\nCONFIG_RD_XZ=y,# CONFIG_INITRAMFS_COMPRESSION_XZ is not set\n# CONFIG_RD_XZ is not set)" >> $(2)/.config
-	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),CONFIG_INITRAMFS_COMPRESSION_LZ4=y\nCONFIG_RD_LZ4=y,# CONFIG_INITRAMFS_COMPRESSION_LZ4 is not set\n# CONFIG_RD_LZ4 is not set)" >> $(2)/.config
-	echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),CONFIG_INITRAMFS_COMPRESSION_ZSTD=y\nCONFIG_RD_ZSTD=y,# CONFIG_INITRAMFS_COMPRESSION_ZSTD is not set\n# CONFIG_RD_ZSTD is not set)" >> $(2)/.config
+	$(foreach ALGO,GZIP BZIP2 LZMA LZO XZ LZ4 ZSTD, \
+		$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_$(ALGO)),\
+			echo -e "CONFIG_INITRAMFS_COMPRESSION_$(ALGO)=y\nCONFIG_RD_$(ALGO)=y" >> $(2)/.config;,\
+			echo -e "# CONFIG_INITRAMFS_COMPRESSION_$(ALGO) is not set\n# CONFIG_RD_$(ALGO) is not set" >> $(2)/.config;))
   endef
 else
 endif




More information about the lede-commits mailing list