Skip to content

Commit 1b5087f

Browse files
alyssaisepilys
authored andcommitted
virtio-bindings: check in generated bindings again
This reverts 2c21f25 ("virtio-bindings: use bindgen library from build.rs"), and goes back to including generated bindings in the repo, because users have found the requirement to have an up to date libclang at build time to be onerous. We started generating the bindings at build time because we discovered they vary per architecture, so I've added a new generate-bindings.sh script that will generate bindings for a list of architectures, which will be easy to change in future. Fortunately endianness doesn't seem to make a difference to the generated bindings. Signed-off-by: Alyssa Ross <[email protected]> Fixes: #347
1 parent 9e86fac commit 1b5087f

File tree

180 files changed

+52011
-2356
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+52011
-2356
lines changed

virtio-bindings/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Upcoming Release
22

3+
## Changed
4+
5+
- Bindings are now once again distributed with the crate, rather than
6+
generated at build time.
7+
38
# v0.2.5
49

510
## Changed

virtio-bindings/CONTRIBUTING.md

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,28 @@
11
# Contributing to virtio-bindings
22

3-
## Overview
3+
## Dependencies
44

5-
virtio-bindings is periodically updated with imported virtio headers from the
6-
Linux kernel. The Linux header files have kernel header dependencies that are
7-
removed during import so that bindgen can process them in isolation without a
8-
full set of kernel headers. This is also necessary because the licenses of
9-
individual kernel header files varies and we only want to distribute
10-
BSD-licensed virtio headers.
5+
### Bindgen
6+
The bindings are currently generated using
7+
[bindgen](https://rust-lang.github.io/rust-bindgen/) version 0.71.1:
8+
```bash
9+
cargo install bindgen-cli --vers 0.71.1
10+
```
1111

12-
## Importing kernel headers
12+
### Linux Kernel
1313
Generating bindings depends on the Linux kernel, so you need to have the
1414
repository on your machine:
1515

1616
```bash
1717
git clone https://github.com/torvalds/linux.git
1818
```
1919

20-
Install the headers so they can be used for import:
21-
```bash
22-
cd linux
23-
git checkout <linux-version>
24-
make headers_install INSTALL_HDR_PATH=headers-<linux-version>
25-
```
20+
## Example for updating to a new kernel version
2621

27-
Import kernel headers into `include/`:
28-
```bash
29-
cd ~/vm-virtio/virtio-bindings
30-
./import-linux-headers.sh path/to/headers-<linux-version>
31-
```
22+
For this example we assume that you have both linux and virtio-bindings
23+
repositories in your home directory.
3224

33-
Test that the build still works:
3425
```bash
35-
cargo build
26+
cd ~/vm-virtio/virtio-bindings
27+
scripts/generate-bindings.sh ~/linux
3628
```
37-
38-
## Adding bindings for new header files
39-
New kernel headers can be added as follows:
40-
1. Add the new file to import-linux-headers.sh so it is imported from the Linux
41-
kernel header directory into include/.
42-
2. Add the new file to build.rs so bindgen generates bindings.
43-
3. Add the new module to src/lib.rs so the generated bindings are exposed in
44-
the crate.
45-
4. Check if `cargo build` still succeeds. If the header has new kernel header
46-
dependencies then you need to add them (if they are BSD licensed) or stub
47-
them out (if they are not BSD licensed).

virtio-bindings/build.rs

Lines changed: 0 additions & 39 deletions
This file was deleted.

virtio-bindings/include/linux/if_ether.h

Lines changed: 0 additions & 5 deletions
This file was deleted.

virtio-bindings/include/linux/types.h

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)