diff options
author | Che-Liang Chiou <clchiou@chromium.org> | 2011-05-24 13:56:17 +0800 |
---|---|---|
committer | Che-Liang Chiou <clchiou@chromium.org> | 2011-05-24 02:07:08 -0700 |
commit | a7b612a29d3565dd2b2f3ff98b4bdde0d91ca85b (patch) | |
tree | 8616913114cf53fb222e48c67418868e778465fb /utility | |
parent | 27b0dce002b7849371760d7d988b404637e88904 (diff) | |
download | vboot-a7b612a29d3565dd2b2f3ff98b4bdde0d91ca85b.tar.gz |
enhance pack_firmware_image0.13.558.B
* including fmap header in fmap areas
* initializing blobs by string value
BUG=chromium-os:15633
TEST=emerge-tegra2_{seaboard,kaen} chromeos-bios
Change-Id: Ib87a3f60fb11804888c4bc023d595629e017f589
Reviewed-on: http://gerrit.chromium.org/gerrit/1427
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Diffstat (limited to 'utility')
-rwxr-xr-x | utility/pack_firmware_image | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/utility/pack_firmware_image b/utility/pack_firmware_image index 7f0c41c5..1ca1b326 100755 --- a/utility/pack_firmware_image +++ b/utility/pack_firmware_image @@ -80,7 +80,17 @@ class Entry(dict): raise PackError('class Entry does not implement Pack()') -class EntryFmap(Entry): +class EntryFmapArea(Entry): + + def __init__(self, **kwargs): + Entry._CheckFields(kwargs, ('flags',)) + super(EntryFmapArea, self).__init__(**kwargs) + + def Pack(self, firmware_image, entries): + pass + + +class EntryFmap(EntryFmapArea): def __init__(self, **kwargs): Entry._CheckFields(kwargs, ('ver_major', 'ver_minor', 'base', 'size')) @@ -90,9 +100,8 @@ class EntryFmap(Entry): # prepare header areas areas = [] for e in entries: - if isinstance(e, EntryFmapArea): - areas.append(dict((name, e[name] if name != 'size' else e['length']) - for name in FMAP_AREA_NAMES)) + areas.append(dict((name, e[name] if name != 'size' else e['length']) + for name in FMAP_AREA_NAMES)) # prepare header obj = {'areas':areas} @@ -114,16 +123,6 @@ class EntryFmap(Entry): firmware_image.write(blob) -class EntryFmapArea(Entry): - - def __init__(self, **kwargs): - Entry._CheckFields(kwargs, ('flags',)) - super(EntryFmapArea, self).__init__(**kwargs) - - def Pack(self, firmware_image, entries): - pass - - class EntryWiped(EntryFmapArea): def __init__(self, **kwargs): @@ -147,6 +146,20 @@ class EntryWiped(EntryFmapArea): firmware_image.write(self.wipe_value * self.length) +class EntryBlobString(EntryFmapArea): + + def __init__(self, **kwargs): + Entry._CheckFields(kwargs, ('value',)) + super(EntryBlobString, self).__init__(**kwargs) + + def Pack(self, firmware_image, entries): + if len(self.value) > self.length: + raise PackError('string too large: len(%s) > %d' % + (self.value, self.length)) + firmware_image.seek(self.offset) + firmware_image.write(self.value) + + class EntryBlob(EntryFmapArea): def __init__(self, **kwargs): |