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

Unified Diff: flashrom_handler.py

Issue 6649008: Fix SAFT operation on Alex. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/saft.git@master
Patch Set: Fix SAFT operation. Created 9 years, 9 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 | « chromeos_interface.py ('k') | saft_flashrom_util.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: flashrom_handler.py
diff --git a/flashrom_handler.py b/flashrom_handler.py
index 3e16d340af460f0194a3da8491dbc847db11c339..fccfb213cbde7bf7e01683741c8c0b66f3fdecc5 100755
--- a/flashrom_handler.py
+++ b/flashrom_handler.py
@@ -227,6 +227,36 @@ class FlashromHandler(object):
subsection_name = self.restore_section(section)
self.fum.write_partial(self.image, (subsection_name, ))
+ def firmware_sections_equal(self):
+ '''Check if firmware sections A and B are equal.
+
+ This function presumes that the entire BIOS image integrity has been
+ verified, so different signature sections mean different images and
+ vice versa.
+ '''
+ sig_a = self.fum.get_section(self.image,
+ self.fv_sections['a'].get_sig_name())
+ sig_b = self.fum.get_section(self.image,
+ self.fv_sections['b'].get_sig_name())
+ return sig_a == sig_b
+
+ def copy_from_to(self, src, dst):
+ '''Copy one firmware image section to another.
+
+ This function copies both signature and body of one firmware section
+ into another. After this function runs both sections are identical.
+ '''
+ src_sect = self.fv_sections[src]
+ dst_sect = self.fv_sections[dst]
+ self.image = self.fum.put_section(
+ self.image,
+ dst_sect.get_body_name(),
+ self.fum.get_section(self.image, src_sect.get_body_name()))
+ self.image = self.fum.put_section(
+ self.image,
+ dst_sect.get_sig_name(),
+ self.fum.get_section(self.image, src_sect.get_sig_name()))
+
def write_whole(self):
'''Write the whole image into the flashrom.'''
« no previous file with comments | « chromeos_interface.py ('k') | saft_flashrom_util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698