Skip to content

Commit 63024e7

Browse files
committed
docs/custom_images: Move architecture section up
to make sure it's more visible and deduplicate installation examples with the `CROSS_DEB_ARCH` variable.
1 parent 65802f9 commit 63024e7

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

docs/custom_images.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
<!--toc:start-->
2+
- [Automatic Target Architecture on Debian](#automatic-target-architecture-on-debian)
23
- [Custom Images](#custom-images)
34
- [Adding Dependencies to Existing Images](#adding-dependencies-to-existing-images)
45
- [Custom Dockerfile](#custom-dockerfile)
56
- [Custom Image](#custom-image)
6-
- [Automatic Target Architecture on Debian](#automatic-target-architecture-on-debian)
77
<!--toc:end-->
88

9+
# Automatic Target Architecture on Debian
10+
11+
Custom images generated from config `dockerfile` or `pre-build` keys will
12+
export `CROSS_DEB_ARCH`, which allows you to install packages from
13+
Ubuntu/Debian repositories without having to specify the exact architecture.
14+
You can find an
15+
[example of this here](#adding-dependencies-to-existing-images).
16+
17+
918
# Custom Images
1019

1120
`cross` provides default Docker images for the targets listed [in the
@@ -75,24 +84,6 @@ default one. Normal Docker behavior applies, so:
7584
- If only `tag` is omitted, then Docker will use the `latest` tag.
7685

7786

78-
# Automatic Target Architecture on Debian
79-
80-
Custom images generated from config `dockerfile` or `pre-build` keys will
81-
export `CROSS_DEB_ARCH`, which allows you to install packages from
82-
Ubuntu/Debian repositories without having to specify the exact architecture.
83-
For example, to install `OpenSSL` for the target, you can do:
84-
85-
```toml
86-
[target.aarch64-unknown-linux-gnu]
87-
pre-build = [
88-
"dpkg --add-architecture $CROSS_DEB_ARCH",
89-
"apt-get update && apt-get --assume-yes install libssl-dev:$CROSS_DEB_ARCH"
90-
]
91-
```
92-
93-
Here, `CROSS_DEB_ARCH` will automatically evaluate to `arm64`, without you
94-
having to explicitly provide it.
95-
9687

9788
[config-target-pre-build]: ./config.md#targettargetpre-build
9889
[config_target_dockerfile]: ./config.md#targettargetdockerfile

0 commit comments

Comments
 (0)