From 1511699b84920728c6ff118d7ecbc01d138f55ee Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Wed, 10 Dec 2014 18:18:35 -0800 Subject: [PATCH] cbfs: Don't compile LZMA code into romstage if it is not needed 16K of BSS scratchpad buffer is no pocket change for some platforms that really need to count every kilobyte in their SRAM stages. This patch makes sure we don't compile LZMA code into the romstage if we don't need it because the ramstage is not compressed anyway. BRANCH=None BUG=None TEST=Booted Pinky and Blaze. Confirmed that romstage memsz on Pinky is way smaller than before. Change-Id: Icf04971b8ddafa76052135cd0e44977d44d69486 Signed-off-by: Julius Werner Reviewed-on: https://chromium-review.googlesource.com/234539 Reviewed-by: Aaron Durbin --- src/lib/Makefile.inc | 2 +- src/lib/cbfs.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc index da822192e5..29e2aa885b 100644 --- a/src/lib/Makefile.inc +++ b/src/lib/Makefile.inc @@ -52,7 +52,7 @@ verstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c romstage-y += delay.c romstage-y += cbfs.c romstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c -romstage-y += lzma.c +romstage-$(CONFIG_COMPRESS_RAMSTAGE) += lzma.c #romstage-y += lzmadecode.c romstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c ramstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c index 4c6425f692..244ecffa25 100644 --- a/src/lib/cbfs.c +++ b/src/lib/cbfs.c @@ -27,8 +27,9 @@ # define CBFS_MINI_BUILD #elif defined(__SMM__) # define CBFS_MINI_BUILD -#elif defined(__PRE_RAM__) && !defined(__ROMSTAGE__) - /* No LZMA in boot block. */ +#elif defined(__PRE_RAM__) && \ + (!defined(__ROMSTAGE__) || !IS_ENABLED(CONFIG_COMPRESS_RAMSTAGE)) + /* No LZMA before romstage, and not even there without ramstage compression */ #else # define CBFS_CORE_WITH_LZMA # include