Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Unified Diff: utility/pack_firmware_image

Issue 6799009: Add EntryWiped to pack_firmware_image (Closed) Base URL: ssh://gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utility/pack_firmware_image
diff --git a/utility/pack_firmware_image b/utility/pack_firmware_image
index 28572e076d8e69eb36b7a0e873a1b117085c1474..7f0c41c552e22dfabf4512a2d2b7a23ad6c8660b 100755
--- a/utility/pack_firmware_image
+++ b/utility/pack_firmware_image
@@ -124,6 +124,29 @@ class EntryFmapArea(Entry):
pass
+class EntryWiped(EntryFmapArea):
+
+ def __init__(self, **kwargs):
+ Entry._CheckFields(kwargs, ('wipe_value',))
+ super(EntryWiped, self).__init__(**kwargs)
+ if type(self.wipe_value) is int:
+ try:
+ self.wipe_value = chr(self.wipe_value)
+ except ValueError as e:
+ raise PackError('cannot convert wipe_value to a character: %s' % str(e))
+ elif type(self.wipe_value) is str:
+ if len(self.wipe_value) != 1:
+ raise PackError('wipe_value out of range [00:ff]: %s' %
+ repr(self.wipe_value))
+ else:
+ raise PackError('wipe_value is neither int nor str: %s' %
+ repr(self.wipe_value))
+
+ def Pack(self, firmware_image, entries):
+ firmware_image.seek(self.offset)
+ firmware_image.write(self.wipe_value * self.length)
+
+
class EntryBlob(EntryFmapArea):
def __init__(self, **kwargs):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698