[PATCH 02/14] test/Containerfile: reduce duplication in cross toolchain handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ENV directive in OCI will result in the container having the environment
variable defined. Let's use that instead of duplicating it across
workflows.

Also the many wget's to get the kernel toolchains are not that readable,
so define a function and call it to make it easier to see what is what.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 .github/workflows/test-defconfigs.yml     |  6 ------
 .github/workflows/test-labgrid-pytest.yml |  6 ------
 test/Containerfile                        | 25 +++++++++++++++--------
 3 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/.github/workflows/test-defconfigs.yml b/.github/workflows/test-defconfigs.yml
index 108e54d289a0..71e440793ce5 100644
--- a/.github/workflows/test-defconfigs.yml
+++ b/.github/workflows/test-defconfigs.yml
@@ -32,12 +32,6 @@ jobs:
       run: |
         export ARCH=${{matrix.arch}}
 
-        export CROSS_COMPILE_arm=/opt/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-
-        export CROSS_COMPILE_arm64=/opt/gcc-12.2.0-nolibc/aarch64-linux/bin/aarch64-linux-
-        export CROSS_COMPILE_mips=/opt/gcc-12.2.0-nolibc/mips-linux/bin/mips-linux-
-        export CROSS_COMPILE_powerpc=/opt/gcc-12.2.0-nolibc/powerpc-linux/bin/powerpc-linux-
-        export CROSS_COMPILE_riscv=/opt/gcc-12.2.0-nolibc/riscv32-linux/bin/riscv32-linux-
-
         ./test/generate-dummy-fw.sh
 
         ./MAKEALL -O build-${{matrix.arch}} -k test/kconfig/disable_size_check.kconf \
diff --git a/.github/workflows/test-labgrid-pytest.yml b/.github/workflows/test-labgrid-pytest.yml
index 2c741500663e..399de6dc077a 100644
--- a/.github/workflows/test-labgrid-pytest.yml
+++ b/.github/workflows/test-labgrid-pytest.yml
@@ -42,12 +42,6 @@ jobs:
       run: |
         export ARCH=${{matrix.arch}}
 
-        export CROSS_COMPILE_arm=/opt/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-
-        export CROSS_COMPILE_arm64=/opt/gcc-12.2.0-nolibc/aarch64-linux/bin/aarch64-linux-
-        export CROSS_COMPILE_mips=/opt/gcc-12.2.0-nolibc/mips-linux/bin/mips-linux-
-        export CROSS_COMPILE_powerpc=/opt/gcc-12.2.0-nolibc/powerpc-linux/bin/powerpc-linux-
-        export CROSS_COMPILE_riscv=/opt/gcc-12.2.0-nolibc/riscv32-linux/bin/riscv32-linux-
-
         ./test/generate-dummy-fw.sh
 
         ./MAKEALL -O build-${{matrix.arch}} -k test/kconfig/enable_self_test.kconf \
diff --git a/test/Containerfile b/test/Containerfile
index 8c9502c0a190..ff08cc1a7841 100644
--- a/test/Containerfile
+++ b/test/Containerfile
@@ -64,14 +64,17 @@ RUN apt-get update && apt-get install -y \
 	libyaml-libyaml-perl \
 	&& rm -rf /var/lib/apt/lists/*
 
-# Manually install the kernel.org Crosstool based toolchains for gcc-12.2.0
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-aarch64-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-arm-linux-gnueabi.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-i386-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-mips-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-powerpc-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-riscv64-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-riscv32-linux.tar.xz | tar -C /opt -xJ
+ENV GCC_VERSION=12.2.0
+
+# Manually install the kernel.org Crosstool based toolchains
+RUN korg_crosstool_dl() { wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/${1}/${2}/${1}-gcc-${2}-nolibc-${3}.tar.xz | tar -C /opt -xJ ; } && \
+    korg_crosstool_dl x86_64 ${GCC_VERSION} arm-linux-gnueabi && \
+    korg_crosstool_dl x86_64 ${GCC_VERSION} aarch64-linux     && \
+    korg_crosstool_dl x86_64 ${GCC_VERSION} i386-linux        && \
+    korg_crosstool_dl x86_64 ${GCC_VERSION} mips-linux        && \
+    korg_crosstool_dl x86_64 ${GCC_VERSION} powerpc-linux     && \
+    korg_crosstool_dl x86_64 ${GCC_VERSION} riscv32-linux     && \
+    korg_crosstool_dl x86_64 ${GCC_VERSION} riscv64-linux
 
 RUN wget "https://github.com/qemu/qemu/blob/v5.2.0/pc-bios/opensbi-riscv32-generic-fw_dynamic.bin?raw=true"; -O /usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.bin
 
@@ -86,4 +89,10 @@ RUN cd /tmp && \
     pip3 install . && \
     ln -s $(which pytest) /usr/local/bin/labgrid-pytest;
 
+ENV CROSS_COMPILE_arm=/opt/gcc-${GCC_VERSION}-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-
+ENV CROSS_COMPILE_arm64=/opt/gcc-${GCC_VERSION}-nolibc/aarch64-linux/bin/aarch64-linux-
+ENV CROSS_COMPILE_mips=/opt/gcc-${GCC_VERSION}-nolibc/mips-linux/bin/mips-linux-
+ENV CROSS_COMPILE_powerpc=/opt/gcc-${GCC_VERSION}-nolibc/powerpc-linux/bin/powerpc-linux-
+ENV CROSS_COMPILE_riscv=/opt/gcc-${GCC_VERSION}-nolibc/riscv32-linux/bin/riscv32-linux-
+
 USER barebox:barebox
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux