First version of XFV

A script and C backend to extract firmware images.

Christoph Pfisterer <> has agreed by mail to publish his
part of this code as public domain. Decompress.c is (c) Intel under
BSD 2-clause. The small bits in this commit by Stefan Tauner are
also public domain.

The code has been reformated by autopep8.

Change-Id: Ic3a03bd289999d0086219441eddfc1ae72d06f8c
Signed-off-by: Stefan Tauner <>
Tested-by: build bot (Jenkins)
Reviewed-by: Anton Kochkov <>
Reviewed-by: Patrick Georgi <>
diff --git a/Makefile b/Makefile
index 5484387..10d5b38 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
 MAKE = make
 CFLAGS ?= -g -fpack-struct -Wall -O0
-CC = gcc
+CC ?= gcc
-all: bios_extract bcpvpd ami_slab
+all: bios_extract bcpvpd ami_slab xfv
 BIOS_EXTRACT_OBJS = lh5_extract.o ami.o award.o phoenix.o bios_extract.o compat.o
 bios_extract: $(BIOS_EXTRACT_OBJS)
@@ -16,6 +16,10 @@
 ami_slab: $(AMISLAB_OBJS)
 	$(CC) $(CFLAGS) $(AMISLAB_OBJS) -o ami_slab
+XFV_OBJS = xfv/Decompress.o xfv/efidecomp.o
+xfv: $(XFV_OBJS)
+	$(CC) -I xfv/ $(CFLAGS) -o xfv/efidecomp $(XFV_OBJS)
 # just here to easily verify the functionality of the lh5 routine
 LH5_TEST_OBJS = lh5_extract.o lh5_test.o
 lh5_test: $(LH5_TEST_OBJS)
@@ -27,3 +31,6 @@
 	rm -f bcpvpd
 	rm -f lh5_test
 	rm -f ami_slab
+	rm -f xfv/efidecomp xfv/*.o
+.PHONY: all bios_extract bcpvpd ami_slab efidecomp lh5_test clean