Skip to content

Commit 9943940

Browse files
committed
doc: explain usage of build.rs with network access
1 parent d7f8bcb commit 9943940

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ An OpenEmebdded/Yocto layer providing pre-built toolchains for the
99
- [meta-rust-bin](#meta-rust-bin)
1010
- [Basic Example](#basic-example)
1111
- [Features](#features)
12-
- [Use with Yocto Release 4.0 (kirkstone) and Above](#use-with-yocto-release-40-kirkstone-and-above)
13-
- [Use with Yocto Release 3.4 (honister) and Above](#use-with-yocto-release-34-honister-and-above)
12+
- [Allow `build.rs` to access the network in Yocto Release 4.0 (kirkstone) and Above](#allow-buildrs-to-access-the-network-in-yocto-release-40-kirkstone-and-above)
13+
- [Updating from an old `meta-rust-bin`](#updating-from-an-old-meta-rust-bin)
1414
- [Advanced Features](#advanced-features)
1515
- [Specifying Cargo Features](#specifying-cargo-features)
1616
- [Using Components Individually](#using-components-individually)
@@ -34,9 +34,6 @@ LICENSE = "MIT"
3434
3535
inherit cargo_bin
3636
37-
# Enable network for the compile task allowing cargo to download dependencies
38-
do_compile[network] = "1"
39-
4037
SRC_URI = "git://github.com/rust-embedded/gpio-utils.git;protocol=https;branch=master"
4138
SRCREV="02b0658cd7e13e46f6b1a5de3fd9655711749759"
4239
S = "${WORKDIR}/git"
@@ -76,18 +73,22 @@ Future:
7673
(provides space savings).
7774
* [ ] Total static linking using MUSL.
7875

79-
### Use with Yocto Release 4.0 (kirkstone) and Above
76+
### Allow `build.rs` to access the network in Yocto Release 4.0 (kirkstone) and Above
8077

8178
From Yocto version 4.0 network access from tasks is disabled by default on
8279
kernels which support this feature (on most recent distros such as CentOS 8 and
83-
Debian 11 onwards). The task `do_compile` need to access the network because it
84-
downloads dependencies, so add the following line to the recipe:
80+
Debian 11 onwards). If the `build.rs` needs access to the network, you have to
81+
enable the network for the `do_compile` task adding the following line to the
82+
recipe:
8583

8684
```bitbake
85+
# After the line `inherit cargo_bin`
86+
87+
# Enable network access for `build.rs` in compile task
8788
do_compile[network] = "1"
8889
```
8990

90-
### Updating from an old `meta-rust-bin`
91+
## Updating from an old `meta-rust-bin`
9192

9293
To avoid conflicts with the offical Rust layer of Yocto, the class `cargo` of
9394
`meta-rust-bin` was renamed to `cargo_bin`.

0 commit comments

Comments
 (0)