From 66b34f8ba30026b0cf7db1ce58c8990ebbf6ad48 Mon Sep 17 00:00:00 2001 From: Evan Benn Date: Thu, 11 Aug 2022 09:32:46 +1000 Subject: bindings/rust: Document the rust bindings Add an explanation of the two rust libraries, and instructions for building. Note that the bindings are not included in the tarball. BUG=None BRANCH=None TEST=None Change-Id: I05b1b5821554f8faee7728f899d51b6e8e9bf5be Signed-off-by: Evan Benn Reviewed-on: https://review.coreboot.org/c/flashrom/+/66618 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan --- bindings/rust/README | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 bindings/rust/README (limited to 'bindings') diff --git a/bindings/rust/README b/bindings/rust/README new file mode 100644 index 00000000..03411895 --- /dev/null +++ b/bindings/rust/README @@ -0,0 +1,32 @@ +------------------------------------------------------------------------------- +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 -- cgit v1.2.3