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 <patrick@georgi-clan.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@355 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Stefan Reinauer 2007-06-16 14:34:17 +00:00
parent e19d69c558
commit fe524d4646
5 changed files with 37 additions and 27 deletions

View file

@ -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.
#

View file

@ -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

View file

@ -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 $@ $^
# -----------------------------------------------------------------------------

View file

@ -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

View file

@ -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/