Skip to content

Commit 64a2788

Browse files
authored
Rollup merge of #74294 - msirringhaus:master, r=pietroalbini
Update cross-compilation README README seemed rather out of date. I hope the information in my PR is now correct (it was more or less assembled by asking in zulip and learning-by-doing).
2 parents b7cf2cb + 92e010e commit 64a2788

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

src/ci/docker/README.md

+31-8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ for example:
1616

1717
Images will output artifacts in an `obj` dir at the root of a repository.
1818

19+
To match conditions in rusts CI, also set the environment variable `DEPLOY=1`, e.g.:
20+
```
21+
DEPLOY=1 ./src/ci/docker/run.sh x86_64-gnu
22+
```
23+
1924
**NOTE**: Re-using the same `obj` dir with different docker images with
2025
the same target triple (e.g. `dist-x86_64-linux` and `dist-various-1`)
2126
may result in strange linker errors, due shared library versions differing between platforms.
@@ -85,42 +90,60 @@ how to generate them, and how the existing ones were generated.
8590
8691
### Generating a `.config` file
8792
93+
**NOTE:** Existing Dockerfiles can also be a good guide for the process and order
94+
of script execution.
95+
8896
If you have a `linux-cross` image lying around you can use that and skip the
8997
next two steps.
9098
91-
- First we spin up a container and copy `build_toolchain_root.sh` into it. All
99+
- First we spin up a container and copy all scripts into it. All
92100
these steps are outside the container:
93101
94102
```
95-
# Note: We use ubuntu:15.10 because that's the "base" of linux-cross Docker
96-
# image
97-
$ docker run -it ubuntu:15.10 bash
103+
# Note: We use ubuntu:16.04 because that's the "base" of linux-cross Docker
104+
# image, or simply run ./src/ci/docker/run.sh once, which will download the correct
105+
# one and you can check it out with `docker images`
106+
$ docker run -it ubuntu:16.04 bash
107+
# in another terminal:
98108
$ docker ps
99109
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
100-
cfbec05ed730 ubuntu:15.10 "bash" 16 seconds ago Up 15 seconds drunk_murdock
101-
$ docker cp build_toolchain_root.sh drunk_murdock:/
110+
cfbec05ed730 ubuntu:16.04 "bash" 16 seconds ago Up 15 seconds drunk_murdock
111+
$ docker cp src/ci/docker/scripts drunk_murdock:/tmp/
102112
```
103113
104114
- Then inside the container we build crosstool-ng by simply calling the bash
105115
script we copied in the previous step:
106116
107117
```
108-
$ bash build_toolchain_root.sh
118+
$ cd /tmp/scripts
119+
# Download packages necessary for building
120+
$ bash ./cross-apt-packages.sh
121+
# Download and build crosstool-ng
122+
$ bash ./crosstool-ng.sh
123+
```
124+
125+
- In case you want to adjust or start from an existing config, copy that
126+
to the container. `crosstool-ng` will automatically load `./.config` if
127+
present. Otherwise one can use the TUI to load any config-file.
128+
129+
```
130+
$ docker cp arm-linux-gnueabi.config drunk_murdock:/tmp/.config
109131
```
110132
111133
- Now, inside the container run the following command to configure the
112134
toolchain. To get a clue of which options need to be changed check the next
113135
section and come back.
114136
115137
```
138+
$ cd /tmp/
116139
$ ct-ng menuconfig
117140
```
118141
119142
- Finally, we retrieve the `.config` file from the container and give it a
120143
meaningful name. This is done outside the container.
121144
122145
```
123-
$ docker drunk_murdock:/.config arm-linux-gnueabi.config
146+
$ docker cp drunk_murdock:/tmp/.config arm-linux-gnueabi.config
124147
```
125148
126149
- Now you can shutdown the container or repeat the two last steps to generate a

0 commit comments

Comments
 (0)