Skip to content

Commit

Permalink
ci: refactor crosstool-ng to use mini-defconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Apr 26, 2023
1 parent d7d67d8 commit 16dfd89
Show file tree
Hide file tree
Showing 54 changed files with 261 additions and 10,897 deletions.
48 changes: 25 additions & 23 deletions src/ci/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ To run the image,
A number of these images take quite a long time to compile as they're building
whole gcc toolchains to do cross builds with. Much of this is relatively
self-explanatory but some images use [crosstool-ng] which isn't quite as self
explanatory. Below is a description of where these `*.config` files come form,
explanatory. Below is a description of where these `*.defconfig` files come form,
how to generate them, and how the existing ones were generated.
[crosstool-ng]: https://github.com/crosstool-ng/crosstool-ng
### Generating a `.config` file
### Generating a `.defconfig` file
**NOTE:** Existing Dockerfiles can also be a good guide for the process and order
of script execution.
Expand All @@ -100,14 +100,14 @@ next two steps.
these steps are outside the container:
```
# Note: We use ubuntu:16.04 because that's the "base" of linux-cross Docker
# Note: We use ubuntu:22.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
$ docker run -it ubuntu:22.04 bash
# in another terminal:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cfbec05ed730 ubuntu:16.04 "bash" 16 seconds ago Up 15 seconds drunk_murdock
cfbec05ed730 ubuntu:22.04 "bash" 16 seconds ago Up 15 seconds drunk_murdock
$ docker cp src/ci/docker/scripts drunk_murdock:/tmp/
```
Expand All @@ -127,7 +127,7 @@ $ bash ./crosstool-ng.sh
present. Otherwise one can use the TUI to load any config-file.
```
$ docker cp arm-linux-gnueabi.config drunk_murdock:/tmp/.config
$ docker cp arm-linux-gnueabi.defconfig drunk_murdock:/tmp/.config
```
- Now, inside the container run the following command to configure the
Expand All @@ -136,29 +136,31 @@ $ docker cp arm-linux-gnueabi.config drunk_murdock:/tmp/.config
```
$ cd /tmp/
$ ct-ng olddefconfig
$ ct-ng menuconfig
$ ct-ng savedefconfig
```
- Finally, we retrieve the `.config` file from the container and give it a
- Finally, we retrieve the `defconfig` file from the container and give it a
meaningful name. This is done outside the container.
```
$ docker cp drunk_murdock:/tmp/.config arm-linux-gnueabi.config
$ docker cp drunk_murdock:/tmp/defconfig arm-linux-gnueabi.defconfig
```
- Now you can shutdown the container or repeat the two last steps to generate a
new `.config` file.
new `.defconfig` file.
### Toolchain configuration
Changes on top of the default toolchain configuration used to generate the
`.config` files in this directory. The changes are formatted as follows:
`.defconfig` files in this directory. The changes are formatted as follows:
```
$category > $option = $value -- $comment
```
### `arm-linux-gnueabi.config`
### `arm-linux-gnueabi.defconfig`
For targets: `arm-unknown-linux-gnueabi`
Expand All @@ -175,7 +177,7 @@ For targets: `arm-unknown-linux-gnueabi`
- C compiler > gcc version = 8.5.0
- C compiler > C++ = ENABLE -- to cross compile LLVM
### `arm-linux-gnueabihf.config`
### `arm-linux-gnueabihf.defconfig`
For targets: `arm-unknown-linux-gnueabihf`
Expand All @@ -194,7 +196,7 @@ For targets: `arm-unknown-linux-gnueabihf`
- C compiler > gcc version = 8.5.0
- C compiler > C++ = ENABLE -- to cross compile LLVM
### `armv7-linux-gnueabihf.config`
### `armv7-linux-gnueabihf.defconfig`
For targets: `armv7-unknown-linux-gnueabihf`
Expand All @@ -220,7 +222,7 @@ For targets: `armv7-unknown-linux-gnueabihf`
libraries like jemalloc. See the mk/cfg/arm(v7)-unknown-linux-gnueabi{,hf}.mk
file in Rust's source code.
### `aarch64-linux-gnu.config`
### `aarch64-linux-gnu.defconfig`
For targets: `aarch64-unknown-linux-gnu`
Expand All @@ -236,7 +238,7 @@ For targets: `aarch64-unknown-linux-gnu`
- C compiler > gcc version = 8.5.0
- C compiler > C++ = ENABLE -- to cross compile LLVM
### `i586-linux-gnu.config`
### `i586-linux-gnu.defconfig`
For targets: `i586-unknown-linux-gnu`
Expand All @@ -255,7 +257,7 @@ For targets: `i586-unknown-linux-gnu`
(\*) Compressed debug is enabled by default for gas (assembly) on Linux/x86 targets,
but that makes our `compiler_builtins` incompatible with binutils < 2.32.
### `mips-linux-gnu.config`
### `mips-linux-gnu.defconfig`
For targets: `mips-unknown-linux-gnu`
Expand All @@ -277,7 +279,7 @@ For targets: `mips-unknown-linux-gnu`
- C compiler > gcc extra config = --with-fp-32=xx --with-odd-spreg-32=no
- C compiler > C++ = ENABLE -- to cross compile LLVM
### `mipsel-linux-gnu.config`
### `mipsel-linux-gnu.defconfig`
For targets: `mipsel-unknown-linux-gnu`
Expand All @@ -299,7 +301,7 @@ For targets: `mipsel-unknown-linux-gnu`
- C compiler > gcc extra config = --with-fp-32=xx --with-odd-spreg-32=no
- C compiler > C++ = ENABLE -- to cross compile LLVM
### `mips64-linux-gnu.config`
### `mips64-linux-gnu.defconfig`
For targets: `mips64-unknown-linux-gnuabi64`
Expand All @@ -320,7 +322,7 @@ For targets: `mips64-unknown-linux-gnuabi64`
- C compiler > gcc version = 8.5.0
- C compiler > C++ = ENABLE -- to cross compile LLVM
### `mips64el-linux-gnu.config`
### `mips64el-linux-gnu.defconfig`
For targets: `mips64el-unknown-linux-gnuabi64`
Expand All @@ -341,7 +343,7 @@ For targets: `mips64el-unknown-linux-gnuabi64`
- C compiler > gcc version = 8.5.0
- C compiler > C++ = ENABLE -- to cross compile LLVM
### `powerpc-linux-gnu.config`
### `powerpc-linux-gnu.defconfig`
For targets: `powerpc-unknown-linux-gnu`
Expand All @@ -357,7 +359,7 @@ For targets: `powerpc-unknown-linux-gnu`
- C compiler > gcc version = 8.5.0
- C compiler > C++ = ENABLE -- to cross compile LLVM
### `powerpc64-linux-gnu.config`
### `powerpc64-linux-gnu.defconfig`
For targets: `powerpc64-unknown-linux-gnu`
Expand All @@ -377,7 +379,7 @@ For targets: `powerpc64-unknown-linux-gnu`
(+) These CPU options match the configuration of the toolchains in RHEL6.
### `riscv64-unknown-linux-gnu.config`
### `riscv64-unknown-linux-gnu.defconfig`
For targets: `riscv64-unknown-linux-gnu`
Expand All @@ -393,7 +395,7 @@ For targets: `riscv64-unknown-linux-gnu`
- C compiler > gcc version = 8.5.0
- C compiler > C++ = ENABLE -- to cross compile LLVM
### `s390x-linux-gnu.config`
### `s390x-linux-gnu.defconfig`
For targets: `s390x-unknown-linux-gnu`
Expand Down
8 changes: 3 additions & 5 deletions src/ci/docker/host-x86_64/dist-aarch64-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ RUN sh /scripts/crosstool-ng.sh

COPY scripts/rustbuild-setup.sh /scripts/
RUN sh /scripts/rustbuild-setup.sh
USER rustbuild
WORKDIR /tmp

COPY host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.config host-x86_64/dist-aarch64-linux/build-toolchains.sh /tmp/
RUN ./build-toolchains.sh

USER root
COPY scripts/crosstool-ng-build.sh /scripts/
COPY host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.defconfig /tmp/crosstool.defconfig
RUN /scripts/crosstool-ng-build.sh

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
Expand Down
Loading

0 comments on commit 16dfd89

Please sign in to comment.