libflashrom
Functions
Operations

Functions

int flashrom_image_read (struct flashctx *const flashctx, void *const buffer, const size_t buffer_len)
 Read the current image from the specified ROM chip. More...
 
int flashrom_image_write (struct flashctx *const flashctx, void *const buffer, const size_t buffer_len, const void *const refbuffer)
 Write the specified image to the ROM chip. More...
 
int flashrom_image_verify (struct flashctx *const flashctx, const void *const buffer, const size_t buffer_len)
 Verify the ROM chip's contents with the specified image. More...
 

Detailed Description

Function Documentation

int flashrom_image_read ( struct flashctx *const  flashctx,
void *const  buffer,
const size_t  buffer_len 
)

Read the current image from the specified ROM chip.

If a layout is set in the specified flash context, only included regions will be read.

Parameters
flashctxThe context of the flash chip.
bufferTarget buffer to write image to.
buffer_lenSize of target buffer in bytes.
Returns
0 on success, 2 if buffer_len is too short for the flash chip's contents, or 1 on any other failure.
int flashrom_image_verify ( struct flashctx *const  flashctx,
const void *const  buffer,
const size_t  buffer_len 
)

Verify the ROM chip's contents with the specified image.

If a layout is set in the specified flash context, only included regions will be verified.

Parameters
flashctxThe context of the flash chip.
bufferSource buffer to verify with.
buffer_lenSize of source buffer in bytes.
Returns
0 on success, 3 if the chip's contents don't match, 2 if buffer_len doesn't match the size of the flash chip, or 1 on any other failure.
int flashrom_image_write ( struct flashctx *const  flashctx,
void *const  buffer,
const size_t  buffer_len,
const void *const  refbuffer 
)

Write the specified image to the ROM chip.

If a layout is set in the specified flash context, only erase blocks containing included regions will be touched.

Parameters
flashctxThe context of the flash chip.
bufferSource buffer to read image from (may be altered for full verification).
buffer_lenSize of source buffer in bytes.
refbufferIf given, assume flash chip contains same data as refbuffer.
Returns
0 on success, 4 if buffer_len doesn't match the size of the flash chip, 3 if write was tried but nothing has changed, 2 if write failed and flash contents changed, or 1 on any other failure.