@@ -24,41 +24,22 @@ For this example we assume that you have both linux and vfio-bindings
24
24
repositories in your root and we will use linux version v5.2 as example.
25
25
26
26
``` 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.
39
28
cd linux
40
29
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.
42
31
git checkout v5.2
43
32
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
47
36
bindgen include/linux/vfio.h -o vfio.rs \
48
37
--impl-debug --with-derive-default \
49
38
--with-derive-partialeq --impl-partialeq \
50
39
-- -Iinclude
51
40
52
41
cd ~
53
42
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
64
45
```
0 commit comments