From 40b9e5569668a813ff32ef2ee547315f8208439d Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 11 Feb 2025 15:05:55 +0000 Subject: [PATCH] lib: Refactor logo.bmp inclusion with helper macro This commit refactors the logo.bmp inclusion logic to use a helper macro, `add_bmp_logo_file_to_cbfs`. This centralizes the logic for adding BMP logo files to the CBFS image and improves code readability. Change-Id: I135c1f2af02064b72bc1f747336ac98ffdb20842 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86368 Reviewed-by: Julius Werner Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian --- src/lib/Makefile.mk | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/lib/Makefile.mk b/src/lib/Makefile.mk index 292f5d2889..93e76d4af3 100644 --- a/src/lib/Makefile.mk +++ b/src/lib/Makefile.mk @@ -422,13 +422,21 @@ header_pointer-type := "cbfs header" romstage-y += ux_locales.c # Add logo to the cbfs image -ifneq ($(CONFIG_HAVE_CUSTOM_BMP_LOGO),y) -cbfs-files-$(CONFIG_BMP_LOGO) += logo.bmp -logo.bmp-file := $(call strip_quotes,$(CONFIG_FSP2_0_LOGO_FILE_NAME)) -logo.bmp-type := raw +BMP_LOGO_COMPRESS_FLAG := $(CBFS_COMPRESS_FLAG) ifeq ($(CONFIG_BMP_LOGO_COMPRESS_LZMA),y) -logo.bmp-compression := LZMA + BMP_LOGO_COMPRESS_FLAG := LZMA else ifeq ($(CONFIG_BMP_LOGO_COMPRESS_LZ4),y) -logo.bmp-compression := LZ4 + BMP_LOGO_COMPRESS_FLAG := LZ4 endif + +define add_bmp_logo_file_to_cbfs +cbfs-files-$$($(1)) += $(2) +$(2)-file := $$(call strip_quotes,$$($(3))) +$(2)-type := raw +$(2)-compression := $$(BMP_LOGO_COMPRESS_FLAG) +endef + +ifneq ($(CONFIG_HAVE_CUSTOM_BMP_LOGO),y) +$(eval $(call add_bmp_logo_file_to_cbfs,CONFIG_BMP_LOGO, logo.bmp,\ + CONFIG_FSP2_0_LOGO_FILE_NAME)) endif