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

Side by Side Diff: client/site_tests/factory_EnableWriteProtect/factory_EnableWriteProtect.py

Issue 3246002: Add flashrom memory layout detection by FMAP (using fmap_decode) (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git
Patch Set: change site_fmap license header Created 10 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # 2 #
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 import os 7 import os
8 8
9 from autotest_lib.client.bin import test, utils 9 from autotest_lib.client.bin import test, utils
10 from autotest_lib.client.common_lib import error 10 from autotest_lib.client.common_lib import error
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 '錯誤: 無法選取快閃記憶體目標 %s' % 56 '錯誤: 無法選取快閃記憶體目標 %s' %
57 (conf['name'], conf['name'])) 57 (conf['name'], conf['name']))
58 58
59 # build layout 59 # build layout
60 original = self.flashrom.read_whole() 60 original = self.flashrom.read_whole()
61 if not original: 61 if not original:
62 raise error.TestError( 62 raise error.TestError(
63 'Cannot read valid flash rom data.\n' \ 63 'Cannot read valid flash rom data.\n' \
64 '無法讀取快閃記憶體資料') 64 '無法讀取快閃記憶體資料')
65 flashrom_size = len(original) 65 flashrom_size = len(original)
66 layout = self.flashrom.detect_layout(conf['layout'], flashrom_size) 66 # do not trust current image when detecting layout.
67 layout = self.flashrom.detect_layout(conf['layout'],
68 flashrom_size, None)
67 if not layout: 69 if not layout:
68 raise error.TestError( 70 raise error.TestError(
69 'Cannot detect flash rom layout.\n' \ 71 'Cannot detect flash rom layout.\n' \
70 '無法偵測快閃記憶體配置結構') 72 '無法偵測快閃記憶體配置結構')
71 73
72 # enable write protection 74 # enable write protection
73 if self.verbose: 75 if self.verbose:
74 print ' - Enable Write Protection for %s' % conf['name'] 76 print ' - Enable Write Protection for %s' % conf['name']
75 if layout.keys().count('ro') != 1: 77 if layout.keys().count('ro') != 1:
76 raise error.TestError( 78 raise error.TestError(
77 "INTERNAL ERROR: Must be 1 RO section\n" \ 79 "INTERNAL ERROR: Must be 1 RO section\n" \
78 "內部錯誤: 須要單一個唯讀區段") 80 "內部錯誤: 須要單一個唯讀區段")
79 if not self.flashrom.enable_write_protect(layout, 'ro'): 81 if not self.flashrom.enable_write_protect(layout, 'ro'):
80 raise error.TestError( 82 raise error.TestError(
81 'ERROR: cannot enable write protection.\n' \ 83 'ERROR: cannot enable write protection.\n' \
82 '錯誤: 無法啟用寫入保護') 84 '錯誤: 無法啟用寫入保護')
83 85
84 # restore default selection. 86 # restore default selection.
85 if not self.flashrom.select_target(system_default_selection): 87 if not self.flashrom.select_target(system_default_selection):
86 raise error.TestError( 88 raise error.TestError(
87 'ERROR: cannot restore target.\n' \ 89 'ERROR: cannot restore target.\n' \
88 '錯誤: 無法還原快閃記憶體目標') 90 '錯誤: 無法還原快閃記憶體目標')
89 print " - Complete." 91 print " - Complete."
90 92
91 93
92 if __name__ == "__main__": 94 if __name__ == "__main__":
93 print "please run this program with autotest." 95 print "please run this program with autotest."
OLDNEW
« no previous file with comments | « client/common_lib/site_fmap.py ('k') | client/site_tests/hardware_Components/hardware_Components.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698