summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Benn <evanbenn@chromium.org>2022-08-11 09:32:46 +1000
committerEdward O'Callaghan <quasisec@chromium.org>2022-08-19 04:38:18 +0000
commit66b34f8ba30026b0cf7db1ce58c8990ebbf6ad48 (patch)
treed1245f5ca582acbce43595737f5299a31ab88544
parent401d9bfa71ee3269ff0e561c3ba795410b920e6d (diff)
downloadflashrom-66b34f8ba30026b0cf7db1ce58c8990ebbf6ad48.tar.gz
flashrom-66b34f8ba30026b0cf7db1ce58c8990ebbf6ad48.tar.bz2
flashrom-66b34f8ba30026b0cf7db1ce58c8990ebbf6ad48.zip
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 <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66618 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
-rw-r--r--README9
-rw-r--r--bindings/rust/README32
2 files changed, 40 insertions, 1 deletions
diff --git a/README b/README
index 160d3648a..49af09e92 100644
--- a/README
+++ b/README
@@ -39,7 +39,8 @@ page.
it with bzip2.
The snapshot tarballs are the result of 'make tarball' and require no
-further processing.
+further processing. Some git files (for example the rust bindings) are omitted
+from the tarball, as controlled by the .gitattributes files.
Build Instructions
@@ -164,6 +165,12 @@ If you are using clang and if you want to enable only one driver, you may hit an
overzealous compiler warning from clang. Compile with "make WARNERROR=no" to
force it to continue and enjoy.
+Bindings:
+
+ Foreign function interface bindings for the rust language are included in the
+ bindings folder. These are not compiled as part of the normal build process.
+ See the readme under bindings/rust for more information.
+
Installation
------------
diff --git a/bindings/rust/README b/bindings/rust/README
new file mode 100644
index 000000000..034118954
--- /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