From 924f0a64219e29a9c394afec3c9e93f7549f8046 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Wed, 9 Dec 2015 15:11:42 -0800 Subject: [PATCH] cbfstool: Change FMAP granularity to 16 bytes Instead of looking for an FMAP at every byte, only search down to a granularity of 16 bytes, reducing the time for a cbfstool call by 0.3s when no FMAP is found. Signed-off-by: Stefan Reinauner BUG=none BRANCH=none TEST=time ./cbfstool coreboot.rom add -f locale_de.bin -n locale_de.bin -t 0x50 -c lzma is 0.3s faster than before. Change-Id: Icb4937330e920ae09928ceda7c1af6a3c5130ac7 Signed-off-by: Patrick Georgi Original-Commit-Id: bc92d838ba9db7733870ea6e8423fa4fa41bf8fe Original-Change-Id: Idbaec58a199df93bdc10e883c56675b419ab5b8e Original-Reviewed-on: https://chromium-review.googlesource.com/317321 Original-Commit-Ready: Stefan Reinauer Original-Tested-by: Stefan Reinauer Original-Reviewed-by: Daisuke Nojiri Reviewed-on: https://review.coreboot.org/12932 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- util/cbfstool/flashmap/fmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/cbfstool/flashmap/fmap.c b/util/cbfstool/flashmap/fmap.c index 24181d0b43..733f468390 100644 --- a/util/cbfstool/flashmap/fmap.c +++ b/util/cbfstool/flashmap/fmap.c @@ -139,7 +139,7 @@ static long int fmap_bsearch(const uint8_t *image, size_t len) * remainder when modding the offset with the previous stride. This * makes it so that each offset is only checked once. */ - for (stride = len / 2; stride >= 1; stride /= 2) { + for (stride = len / 2; stride >= 16; stride /= 2) { if (fmap_found) break;