Arthur Heymans has uploaded this change for review.

View Change

arch/x86: Add an option to LZ4 compress postcar

The reason for selecting LZ4 over LZMA is that LZ4 has a very low
stack requirement in comparison with LZMA which is a better idea for
when operating in CAR. Other compression methods might be added later
if platforms have enough stack in CAR for it.

The LZ4 decompressor was already linked in romstage.

Change-Id: Ic64ba097bfe2f983a219479f78b50264d7a2e380
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
---
M src/Kconfig
M src/arch/x86/Makefile.inc
2 files changed, 19 insertions(+), 1 deletion(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/63591/1
diff --git a/src/Kconfig b/src/Kconfig
index d57ce90..55db936 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -159,6 +159,16 @@
help
Compress ramstage to save memory in the flash image.

+config COMPRESS_POSTCAR
+ bool "Compress postcar with LZ4"
+ depends on POSTCAR_STAGE
+ # Default value set at the end of the file
+ help
+ Compress postcar with LZ4 to save flash space and speed up boot,
+ since the time for reading the image from SPI (and in the vboot
+ case verifying it) is usually much greater than the time spent
+ decompressing.
+
config COMPRESS_PRERAM_STAGES
bool "Compress romstage and verstage with LZ4"
depends on !ARCH_X86 && (HAVE_ROMSTAGE || HAVE_VERSTAGE)
@@ -1343,6 +1353,9 @@
config COMPRESS_RAMSTAGE
default y if !UNCOMPRESSED_RAMSTAGE

+config COMPRESS_POSTCAR
+ default y if X86_CACHED_CBMEM_INIT
+
config COMPRESS_PRERAM_STAGES
depends on !ARCH_X86
default y
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 458bcc6..9709449 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -213,11 +213,16 @@
$(objcbfs)/postcar.elf: $(objcbfs)/postcar.debug.rmod
cp $< $@

+CBFS_POSTCAR_COMPRESS_FLAG := none
+ifeq ($(CONFIG_COMPRESS_POSTCAR),y)
+CBFS_POSTCAR_COMPRESS_FLAG := lz4
+endif
+
# Add postcar to CBFS
cbfs-files-$(CONFIG_POSTCAR_STAGE) += $(CONFIG_CBFS_PREFIX)/postcar
$(CONFIG_CBFS_PREFIX)/postcar-file := $(objcbfs)/postcar.elf
$(CONFIG_CBFS_PREFIX)/postcar-type := stage
-$(CONFIG_CBFS_PREFIX)/postcar-compression := none
+$(CONFIG_CBFS_PREFIX)/postcar-compression := $(CBFS_POSTCAR_COMPRESS_FLAG)

###############################################################################
# ramstage

To view, visit change 63591. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ic64ba097bfe2f983a219479f78b50264d7a2e380
Gerrit-Change-Number: 63591
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-MessageType: newchange