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

Issue 3246002: Add flashrom memory layout detection by FMAP (using fmap_decode) (Closed)

Created:
10 years, 3 months ago by Hung-Te
Modified:
9 years, 7 months ago
Reviewers:
Tom Wai-Hong Tam, vb
CC:
chromium-os-reviews_chromium.org, sosa+cc_chromium.org, seano, ericli, petkov+cc_chromium.org
Visibility:
Public.

Description

Add flashrom memory layout detection by FMAP (using fmap_decode) To support arbitrary memory layout in the future, we need to support fmap_decode. Before starting using / testing: (1) you must have fmap_decode ( http://code.google.com/p/flashmap/ ) installed and in PATH. on systems without fmap_decode, flashrom_util will fallback to internal layout. (2) you must have a BIOS firmware image with FMAP. (most recent images already have that - you can execute fmap_decode FILENAME to check) To use it <flashrom_util>: Add an extra image (flashrom image content, usually read by flashrom_util::read_whole() ) parameter when you call flashrom_util::detect_*_layout. If fmap_decode is found in system PATH and the image does have fmap, flashrom_util will use its layout instead. To use it <FlashromUtility>: No need to change anything. FlashromUtility will try to use fmap_decode if it's available. To verify / test: image = open(firmware_filename).read() <base test> # check the if the output offset/names are the same by compile_layout / decode_fmap_layout to same image. print compile_layout(DEFAULT_CHROMEOS_FIRMWARE_LAYOUT_DESCRIPTIONS['bios'], len(image)) print decode_fmap_layout(DEFAULT_CHROMEOS_FMAP_CONVERTION, image) <integrated test> # without image, only internal layout is used. print flashrom.detect_chromeos_bios_layout(len(image)) # with image, fmap will be tried. print flashrom.detect_chromeos_bios_layout(len(image), image) BUG=chrome-os-partner:920 TEST=manual Change-Id: I810a3a3ac8885ff4ac245c77d5b0ea8bcaec86de

Patch Set 1 #

Patch Set 2 : fix minor glitch #

Total comments: 2

Patch Set 3 : add python version fmap module, and refine according to reviewer's suggestion (drop defaults) #

Patch Set 4 : change site_fmap license header #

Unified diffs Side-by-side diffs Delta from patch set Stats (+311 lines, -25 lines) Patch
M client/common_lib/flashrom_util.py View 1 2 6 chunks +149 lines, -22 lines 0 comments Download
A client/common_lib/site_fmap.py View 3 1 chunk +154 lines, -0 lines 0 comments Download
M client/site_tests/factory_EnableWriteProtect/factory_EnableWriteProtect.py View 3 1 chunk +3 lines, -1 line 0 comments Download
M client/site_tests/hardware_Components/hardware_Components.py View 2 chunks +5 lines, -2 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Hung-Te
10 years, 3 months ago (2010-08-27 13:30:24 UTC) #1
vb
Hung-Te, can you please enhance the CL description a bit, explaining how this modification has ...
10 years, 3 months ago (2010-08-27 15:11:28 UTC) #2
Hung-Te
sorry - the CL desc is now improved.
10 years, 3 months ago (2010-08-27 16:31:52 UTC) #3
vb
LGTM Thank you for writing a good description. One question below I will leave to ...
10 years, 3 months ago (2010-08-27 17:04:01 UTC) #4
Hung-Te
10 years, 3 months ago (2010-08-30 10:35:07 UTC) #5
Hung-Te
10 years, 3 months ago (2010-08-30 10:40:00 UTC) #6
Added a python version of FMAP decoder from latest flashmap project.

Also refined the test files so that size/image are no longer default parameters
in flashrom_util.

http://codereview.chromium.org/3246002/diff/3001/4001
File client/common_lib/flashrom_util.py (right):

http://codereview.chromium.org/3246002/diff/3001/4001#newcode379
client/common_lib/flashrom_util.py:379: def detect_layout(self,
layout_desciption, size=None, image=None):
Basically for backward compatibility... Since most existing tests in autotest do
not trust/use the FMAP structure carried in image, adding default parameter here
helps migrating the source, so only those who wants FMAP to work can explicitly
provide the image.

But just like your comments and the style guilde suggested, it would be more
meaningful to remove the defaults so that users can address the different
behaviors. I will fix them later.

Powered by Google App Engine
This is Rietveld 408576698