Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 1 | GitLab CI / U-Boot runner container |
| 2 | =================================== |
| 3 | |
Simon Glass | 7aafac0 | 2024-11-27 11:17:26 -0600 | [diff] [blame] | 4 | In order to have a reproducible and portable build environment for CI we use a container for building in. This means that developers can also reproduce the CI environment, to a large degree at least, locally. This file is located in the tools/docker directory. |
| 5 | |
| 6 | The docker image supports both amd64 and arm64. Ensure that the |
Tom Rini | 66dd565 | 2024-12-08 11:07:31 -0600 | [diff] [blame] | 7 | `buildx` Docker CLI plugin is installed. This is often available in your |
| 8 | distribution via the 'docker-buildx' or 'docker-buildx-plugin' package. |
Simon Glass | 7aafac0 | 2024-11-27 11:17:26 -0600 | [diff] [blame] | 9 | |
| 10 | You will need a multi-platform container, otherwise this error is shown:: |
| 11 | |
| 12 | ERROR: Multi-platform build is not supported for the docker driver. |
| 13 | Switch to a different driver, or turn on the containerd image store, and try again. |
| 14 | |
Leonard Anderweit | 48d17ea | 2025-04-01 14:28:11 +0200 | [diff] [blame] | 15 | You can add a simple one with: |
| 16 | |
| 17 | .. code-block:: bash |
Simon Glass | 7aafac0 | 2024-11-27 11:17:26 -0600 | [diff] [blame] | 18 | |
| 19 | sudo docker buildx create --name multiarch --driver docker-container --use |
| 20 | |
Tom Rini | 66dd565 | 2024-12-08 11:07:31 -0600 | [diff] [blame] | 21 | This will result in a builder that will use QEMU for the non-native |
| 22 | architectures request in a build. While both amd64 and arm64 happen in |
| 23 | parallel, the non-native part will take considerably longer as it must use QEMU |
| 24 | to emulate the foreign code. An alternative, if you have accesss to reasonably |
Leonard Anderweit | 48d17ea | 2025-04-01 14:28:11 +0200 | [diff] [blame] | 25 | fast amd64 (i.e. 64-bit x86) and arm64 machines is: |
| 26 | |
| 27 | .. code-block:: bash |
Tom Rini | 66dd565 | 2024-12-08 11:07:31 -0600 | [diff] [blame] | 28 | |
| 29 | sudo docker buildx create --name multiarch-multinode --node localNode --bootstrap --use |
| 30 | sudo docker buildx create --name multiarch-multinode --append --node remoteNode --bootstrap ssh://user@host |
| 31 | |
| 32 | And this will result in a builder named multiarch-multinode that will build |
| 33 | each platform natively on each node. |
Simon Glass | 7aafac0 | 2024-11-27 11:17:26 -0600 | [diff] [blame] | 34 | |
Leonard Anderweit | 9acc4e9 | 2025-04-01 14:28:10 +0200 | [diff] [blame] | 35 | To build the image yourself: |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 36 | |
| 37 | .. code-block:: bash |
| 38 | |
Simon Glass | 7aafac0 | 2024-11-27 11:17:26 -0600 | [diff] [blame] | 39 | sudo docker buildx build --platform linux/arm64/v8,linux/amd64 -t your-namespace:your-tag . |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 40 | |
| 41 | Or to use an existing container |
| 42 | |
| 43 | .. code-block:: bash |
| 44 | |
Mattijs Korpershoek | 7fe617c | 2024-04-05 08:16:19 +0200 | [diff] [blame] | 45 | sudo docker pull trini/u-boot-gitlab-ci-runner:jammy-20240227-14Mar2024 |