Skip to content

Commit 79f6062

Browse files
RuoqingHelikebreath
authored andcommitted
vfio-bindings: Update CONTRIBUTING.md
Document how to regenerate `vfio_bindings` from linux source. Signed-off-by: Ruoqing He <[email protected]>
1 parent 18370f1 commit 79f6062

File tree

1 file changed

+7
-26
lines changed

1 file changed

+7
-26
lines changed

vfio-bindings/CONTRIBUTING.md

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,41 +24,22 @@ For this example we assume that you have both linux and vfio-bindings
2424
repositories in your root and we will use linux version v5.2 as example.
2525

2626
```bash
27-
# Step 1: Crate a new module using a name with format "bindings_vVERSION" in
28-
# src/
29-
cd vfio-bindings
30-
mkdir src/bindings_v5_2_0
31-
cd ~
32-
33-
# Step 2: Copy the "mod.rs" file from the directory of an already existing
34-
# version module to the one we've just created.
35-
cd vfio-bindings/src
36-
cp bindings_v5_0_0/mod.rs bindings_v5_2_0/mod.rs
37-
38-
# linux is the repository that you cloned at the previous step.
27+
# linux is the repository that you cloned previously.
3928
cd linux
4029

41-
# Step 3: Checkout the version you want to generate the bindings for.
30+
# Step 1: Checkout the version you want to generate the bindings for.
4231
git checkout v5.2
4332

44-
# Step 4: Generate the bindings from the kernel headers.
45-
make headers_install INSTALL_HDR_PATH=v5_2_headers
46-
cd v5_2_headers
33+
# Step 2: Generate the bindings from the kernel headers.
34+
make headers_install INSTALL_HDR_PATH=vfio_headers
35+
cd vfio_headers
4736
bindgen include/linux/vfio.h -o vfio.rs \
4837
--impl-debug --with-derive-default \
4938
--with-derive-partialeq --impl-partialeq \
5039
-- -Iinclude
5140

5241
cd ~
5342

54-
# Step 5: Copy the generated files to the new version module.
55-
cp linux/v5_2_headers/vfio.rs vfio-bindings/src/bindings_v5_2_0
56-
```
57-
Finally add the new version module to `vfio-bindings/lib.rs`. If this version
58-
is newer than the others already present, make this version the default one by
59-
getting it imported when there isn't any other version specified as a feature:
60-
61-
```rust
62-
#[cfg(all(not(feature = "vfio-v5_0_0"), not(feature = "vfio-v5_2_0")))]
63-
pub use super::bindings_v5_2_0::*;
43+
# Step 3: Copy the generated files to the new version module.
44+
cp linux/vfio_headers/vfio.rs vfio-bindings/src/vfio_bindings
6445
```

0 commit comments

Comments
 (0)