| 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 """ | 6 """ |
| 7 This module provides convenience routines to access Flash ROM (EEPROM). | 7 This module provides convenience routines to access Flash ROM (EEPROM). |
| 8 - flashrom_util is a low level wrapper of flashrom(8) program. | 8 - flashrom_util is a low level wrapper of flashrom(8) program. |
| 9 - FlashromUtility is a high level object which provides more advanced | 9 - FlashromUtility is a high level object which provides more advanced |
| 10 features like journaling-alike (log-based) changing. | 10 features like journaling-alike (log-based) changing. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 # The location of flashrom(8)' tool binary | 37 # The location of flashrom(8)' tool binary |
| 38 DEFAULT_FLASHROM_TOOL_PATH = '/usr/sbin/flashrom' | 38 DEFAULT_FLASHROM_TOOL_PATH = '/usr/sbin/flashrom' |
| 39 | 39 |
| 40 # The default target names for BIOS and Embedded Controller (EC) | 40 # The default target names for BIOS and Embedded Controller (EC) |
| 41 DEFAULT_TARGET_NAME_BIOS= 'bios' | 41 DEFAULT_TARGET_NAME_BIOS= 'bios' |
| 42 DEFAULT_TARGET_NAME_EC = 'ec' | 42 DEFAULT_TARGET_NAME_EC = 'ec' |
| 43 | 43 |
| 44 # The default description of ChromeOS firmware layout | 44 # The default description of ChromeOS firmware layout |
| 45 # Check help(compile_layout) for the syntax. | 45 # Check help(compile_layout) for the syntax. |
| 46 # NOTE: "FVMAIN" is not typo, although it seems like lack of 'A' as postfix. | 46 # NOTE: Since the memory layout of BIOS may change very often, |
| 47 # the default layout is removed to prevent confusion. |
| 48 # Any BIOS image without FMAP is considered as corrupted. |
| 47 DEFAULT_CHROMEOS_FIRMWARE_LAYOUT_DESCRIPTIONS = { | 49 DEFAULT_CHROMEOS_FIRMWARE_LAYOUT_DESCRIPTIONS = { |
| 48 "bios": """ | 50 "bios": "", # retrieve from fmap, no defaults. |
| 49 FV_LOG = 0x20000, | |
| 50 NV_COMMON_STORE = 0x10000, | |
| 51 VBOOTA = 0x02000, | |
| 52 FVMAIN = 0xB0000, | |
| 53 VBOOTB = 0x02000, | |
| 54 FVMAINB = 0xB0000, | |
| 55 NVSTORAGE = 0x10000, | |
| 56 FV_RW_RESERVED = *, | |
| 57 | | |
| 58 FV_RO_RESERVED = *, | |
| 59 FVDEV = 0xB0000, | |
| 60 FV_GBB = 0x20000, | |
| 61 FV_BSTUB = 0x40000, | |
| 62 """, | |
| 63 "ec": """ | 51 "ec": """ |
| 64 EC_RO | 52 EC_RO |
| 65 | | 53 | |
| 66 EC_RW | 54 EC_RW |
| 67 """, | 55 """, |
| 68 } | 56 } |
| 69 | 57 |
| 70 # The default conversion table for fmap_decode. | 58 # The default conversion table for fmap_decode. |
| 59 # NOTE: "FVMAIN" is not typo, although it seems like lack of 'A' as postfix. |
| 71 DEFAULT_CHROMEOS_FMAP_CONVERSION = { | 60 DEFAULT_CHROMEOS_FMAP_CONVERSION = { |
| 72 "Boot Stub": "FV_BSTUB", | 61 "Boot Stub": "FV_BSTUB", |
| 73 "GBB Area": "FV_GBB", | 62 "GBB Area": "FV_GBB", |
| 74 "Recovery Firmware": "FVDEV", | 63 "Recovery Firmware": "FVDEV", |
| 75 "RO VPD": "RO_VPD", | 64 "RO VPD": "RO_VPD", |
| 76 "Firmware A Key": "VBOOTA", | 65 "Firmware A Key": "VBOOTA", |
| 77 "Firmware A Data": "FVMAIN", | 66 "Firmware A Data": "FVMAIN", |
| 78 "Firmware B Key": "VBOOTB", | 67 "Firmware B Key": "VBOOTB", |
| 79 "Firmware B Data": "FVMAINB", | 68 "Firmware B Data": "FVMAINB", |
| 80 "Log Volume": "FV_LOG", | 69 "Log Volume": "FV_LOG", |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 except ImportError: | 917 except ImportError: |
| 929 # print 'using mocks' | 918 # print 'using mocks' |
| 930 utils = mock_utils() | 919 utils = mock_utils() |
| 931 TestError = mock_TestError | 920 TestError = mock_TestError |
| 932 | 921 |
| 933 | 922 |
| 934 # main stub | 923 # main stub |
| 935 if __name__ == "__main__": | 924 if __name__ == "__main__": |
| 936 # TODO(hungte) provide unit tests or command line usage | 925 # TODO(hungte) provide unit tests or command line usage |
| 937 pass | 926 pass |
| OLD | NEW |