diff mbox series

[v2,67/74] tests/docker: Add debian-rx-cross image

Message ID 20220503194843.1379101-68-richard.henderson@linaro.org
State New
Headers show
Series semihosting cleanup | expand

Commit Message

Richard Henderson May 3, 2022, 7:48 p.m. UTC
Build the entire cross tool chain from source.
For this reason, default to caching.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 MAINTAINERS                                   |  1 +
 tests/docker/Makefile.include                 |  6 ++
 .../debian-rx-cross.d/build-toolchain.sh      | 58 +++++++++++++++++++
 tests/tcg/configure.sh                        |  6 ++
 4 files changed, 71 insertions(+)
 create mode 100755 tests/docker/dockerfiles/debian-rx-cross.d/build-toolchain.sh
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 294c88ace9..62d2640f35 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -297,6 +297,7 @@  RENESAS RX CPUs
 R: Yoshinori Sato <ysato@users.sourceforge.jp>
 S: Orphan
 F: target/rx/
+F: tests/docker/dockerfiles/debian-rx-cross.d/build-toolchain.sh
 
 S390 TCG CPUs
 M: Richard Henderson <richard.henderson@linaro.org>
diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index ca2157db46..1795a49da2 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -142,6 +142,10 @@  docker-image-debian-nios2-cross: $(DOCKER_FILES_DIR)/debian-toolchain.docker \
     $(DOCKER_FILES_DIR)/debian-nios2-cross.d/build-toolchain.sh
 	$(call debian-toolchain, $@)
 
+docker-image-debian-rx-cross: $(DOCKER_FILES_DIR)/debian-toolchain.docker \
+    $(DOCKER_FILES_DIR)/debian-rx-cross.d/build-toolchain.sh
+	$(call debian-toolchain, $@)
+
 # Specialist build images, sometimes very limited tools
 docker-image-debian-tricore-cross: docker-image-debian10
 docker-image-debian-all-test-cross: docker-image-debian10
@@ -149,6 +153,7 @@  docker-image-debian-microblaze-cross: docker-image-debian10
 docker-image-debian-nios2-cross: docker-image-debian10
 docker-image-debian-powerpc-test-cross: docker-image-debian11
 docker-image-debian-riscv64-test-cross: docker-image-debian11
+docker-image-debian-rx-cross: docker-image-debian10
 
 # These images may be good enough for building tests but not for test builds
 DOCKER_PARTIAL_IMAGES += debian-alpha-cross
@@ -158,6 +163,7 @@  DOCKER_PARTIAL_IMAGES += debian-m68k-cross debian-mips64-cross
 DOCKER_PARTIAL_IMAGES += debian-microblaze-cross
 DOCKER_PARTIAL_IMAGES += debian-nios2-cross
 DOCKER_PARTIAL_IMAGES += debian-riscv64-test-cross
+DOCKER_PARTIAL_IMAGES += debian-rx-cross
 DOCKER_PARTIAL_IMAGES += debian-sh4-cross debian-sparc64-cross
 DOCKER_PARTIAL_IMAGES += debian-tricore-cross
 DOCKER_PARTIAL_IMAGES += debian-xtensa-cross
diff --git a/tests/docker/dockerfiles/debian-rx-cross.d/build-toolchain.sh b/tests/docker/dockerfiles/debian-rx-cross.d/build-toolchain.sh
new file mode 100755
index 0000000000..0d22280dee
--- /dev/null
+++ b/tests/docker/dockerfiles/debian-rx-cross.d/build-toolchain.sh
@@ -0,0 +1,58 @@ 
+#!/bin/bash
+
+set -e
+
+TARGET=rx-elf
+
+J=$(expr $(nproc) / 2)
+TOOLCHAIN_INSTALL=/usr/local
+TOOLCHAIN_BIN=${TOOLCHAIN_INSTALL}/bin
+CROSS_SYSROOT=${TOOLCHAIN_INSTALL}/$TARGET/sys-root
+
+export PATH=${TOOLCHAIN_BIN}:$PATH
+
+#
+# Grab all of the source for the toolchain bootstrap.
+#
+
+wget https://ftp.gnu.org/gnu/binutils/binutils-2.37.tar.xz
+wget https://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.xz
+
+tar axf binutils-2.37.tar.xz
+tar axf gcc-11.2.0.tar.xz
+
+git clone --depth 1 --branch newlib-4.1.0 \
+  https://sourceware.org/git/newlib-cygwin.git newlib-4.1.0
+
+# Create a combined gcc/newlib source tree
+
+mkdir -p src/include
+cd src
+ln -s ../gcc*/* . || true
+ln -s ../newlib*/* . || true
+cd include
+ln -s ../../gcc*/include/* . || true
+ln -s ../../newlib*/include/* . || true
+cd ../../
+
+# Build binutils
+
+mkdir -p bld-b
+cd bld-b
+../binu*/configure --disable-werror \
+  --prefix=${TOOLCHAIN_INSTALL} --with-sysroot --target=${TARGET}
+make -j${J}
+make install
+cd ..
+
+# Build gcc+newlib
+
+mkdir -p bld
+cd bld
+../src/configure --disable-werror --disable-shared \
+  --prefix=${TOOLCHAIN_INSTALL} --with-sysroot --target=${TARGET} \
+  --enable-languages=c --disable-libssp --disable-libsanitizer \
+  --disable-libatomic --disable-libgomp --disable-libquadmath
+make -j${J}
+make install
+cd ..
diff --git a/tests/tcg/configure.sh b/tests/tcg/configure.sh
index 691d90abac..34c94f3045 100755
--- a/tests/tcg/configure.sh
+++ b/tests/tcg/configure.sh
@@ -68,6 +68,7 @@  fi
 : ${cross_cc_ppc64le="$cross_cc_ppc64"}
 : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
 : ${cross_cc_riscv64="riscv64-linux-gnu-gcc"}
+: ${cross_cc_rx="rx-elf-gcc"}
 : ${cross_cc_s390x="s390x-linux-gnu-gcc"}
 : ${cross_cc_sh4="sh4-linux-gnu-gcc"}
 : ${cross_cc_cflags_sparc="-m32 -mv8plus -mcpu=ultrasparc"}
@@ -192,6 +193,11 @@  for target in $target_list; do
       container_image=debian-riscv64-test-cross
       container_cross_cc=riscv64-linux-gnu-gcc
       ;;
+    rx-*)
+      container_hosts=x86_64
+      container_image=debian-rx-cross
+      container_cross_cc=rx-elf-gcc
+      ;;
     s390x-*)
       container_hosts=x86_64
       container_image=debian-s390x-cross