summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChe-Liang Chiou <clchiou@chromium.org>2011-03-16 12:58:38 +0800
committerChe-Liang Chiou <clchiou@chromium.org>2011-03-16 12:58:38 +0800
commitb6a29ad3395c84a1c5c35a6a54bedbb867d4d4cd (patch)
tree604e2f29538a1274df6ab3dcfe5f9723b6a1a8ac
parentf3f948fb5536580fe06f8b8f01781211ad29f5e3 (diff)
downloadvboot-b6a29ad3395c84a1c5c35a6a54bedbb867d4d4cd.tar.gz
Allow overlap between "pure" fmap areas
Firmware specification has several sections that are overlapped. This CL allows limited overlapping that only "pure" fmap areas can be overlapped. See also CL=6694022,6696016 for its application. BUG=chrome-os-partner:2333 TEST=emerge vboot_reference && emerge-${ARM_BOARD} chromeos-bios Review URL: http://codereview.chromium.org/6677040 Change-Id: I9ca34caec3665136b1babd08cd074cf733cf0d51
-rwxr-xr-xutility/pack_firmware_image11
1 files changed, 9 insertions, 2 deletions
diff --git a/utility/pack_firmware_image b/utility/pack_firmware_image
index 7ec86073..28572e07 100755
--- a/utility/pack_firmware_image
+++ b/utility/pack_firmware_image
@@ -120,6 +120,9 @@ class EntryFmapArea(Entry):
Entry._CheckFields(kwargs, ('flags',))
super(EntryFmapArea, self).__init__(**kwargs)
+ def Pack(self, firmware_image, entries):
+ pass
+
class EntryBlob(EntryFmapArea):
@@ -130,7 +133,8 @@ class EntryBlob(EntryFmapArea):
def Pack(self, firmware_image, entries):
size = os.stat(self.path).st_size
if size > self.length:
- raise PackError('blob too large: %d > %d' % (size, self.length))
+ raise PackError('blob too large: %s: %d > %d' %
+ (self.path, size, self.length))
if size == 0: # special case for files like /dev/zero
size = self.length
with open(self.path, 'rb') as blob_image:
@@ -214,7 +218,10 @@ def parse_value(expr):
def pack_firmware_image(entries, output_path, image_size):
entries = sorted(entries, key=lambda e: e.offset)
for e1, e2 in zip(entries, entries[1:]):
- if e1.IsOverlapped(e2):
+ # Allow overlap between "pure" fmap areas, but not any of its subclasses
+ # Here we exploit the fact that Entry is a new-style class
+ if (e1.IsOverlapped(e2) and
+ type(e1) is not EntryFmapArea and type(e2) is not EntryFmapArea):
raise PackError('overlapped entries: [%08x:%08x], [%08x:%08x]' %
(e1.offset, e1.offset + e1.length, e2.offset, e2.offset + e2.length))