From fe524d4646cc63366f26676bc33a139c0abb9fc9 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Sat, 16 Jun 2007 14:34:17 +0000 Subject: [PATCH] This patch enables build of both compressors (instead of the current stubs), both as utilities and object files to link with lar (once lar is capable of that). There are some details that could be discussed (eg. I could avoid the duplication of LZMA_OBJ, but that would mean using ::-rules in util/lzma/Makefile with whatever side effects those bring, or by splitting them into a separate file), but I tried it here, and it works. Signed-off-by: Patrick Georgi Acked-by: Stefan Reinauer git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@355 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- arch/x86/Makefile | 16 +--------------- lib/Makefile | 11 +++++++++-- util/lar/Makefile | 19 ++++++++++++++++--- util/lzma/Makefile | 12 +++++++----- util/nrv2b/Makefile | 6 ++++-- 5 files changed, 37 insertions(+), 27 deletions(-) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 199fc87e25..8097ced3b7 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -36,7 +36,7 @@ SILENT := >/dev/null 2>&1 ROM_SIZE := $(shell expr $(CONFIG_LINUXBIOS_ROMSIZE_KB) \* 1024) -$(obj)/linuxbios.rom: $(obj)/linuxbios.bootblock $(obj)/util/lar/lar lzma $(obj)/linuxbios.initram $(obj)/linuxbios.stage2 $(obj)/option_table payload_compress +$(obj)/linuxbios.rom: $(obj)/linuxbios.bootblock $(obj)/util/lar/lar lzma nrv2b $(obj)/linuxbios.initram $(obj)/linuxbios.stage2 $(obj)/option_table $(Q)rm -rf $(obj)/lar.tmp $(Q)mkdir $(obj)/lar.tmp $(Q)mkdir $(obj)/lar.tmp/normal @@ -157,20 +157,6 @@ $(obj)/linuxbios.stage2: $(obj)/stage0.init $(STAGE2_OBJ) $(Q)$(OBJCOPY) -O binary $(obj)/linuxbios.stage2.o $(obj)/linuxbios.stage2 -# -# TODO: Compress the payload (CONFIG_PAYLOAD_FILE) with the default compressor. -# - -payload_compress: -ifeq ($(CONFIG_PAYLOAD_NONE),y) -else -ifeq ($(CONFIG_DEFAULT_COMPRESSION_NONE),y) -else - $(Q)printf " ZIP $(CONFIG_PAYLOAD_FILE) (skipped)\n" -endif -endif - - # # Build rules. # diff --git a/lib/Makefile b/lib/Makefile index 747897ff49..4e36e60a5a 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -32,9 +32,16 @@ endif # in a way that they can be put in the lar. # +ifeq ($(CONFIG_COMPRESSION_LZMA),y) +lzma: $(obj)/util/lzma/lzma $(obj)/util/lzma/lzma-compress.o +else lzma: -ifeq ($(CONFIG_DEFAULT_COMPRESSION_LZMA),y) - $(Q)printf " BUILD LZMA (skipped)\n" +endif + +ifeq ($(CONFIG_COMPRESSION_NRV2B),y) +nrv2b: $(obj)/util/nrv2b/nrv2b $(obj)/util/nrv2b/nrv2b-compress.o +else +nrv2b: endif $(obj)/lib/%.o: $(src)/lib/%.c diff --git a/util/lar/Makefile b/util/lar/Makefile index ed4b431d48..37e114a7d0 100644 --- a/util/lar/Makefile +++ b/util/lar/Makefile @@ -18,12 +18,25 @@ ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA ## +LZMA_OBJ := $(obj)/util/lzma/LZMAEncoder.o $(obj)/util/lzma/LZInWindow.o +LZMA_OBJ += $(obj)/util/lzma/RangeCoderBit.o $(obj)/util/lzma/StreamUtils.o +LZMA_OBJ += $(obj)/util/lzma/OutBuffer.o $(obj)/util/lzma/Alloc.o +LZMA_OBJ += $(obj)/util/lzma/CRC.o + SOURCE := lar.c create.c extract.c list.c lib.c bootblock.c -$(obj)/util/lar/lar: $(patsubst %,$(src)/util/lar/%,$(SOURCE)) +ifeq ($(CONFIG_COMPRESSION_LZMA),y) +COMPRESSOR := $(LZMA_OBJ) $(obj)/util/lzma/lzma-compress.o +endif + +ifeq ($(CONFIG_COMPRESSION_NRV2B),y) +COMPRESSOR += $(obj)/util/nrv2b/nrv2b-compress.o +endif + +$(obj)/util/lar/lar: $(patsubst %,$(src)/util/lar/%,$(SOURCE)) $(COMPRESSOR) $(Q)mkdir -p $(obj)/util/lar - $(Q)printf " HOSTCC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(HOSTCC) $(HOSTCFLAGS) -o $@ $^ + $(Q)printf " HOSTCXX $(subst $(shell pwd)/,,$(@))\n" + $(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ $^ # ----------------------------------------------------------------------------- diff --git a/util/lzma/Makefile b/util/lzma/Makefile index 2b7ef8be42..8e38150410 100644 --- a/util/lzma/Makefile +++ b/util/lzma/Makefile @@ -21,14 +21,16 @@ LZMA_OBJ := $(obj)/util/lzma/LZMAEncoder.o $(obj)/util/lzma/LZInWindow.o LZMA_OBJ += $(obj)/util/lzma/RangeCoderBit.o $(obj)/util/lzma/StreamUtils.o LZMA_OBJ += $(obj)/util/lzma/OutBuffer.o $(obj)/util/lzma/Alloc.o -LZMA_OBJ += $(obj)/util/lzma/CRC.o $(obj)/util/lzma/minilzma.o +LZMA_OBJ += $(obj)/util/lzma/CRC.o -$(obj)/util/lzma/lzma: lzmadir $(LZMA_OBJ) - $(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ $(LZMA_OBJ) - $(Q)printf "done\n" +$(obj)/util/lzma/lzma: lzmadir $(LZMA_OBJ) $(obj)/util/lzma/minilzma.o + $(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ $(LZMA_OBJ) $(obj)/util/lzma/minilzma.o + +$(obj)/util/lzma/lzma-compress.o: $(src)/util/lzma/minilzma.cc + $(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c -DCOMPACT $< lzmadir: - $(Q)printf "Building LZMA compressor... " + $(Q)printf " BUILD LZMA\n" $(Q)mkdir -p $(obj)/util/lzma/ $(obj)/util/lzma/%.o: $(src)/util/lzma/C/7zip/Compress/LZMA/%.cpp diff --git a/util/nrv2b/Makefile b/util/nrv2b/Makefile index 0869e418e8..bfc5830767 100644 --- a/util/nrv2b/Makefile +++ b/util/nrv2b/Makefile @@ -21,9 +21,11 @@ $(obj)/util/nrv2b/nrv2b: nrv2bdir $(src)/util/nrv2b/nrv2b.c $(Q)$(HOSTCC) $(HOSTCFLAGS) -DENCODE -DDECODE -DMAIN -DVERBOSE -DNDEBUG -DBITSIZE=32 -DENDIAN=0 -o $@ $(src)/util/nrv2b/nrv2b.c - $(Q)printf "done\n" + +$(obj)/util/nrv2b/nrv2b-compress.o: nrv2bdir $(src)/util/nrv2b/nrv2b.c + $(Q)$(HOSTCC) $(HOSTCFLAGS) -DENCODE -DVERBOSE -DCOMPACT -DNDEBUG -DBITSIZE=32 -DENDIAN=0 -c -o $@ $(src)/util/nrv2b/nrv2b.c nrv2bdir: - $(Q)printf "Building nrv2b compressor... " + $(Q)printf " BUILD NRV2B\n" $(Q)mkdir -p $(obj)/util/nrv2b/