diff mbox series

[RFC,2/4] docker: add buildroot-nios2-cross image

Message ID 20180911140631.18481-3-alex.bennee@linaro.org
State New
Headers show
Series Add Nios II cross-compiler and enable tests/tcg | expand

Commit Message

Alex Bennée Sept. 11, 2018, 2:06 p.m. UTC
Build a buildroot toolchain for the nios2 target.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 tests/docker/Makefile.include                         |  4 ++++
 tests/docker/dockerfiles/buildroot-nios2-cross.docker | 10 ++++++++++
 2 files changed, 14 insertions(+)
 create mode 100644 tests/docker/dockerfiles/buildroot-nios2-cross.docker

-- 
2.17.1

Comments

Philippe Mathieu-Daudé Sept. 30, 2018, 11:22 p.m. UTC | #1
Hi Alex,

On 9/11/18 4:06 PM, Alex Bennée wrote:
> Build a buildroot toolchain for the nios2 target.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  tests/docker/Makefile.include                         |  4 ++++

>  tests/docker/dockerfiles/buildroot-nios2-cross.docker | 10 ++++++++++

>  2 files changed, 14 insertions(+)

>  create mode 100644 tests/docker/dockerfiles/buildroot-nios2-cross.docker

> 

> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include

> index 74a82de48a..a8dfde8ed5 100644

> --- a/tests/docker/Makefile.include

> +++ b/tests/docker/Makefile.include

> @@ -120,6 +120,10 @@ docker-image-debian-riscv64-cross: docker-image-debian-sid

>  docker-image-debian-powerpc-cross: docker-image-debian-sid

>  docker-image-travis: NOUSER=1

>  

> +# Buildroot base images

> +# These involve building the toolchains and can take some time

> +docker-image-buildroot-nios2-cross: docker-image-debian-buildroot-base

> +

>  # Specialist build images, sometimes very limited tools

>  docker-image-tricore-cross: docker-image-debian9

>  

> diff --git a/tests/docker/dockerfiles/buildroot-nios2-cross.docker b/tests/docker/dockerfiles/buildroot-nios2-cross.docker

> new file mode 100644

> index 0000000000..e573f0fa55

> --- /dev/null

> +++ b/tests/docker/dockerfiles/buildroot-nios2-cross.docker

> @@ -0,0 +1,10 @@

> +#

> +# NIOS II toolchain

> +#

> +FROM qemu:debian-buildroot-base

> +

> +RUN cd /opt/buildroot-${BUILDROOT_VERSION} && make qemu_nios2_10m50_defconfig


Simply:

  RUN make -C /opt/buildroot-${BUILDROOT_VERSION} qemu_nios2_10m50_defconfig

> +RUN cd /opt/buildroot-${BUILDROOT_VERSION} && make toolchain


   RUN make -C /opt/buildroot-${BUILDROOT_VERSION} toolchain

> +# The toolchain is in /opt/buildroot-${BUILDROOT_VERSION}/output/host/bin/nios2-*

> +RUN ln -s /opt/buildroot-${BUILDROOT_VERSION}/output/host/bin/nios2-* /usr/bin


Similarly:

   ENV PATH $PATH:/opt/buildroot-${BUILDROOT_VERSION}/output/host/bin

Once build this image takes a bit more than 3GB (this took me 30min to
build).

With changes:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Alex Bennée Oct. 1, 2018, 9:05 a.m. UTC | #2
Philippe Mathieu-Daudé <f4bug@amsat.org> writes:

> Hi Alex,

>

> On 9/11/18 4:06 PM, Alex Bennée wrote:

>> Build a buildroot toolchain for the nios2 target.

>>

>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

>> ---

>>  tests/docker/Makefile.include                         |  4 ++++

>>  tests/docker/dockerfiles/buildroot-nios2-cross.docker | 10 ++++++++++

>>  2 files changed, 14 insertions(+)

>>  create mode 100644 tests/docker/dockerfiles/buildroot-nios2-cross.docker

>>

>> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include

>> index 74a82de48a..a8dfde8ed5 100644

>> --- a/tests/docker/Makefile.include

>> +++ b/tests/docker/Makefile.include

>> @@ -120,6 +120,10 @@ docker-image-debian-riscv64-cross: docker-image-debian-sid

>>  docker-image-debian-powerpc-cross: docker-image-debian-sid

>>  docker-image-travis: NOUSER=1

>>

>> +# Buildroot base images

>> +# These involve building the toolchains and can take some time

>> +docker-image-buildroot-nios2-cross: docker-image-debian-buildroot-base

>> +

>>  # Specialist build images, sometimes very limited tools

>>  docker-image-tricore-cross: docker-image-debian9

>>

>> diff --git a/tests/docker/dockerfiles/buildroot-nios2-cross.docker b/tests/docker/dockerfiles/buildroot-nios2-cross.docker

>> new file mode 100644

>> index 0000000000..e573f0fa55

>> --- /dev/null

>> +++ b/tests/docker/dockerfiles/buildroot-nios2-cross.docker

>> @@ -0,0 +1,10 @@

>> +#

>> +# NIOS II toolchain

>> +#

>> +FROM qemu:debian-buildroot-base

>> +

>> +RUN cd /opt/buildroot-${BUILDROOT_VERSION} && make qemu_nios2_10m50_defconfig

>

> Simply:

>

>   RUN make -C /opt/buildroot-${BUILDROOT_VERSION} qemu_nios2_10m50_defconfig

>

>> +RUN cd /opt/buildroot-${BUILDROOT_VERSION} && make toolchain

>

>    RUN make -C /opt/buildroot-${BUILDROOT_VERSION} toolchain

>

>> +# The toolchain is in /opt/buildroot-${BUILDROOT_VERSION}/output/host/bin/nios2-*

>> +RUN ln -s /opt/buildroot-${BUILDROOT_VERSION}/output/host/bin/nios2-* /usr/bin

>

> Similarly:

>

>    ENV PATH $PATH:/opt/buildroot-${BUILDROOT_VERSION}/output/host/bin

>

> Once build this image takes a bit more than 3GB (this took me 30min to

> build).

>

> With changes:

> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


Apparently multi-stage builds are meant to help:

  https://docs.docker.com/develop/develop-images/multistage-build/#name-your-build-stages

It's still a little sub-optimal compared to binary builds but it will do
if we care about supporting every guest architecture with tests. I only
picked nios2 as a random example.

--
Alex Bennée
diff mbox series

Patch

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index 74a82de48a..a8dfde8ed5 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -120,6 +120,10 @@  docker-image-debian-riscv64-cross: docker-image-debian-sid
 docker-image-debian-powerpc-cross: docker-image-debian-sid
 docker-image-travis: NOUSER=1
 
+# Buildroot base images
+# These involve building the toolchains and can take some time
+docker-image-buildroot-nios2-cross: docker-image-debian-buildroot-base
+
 # Specialist build images, sometimes very limited tools
 docker-image-tricore-cross: docker-image-debian9
 
diff --git a/tests/docker/dockerfiles/buildroot-nios2-cross.docker b/tests/docker/dockerfiles/buildroot-nios2-cross.docker
new file mode 100644
index 0000000000..e573f0fa55
--- /dev/null
+++ b/tests/docker/dockerfiles/buildroot-nios2-cross.docker
@@ -0,0 +1,10 @@ 
+#
+# NIOS II toolchain
+#
+FROM qemu:debian-buildroot-base
+
+RUN cd /opt/buildroot-${BUILDROOT_VERSION} && make qemu_nios2_10m50_defconfig
+RUN cd /opt/buildroot-${BUILDROOT_VERSION} && make toolchain
+
+# The toolchain is in /opt/buildroot-${BUILDROOT_VERSION}/output/host/bin/nios2-*
+RUN ln -s /opt/buildroot-${BUILDROOT_VERSION}/output/host/bin/nios2-* /usr/bin