From 304f00816d9d7fd3fa051538e865986afffa4b39 Mon Sep 17 00:00:00 2001 From: Martin Sirringhaus <> Date: Mon, 13 Jul 2020 15:30:48 +0200 Subject: [PATCH 1/3] Update cross-compilation README --- src/ci/docker/README.md | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md index 7e79cc8851369..303a6c4860a03 100644 --- a/src/ci/docker/README.md +++ b/src/ci/docker/README.md @@ -16,6 +16,11 @@ for example: Images will output artifacts in an `obj` dir at the root of a repository. +To match conditions in rusts CI, also set the environment variable `DEPLOY=1`, e.g.: +``` +DEPLOY=1 ./src/ci/docker/run.sh x86_64-gnu +``` + **NOTE**: Re-using the same `obj` dir with different docker images with the same target triple (e.g. `dist-x86_64-linux` and `dist-various-1`) may result in strange linker errors, due shared library versions differing between platforms. @@ -85,27 +90,44 @@ how to generate them, and how the existing ones were generated. ### Generating a `.config` file +**NOTE:** Existing Dockerfiles can be a good guide for the process and order +of script execution. + If you have a `linux-cross` image lying around you can use that and skip the next two steps. -- First we spin up a container and copy `build_toolchain_root.sh` into it. All +- First we spin up a container and copy all scripts into it. All these steps are outside the container: ``` -# Note: We use ubuntu:15.10 because that's the "base" of linux-cross Docker -# image -$ docker run -it ubuntu:15.10 bash +# Note: We use ubuntu:16.04 because that's the "base" of linux-cross Docker +# image, or simply run ./src/ci/docker/run.sh once, which will download the correct +# one and you can check it out with `docker images` +$ docker run -it ubuntu:16.04 bash +# in another terminal: $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -cfbec05ed730 ubuntu:15.10 "bash" 16 seconds ago Up 15 seconds drunk_murdock -$ docker cp build_toolchain_root.sh drunk_murdock:/ +cfbec05ed730 ubuntu:16.04 "bash" 16 seconds ago Up 15 seconds drunk_murdock +$ docker cp src/ci/docker/scripts drunk_murdock:/tmp/ ``` - Then inside the container we build crosstool-ng by simply calling the bash script we copied in the previous step: ``` -$ bash build_toolchain_root.sh +$ cd /tmp/scripts +# Download packages necessary for building +$ bash ./cross-apt-packages.sh +# Download and build crosstool-ng +$ bash ./crosstool-ng.sh +``` + +- In case you cant to adjust or start from an existing config, copy that + to the container. `crosstool-ng` will automatically load `./.config` if + present. Otherwise one can use the TUI to load any config-file. + +``` +$ docker cp arm-linux-gnueabi.config drunk_murdock:/tmp/.config ``` - Now, inside the container run the following command to configure the @@ -120,7 +142,7 @@ $ ct-ng menuconfig meaningful name. This is done outside the container. ``` -$ docker drunk_murdock:/.config arm-linux-gnueabi.config +$ docker cp drunk_murdock:/.config arm-linux-gnueabi.config ``` - Now you can shutdown the container or repeat the two last steps to generate a From e1106ca61bc6a0cfd790837b0a571c60251992fb Mon Sep 17 00:00:00 2001 From: Martin Sirringhaus <> Date: Mon, 13 Jul 2020 15:36:39 +0200 Subject: [PATCH 2/3] Fix typo --- src/ci/docker/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md index 303a6c4860a03..9381042de9f3f 100644 --- a/src/ci/docker/README.md +++ b/src/ci/docker/README.md @@ -90,7 +90,7 @@ how to generate them, and how the existing ones were generated. ### Generating a `.config` file -**NOTE:** Existing Dockerfiles can be a good guide for the process and order +**NOTE:** Existing Dockerfiles can also be a good guide for the process and order of script execution. If you have a `linux-cross` image lying around you can use that and skip the @@ -122,7 +122,7 @@ $ bash ./cross-apt-packages.sh $ bash ./crosstool-ng.sh ``` -- In case you cant to adjust or start from an existing config, copy that +- In case you want to adjust or start from an existing config, copy that to the container. `crosstool-ng` will automatically load `./.config` if present. Otherwise one can use the TUI to load any config-file. @@ -135,6 +135,7 @@ $ docker cp arm-linux-gnueabi.config drunk_murdock:/tmp/.config section and come back. ``` +$ cd /tmp/ $ ct-ng menuconfig ``` From 92e010e4a16769def3014bf6f1d3fa821a02f7a9 Mon Sep 17 00:00:00 2001 From: Martin Sirringhaus <> Date: Mon, 13 Jul 2020 15:42:59 +0200 Subject: [PATCH 3/3] Move all code-snippets to /tmp/ as basedir --- src/ci/docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md index 9381042de9f3f..ff28f4f603c9d 100644 --- a/src/ci/docker/README.md +++ b/src/ci/docker/README.md @@ -143,7 +143,7 @@ $ ct-ng menuconfig meaningful name. This is done outside the container. ``` -$ docker cp drunk_murdock:/.config arm-linux-gnueabi.config +$ docker cp drunk_murdock:/tmp/.config arm-linux-gnueabi.config ``` - Now you can shutdown the container or repeat the two last steps to generate a