1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 14:42:36 +02:00
roccochen@chromium.com 04deed8c8f flashrom_tester: Fix partial_lock_test on libflashrom
partial_lock_test (Lock_top_quad, Lock_bottom_quad, Lock_bottom_half,
and Lock_top_half) tries to:
1. Disable HWWP
2. Lock partial
3. Enable HWWP
4. Try to write the locked partial and expect a failure
...

The 4th step only works on flashrom binary since the binary will set
FLASHROM_FLAG_VERIFY_AFTER_WRITE=1 by default and it will error out
while verifying.

But libflashrom does not set any flag beforehand, so it has
FLASHROM_FLAG_VERIFY_AFTER_WRITE=0 and thus it will think the write
command works normally and raise no error. This causes the issue that
flashrom_tester with libflashrom has been failed until today.

To solve this issue, there are two solutions:
1. Take care of the default flags in libflashrom
2. Always pass --noverify to flashrom binary and verify it afterwards.

To make both methods more consistent, I fix it with approach 1.

BUG=b:304439294
BRANCH=none
TEST=flashrom_tester internal --libflashrom Lock_top_quad

Change-Id: I7a8ac0c0984fef3cd9e73ed8d8097ddf429e54b2
Signed-off-by: roccochen@chromium.com <roccochen@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/79304
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-02-03 07:43:35 +00:00
..

-------------------------------------------------------------------------------
flashrom rust bindings README
-------------------------------------------------------------------------------

Included within this folder are rust foreign function interface bindings for the
libflashrom API. libflashrom-sys is an automatically generated binding built
from the header file by the rust `bindgen` utility. It can be used for 'unsafe'
raw access to the libflashrom API. libflashrom is a library built on
libflashrom-sys, exporting a convential rust API.

See the /util/flashrom_tester/flashrom/src/flashromlib.rs file for an example of
usage.

Build Instructions
------------------

A rust toolchain is required, rustup is one source for that: https://rustup.rs/

From within child folders of this directory, where the Cargo.toml files live,
run:

 cargo build
 cargo test
 cargo doc --open

The build process uses pkg-config to find the installed version of libflashrom.
To override the desired version you wish to compile against pkg-config can be
told where to find the desired header and library, for example:

 env PKG_CONFIG_PATH=$HOME/src/flashrom/build/install/lib/x86_64-linux-gnu/pkgconfig \
    LD_LIBRARY_PATH=$HOME/src/flashrom/build/install/lib/x86_64-linux-gnu \
    cargo test