coreboot-kgpe-d16/util
Sol Boucher 057256541b cbfstool: Fix ability to add files at offsets near the end of empty spaces
Because cbfs_add_entry_at() previously *assumed* it would have to create a
trailing empty entry, it was impossible to add files at exact offsets close
enough to the end of an existing empty entry that they occupied the remainder
of its space. This addresses the problem by skipping the step of creating the
trailing empty entry if doing so would place it at the start offset of whatever
already followed the original empty section.

BUG=chromium:473511
TEST=Run the following commands:
$ ./cbfstool test.image create -s 0x100000 -m arm
$ dd if=/dev/zero of=twok.bin bs=1 count=2048
$ ./cbfstool test.image add -t 0x50 -f twok.bin -n at_end -b 0xff7c0
$ ./cbfstool test.image add -t 0x50 -f twok.bin -n near_end -b 0xfef80
$ ./cbfstool test.image print
There shouldn't be any assertions, and the output should be:
test.image: 1024 kB, bootblocksize 0, romsize 1048576, offset 0x40
alignment: 64 bytes, architecture: arm

Name                           Offset     Type         Size
(empty)                        0x40       null         1044184
near_end                       0xfef40    raw          2048
at_end                         0xff780    raw          2048
BRANCH=None

Change-Id: Ic8a6c3dfa4f82346a067c0804afb6c5a5e89e6c8
Signed-off-by: Sol Boucher <solb@chromium.org>
Original-Commit-Id: 1bbd353fddc818f725e488e8f2fb6e967033539d
Original-Change-Id: I15d25df80787a8e34c2237262681720203509c72
Original-Signed-off-by: Sol Boucher <solb@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/263809
Original-Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Original-Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/9938
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
2015-04-25 12:16:57 +02:00
..
abuild abuild: add option to build with CHROMEOS enabled 2015-04-22 19:37:01 +02:00
acpi GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
amdtools Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
arm_boot_tools/mksunxiboot arm_boot_tools: Add 'b' to fopen flags for Windows compatibility 2014-12-19 18:55:34 +01:00
bimgtool util/bimgtool: Add verification mode 2015-04-10 12:03:35 +02:00
board_status Revert "board-status: Add field for release year" 2015-04-24 18:15:08 +02:00
broadcom util/broadcom: specify libraries after object files 2015-04-22 19:36:29 +02:00
cbfstool cbfstool: Fix ability to add files at offsets near the end of empty spaces 2015-04-25 12:16:57 +02:00
cbmem cbmem: switch over to imd-based cbmem 2015-04-22 22:56:31 +02:00
crossgcc crossgcc: Fix calling outside util/crossgcc 2015-03-30 12:04:39 +02:00
dtd_parser GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
dumpmmcr dumpmmcr: Fix compilation warnings in printf 2012-01-26 09:57:56 +01:00
ectool ectool: add query function to ectool 2015-04-08 08:41:59 +02:00
exynos exynos: Install the BL1 and set the checksum in the Makefile. 2014-09-09 20:01:18 +02:00
fletcher util/fletcher: fix debug option parsing 2014-10-18 14:45:42 +02:00
genbuild_h util/genbuild_h: work around GNU date 2015-03-29 22:45:08 +02:00
genprof util/genprof: improve handling of command line arguments 2014-08-12 09:02:44 +02:00
gitconfig git: add rebase helper script 2015-04-10 09:01:30 +02:00
i915tool util/i915tool: close the file also when fread() returned an error 2014-07-30 13:16:53 +02:00
ifdfake ifdfake - Create an IFD with just a section layout 2013-06-24 17:56:42 +02:00
ifdtool ifdtool: Add O_BINARY to open flags for Windows compatibility 2014-12-19 18:55:48 +01:00
inteltool inteltool: add ICH8M-E support 2015-03-26 03:33:46 +01:00
ipqheader util/ipqheader: Add utility to create uber-SBL for IPQ8064 2015-04-13 17:36:27 +02:00
k8resdump GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
kconfig kconfig: Add wildcard support for "source" 2015-04-06 23:52:57 +02:00
lbtdump lbtdump: Dump forwarded tables. 2014-03-09 21:19:29 +01:00
lint lint: Add check for new board name scheme 2015-04-18 08:31:36 +02:00
msrtool utils/msrtool: add westmere cpuids to nehalem 2015-02-11 02:51:16 +01:00
nvidia cbootimage: Add HOSTCC and flags 2015-02-15 09:21:02 +01:00
nvramtool nvramtool: fix getopt handling with unsigned char 2015-04-06 23:29:06 +02:00
optionlist GPLv2 notice: Unify all files to just use one space in »MA 02110-1301« 2013-03-01 10:16:08 +01:00
resetcf Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
rockchip add make_idb.py & update bootblock 2015-03-24 15:24:52 +01:00
romcc romcc: avoid use-after-free 2014-09-06 09:21:07 +02:00
runfw ARM: Generalize armv7 as arm. 2014-09-08 18:59:23 +02:00
sconfig sconfig: add cpu device type 2014-10-07 21:03:25 +02:00
showdevicetree ARM: Generalize armv7 as arm. 2014-09-08 18:59:23 +02:00
spkmodem_recv Add spkmodem receiver 2013-06-12 05:18:24 +02:00
superiotool util/superiotool: change displayed name of chip id 0xc333 (nct6776) 2014-12-19 19:01:47 +01:00
uio_usbdebug uio_usbdebug: User-space-i/o framework for usbdebug 2015-03-19 19:19:42 +01:00
vgabios Rename devices -> device 2012-11-30 23:59:58 +01:00
viatool viatool: Add utility to read various configuration bits on VIA systems 2013-06-04 22:36:26 +02:00
xcompile armv7-m: add armv7-m configuration 2015-04-10 07:42:18 +02:00