| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ This module provides convenience routines to access Flash ROM (EEPROM) | 6 """ This module provides convenience routines to access Flash ROM (EEPROM) |
| 7 | 7 |
| 8 saft_flashrom_util is based on utility 'flashrom'. | 8 saft_flashrom_util is based on utility 'flashrom'. |
| 9 | 9 |
| 10 Original tool syntax: | 10 Original tool syntax: |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 def _get_text_layout(self, file_name): | 68 def _get_text_layout(self, file_name): |
| 69 '''Retrieve text layout from a firmware image file. | 69 '''Retrieve text layout from a firmware image file. |
| 70 | 70 |
| 71 This function uses the 'mosys' utility to scan the firmware image and | 71 This function uses the 'mosys' utility to scan the firmware image and |
| 72 retrieve the section layout information. | 72 retrieve the section layout information. |
| 73 | 73 |
| 74 The layout is reported as a set of lines with multiple | 74 The layout is reported as a set of lines with multiple |
| 75 "<name>"="value" pairs, all this output is passed to the caller. | 75 "<name>"="value" pairs, all this output is passed to the caller. |
| 76 ''' | 76 ''' |
| 77 | 77 |
| 78 mosys_cmd = 'mosys -k eeprom map %s' % file_name | 78 mosys_cmd = 'mosys -f -k eeprom map %s' % file_name |
| 79 return self.os_if.run_shell_command_get_output(mosys_cmd) | 79 return self.os_if.run_shell_command_get_output(mosys_cmd) |
| 80 | 80 |
| 81 def _line_to_dictionary(self, line): | 81 def _line_to_dictionary(self, line): |
| 82 '''Convert a text layout line into a dictionary. | 82 '''Convert a text layout line into a dictionary. |
| 83 | 83 |
| 84 Get a string consisting of single space separated "<name>"="value>" | 84 Get a string consisting of single space separated "<name>"="value>" |
| 85 pairs and convert it into a dictionary where keys are the <name> | 85 pairs and convert it into a dictionary where keys are the <name> |
| 86 fields, and values are the corresponding <value> fields. | 86 fields, and values are the corresponding <value> fields. |
| 87 | 87 |
| 88 Return the dictionary to the caller. | 88 Return the dictionary to the caller. |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 self.os_if.run_shell_command(cmd) | 329 self.os_if.run_shell_command(cmd) |
| 330 | 330 |
| 331 # clean temporary resources | 331 # clean temporary resources |
| 332 self.remove_temp_file(tmpfn) | 332 self.remove_temp_file(tmpfn) |
| 333 self.remove_temp_file(layout_fn) | 333 self.remove_temp_file(layout_fn) |
| 334 | 334 |
| 335 def write_whole(self, base_image): | 335 def write_whole(self, base_image): |
| 336 '''Write the whole base image. ''' | 336 '''Write the whole base image. ''' |
| 337 layout_map = { 'all': (0, len(base_image) - 1) } | 337 layout_map = { 'all': (0, len(base_image) - 1) } |
| 338 self.write_partial(base_image, ('all',), layout_map) | 338 self.write_partial(base_image, ('all',), layout_map) |
| OLD | NEW |