This patch uses lar to compress a payload, instead of pre-compressing
it.  Since we are already using lar to add the payload, this
simplifies the build process.  It also allows us to compress filo,
which didn't work with v2.

Myles

Signed-off-by: Myles Watson <[EMAIL PROTECTED]>
Index: config/payloads/payloads.conf
===================================================================
--- config/payloads/payloads.conf	(revision 113)
+++ config/payloads/payloads.conf	(working copy)
@@ -27,8 +27,11 @@
 
 include $(CONFIG_DIR)/payloads/$(PCONF-y)
 
-# Add LZMA if it is enabled
+# Add LZMA if it is enabled and we are using v2
+ifeq ($(CONFIG_COREBOOT_V2),y)
 HOSTTOOLS-$(CONFIG_USE_LZMA) += lzma
+endif
+
 HOSTTOOLS-$(CONFIG_BUILD_QEMU) += qemu
 
 # Sanity check
@@ -38,19 +41,25 @@
 endif
 
 ifeq ($(CONFIG_USE_LZMA),y)
+ifeq ($(CONFIG_COREBOOT_V2),y)
 ifeq ($(PAYLOAD_COMPRESSED),)
 $(error You must specify a compressed target)
 endif
 endif
+endif
 
 # Set the payload target (if it wasn't set by the config - warning
 # there be dragons here if everything isn't aligned)
 
 ifeq ($(PAYLOAD_TARGET),)
-ifeq ($(CONFIG_USE_LZMA),y)
-PAYLOAD_TARGET=$(PAYLOAD_COMPRESSED)
-else
-PAYLOAD_TARGET=$(PAYLOAD_ELF)
+	ifeq ($(CONFIG_COREBOOT_V2),y)
+		ifeq ($(CONFIG_USE_LZMA),y)
+				PAYLOAD_TARGET=$(PAYLOAD_COMPRESSED)
+		else
+				PAYLOAD_TARGET=$(PAYLOAD_ELF)
+		endif
+	else
+		PAYLOAD_TARGET=$(PAYLOAD_ELF)
+	endif
 endif
-endif
 
Index: Config.in
===================================================================
--- Config.in	(revision 113)
+++ Config.in	(working copy)
@@ -78,14 +78,17 @@
 
 config USE_LZMA
 	bool "Enable LZMA compression"
-	depends !PAYLOAD_OFW
-	depends !PAYLOAD_FILO
-	depends !PAYLOAD_ETHERBOOT
+	depends !(PAYLOAD_OFW && COREBOOT_V2)
+	depends !(PAYLOAD_FILO && COREBOOT_V2)
+	depends !(PAYLOAD_ETHERBOOT && COREBOOT_V2)
 	default y
 	help
-	  Precompress the payload with LZMA. This doesn't work
-	  for FILO, OFW, or ETHERBOOT.
+	  Precompress the payload with LZMA when using coreboot v2. This doesn't
+	  work for FILO, OFW, or ETHERBOOT.
 
+	  When using COREBOOT_V3, parse the elf and have lar compress the files.
+	  This works with all ELF payloads.
+
 config CB_USE_BUILD
 	bool "Specify a coreboot build dir"
 	depends ADVANCED
Index: Makefile
===================================================================
--- Makefile	(revision 113)
+++ Makefile	(working copy)
@@ -69,9 +69,17 @@
 rom: $(HOSTTOOLS-y) payload $(COREBOOT-y)
 else
 
+# If compressing the payload in v3, parse the elf and tell lar to compress it.
+# Parsing the elf without compression bloats the ROM with bss zeroes.
+ifeq ($(CONFIG_USE_LZMA),y)
+LAR_PAYLOAD_FLAGS=-a -e -C lzma
+else
+LAR_PAYLOAD_FLAGS=-a
+endif
+
 rom: $(HOSTTOOLS-y) payload $(COREBOOT-y)
 	@ cp $(CBV3_OUTPUT) $(TARGET_ROM_FILE)
-	@ $(STAGING_DIR)/bin/lar -a $(TARGET_ROM_FILE) $(PAYLOAD_TARGET):normal/payload
+	@ $(STAGING_DIR)/bin/lar $(LAR_PAYLOAD_FLAGS) $(TARGET_ROM_FILE) $(PAYLOAD_TARGET):normal/payload
 	@ for file in `ls $(ROM_DIR)`; do \
 		$(STAGING_DIR)/bin/lar -a $(TARGET_ROM_FILE) $(ROM_DIR)/$$file:$$file; \
 	done
-- 
coreboot mailing list
[email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to