diff options
author | Patrick Georgi <pgeorgi@chromium.org> | 2017-01-11 15:26:58 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2017-01-12 21:40:25 +0100 |
commit | c88d16baaf3e88029b40d43eb254e90613b95187 (patch) | |
tree | b1b4e8fc15ec880db97d42cfbfb7adcd85d445ff /util/cbfstool/Makefile.inc | |
parent | 8474e7d7e83e92f3d7118311e2e35dc86dcc3ef5 (diff) |
util/cbfstool: Add cbfs-compression-tool
cbfs-compression-tool provides a way to benchmark the compression
algorithms as used by cbfstool (and coreboot) and allows to
pre-compress data for later consumption by cbfstool (once it supports
the format).
For an impression, the benchmark's results on my machine:
measuring 'none'
compressing 10485760 bytes to 10485760 took 0 seconds
measuring 'LZMA'
compressing 10485760 bytes to 1736 took 2 seconds
measuring 'LZ4'
compressing 10485760 bytes to 41880 took 0 seconds
And a possible use for external compression, parallel and non-parallel
(60MB in 53 files compressed to 650KB on a machine with 40 threads):
$ time (ls -1 *.* |xargs -n 1 -P $(nproc) -I '{}' cbfs-compression-tool compress '{}' out/'{}' LZMA)
real 0m0.786s
user 0m11.440s
sys 0m0.044s
$ time (ls -1 *.* |xargs -n 1 -P 1 -I '{}' cbfs-compression-tool compress '{}' out/'{}' LZMA)
real 0m10.444s
user 0m10.280s
sys 0m0.064s
Change-Id: I40be087e85d09a895b1ed277270350ab65a4d6d4
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: https://review.coreboot.org/18099
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'util/cbfstool/Makefile.inc')
-rw-r--r-- | util/cbfstool/Makefile.inc | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/util/cbfstool/Makefile.inc b/util/cbfstool/Makefile.inc index 6882cbaf60..950092fb62 100644 --- a/util/cbfstool/Makefile.inc +++ b/util/cbfstool/Makefile.inc @@ -1,7 +1,20 @@ +compressionobj := +compressionobj += compress.o +# LZ4 +compressionobj += lz4.o +compressionobj += lz4hc.o +compressionobj += lz4frame.o +compressionobj += xxhash.o +compressionobj += lz4_wrapper.o +# LZMA +compressionobj += lzma.o +compressionobj += LzFind.o +compressionobj += LzmaDec.o +compressionobj += LzmaEnc.o + cbfsobj := cbfsobj += cbfstool.o cbfsobj += common.o -cbfsobj += compress.o cbfsobj += cbfs_image.o cbfsobj += cbfs-mkstage.o cbfsobj += cbfs-mkpayload.o @@ -13,24 +26,13 @@ cbfsobj += partitioned_file.o # COMMONLIB cbfsobj += cbfs.o cbfsobj += fsp_relocate.o -cbfsobj += lz4_wrapper.o cbfsobj += mem_pool.o cbfsobj += region.o -# LZMA -cbfsobj += lzma.o -cbfsobj += LzFind.o -cbfsobj += LzmaDec.o -cbfsobj += LzmaEnc.o # CRYPTOLIB cbfsobj += 2sha_utility.o cbfsobj += 2sha1.o cbfsobj += 2sha256.o cbfsobj += 2sha512.o -# LZ4 -cbfsobj += lz4.o -cbfsobj += lz4hc.o -cbfsobj += lz4frame.o -cbfsobj += xxhash.o # FMAP cbfsobj += fmap.o cbfsobj += kv_pair.o @@ -38,6 +40,8 @@ cbfsobj += valstr.o # linux as payload cbfsobj += linux_trampoline.o cbfsobj += cbfs-payload-linux.o +# compression algorithms +cbfsobj += $(compressionobj) fmapobj := fmapobj += fmaptool.o @@ -62,6 +66,10 @@ ifwiobj := ifwiobj += ifwitool.o ifwiobj += common.o +cbfscompobj := +cbfscompobj += $(compressionobj) +cbfscompobj += cbfscomptool.o + TOOLCFLAGS ?= -Werror -Wall -Wextra TOOLCFLAGS += -Wcast-qual -Wmissing-prototypes -Wredundant-decls -Wshadow TOOLCFLAGS += -Wstrict-prototypes -Wwrite-strings @@ -141,6 +149,10 @@ $(objutil)/cbfstool/ifwitool: $(addprefix $(objutil)/cbfstool/,$(ifwiobj)) printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(ifwiobj)) +$(objutil)/cbfstool/cbfs-compression-tool: $(addprefix $(objutil)/cbfstool/,$(cbfscompobj)) + printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" + $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cbfscompobj)) + # Yacc source is superset of header $(objutil)/cbfstool/fmd.o: TOOLCFLAGS += -Wno-redundant-decls $(objutil)/cbfstool/fmd_parser.o: TOOLCFLAGS += -Wno-redundant-decls |