diff mbox series

[v2,2/2] gitlab: enable a very minimal build with the tricore container

Message ID 20210719214825.2264-3-alex.bennee@linaro.org
State New
Headers show
Series tricore fixes | expand

Commit Message

Alex Bennée July 19, 2021, 9:48 p.m. UTC
We do the same thing as hexagon and do a two stage build that provides
the minimal dependencies to build qemu-tricore-system and its
check-tcg tests.

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

---
 .gitlab-ci.d/buildtest.yml                    | 11 +++++
 .../dockerfiles/debian-tricore-cross.docker   | 40 ++++++++++++++++---
 2 files changed, 46 insertions(+), 5 deletions(-)

-- 
2.32.0.264.g75ae10bc75

Comments

Richard Henderson July 19, 2021, 10:52 p.m. UTC | #1
On 7/19/21 11:48 AM, Alex Bennée wrote:
> diff --git a/tests/docker/dockerfiles/debian-tricore-cross.docker b/tests/docker/dockerfiles/debian-tricore-cross.docker

> index 985925134c..4ea9112289 100644

> --- a/tests/docker/dockerfiles/debian-tricore-cross.docker

> +++ b/tests/docker/dockerfiles/debian-tricore-cross.docker

> @@ -15,9 +15,39 @@ RUN git clone --single-branch \

>           https://github.com/bkoppelmann/tricore-binutils.git \

>           /usr/src/binutils && \

>       cd /usr/src/binutils && chmod +x missing && \

> -    CFLAGS=-w ./configure --prefix=/usr --disable-nls --target=tricore && \

> -    make && make install && \

> -    rm -rf /usr/src/binutils

> +    CFLAGS=-w ./configure --prefix=/usr/local --disable-nls --target=tricore && \

> +    make && make install

>   

> -# This image isn't designed for building QEMU but building tests

> -ENV QEMU_CONFIGURE_OPTS --disable-system --disable-user

> +FROM debian:buster-slim

> +# Duplicate deb line as deb-src

> +RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list

> +# Install very minimal QEMU build deps for use in CI

> +# $ lcitool variables debian-10 qemu+minimal

> +RUN apt update && \


Is there really an advantage here above basing this on debian-amd64?


r~
Alex Bennée July 20, 2021, 9:14 a.m. UTC | #2
Richard Henderson <richard.henderson@linaro.org> writes:

> On 7/19/21 11:48 AM, Alex Bennée wrote:

>> diff --git a/tests/docker/dockerfiles/debian-tricore-cross.docker b/tests/docker/dockerfiles/debian-tricore-cross.docker

>> index 985925134c..4ea9112289 100644

>> --- a/tests/docker/dockerfiles/debian-tricore-cross.docker

>> +++ b/tests/docker/dockerfiles/debian-tricore-cross.docker

>> @@ -15,9 +15,39 @@ RUN git clone --single-branch \

>>           https://github.com/bkoppelmann/tricore-binutils.git \

>>           /usr/src/binutils && \

>>       cd /usr/src/binutils && chmod +x missing && \

>> -    CFLAGS=-w ./configure --prefix=/usr --disable-nls --target=tricore && \

>> -    make && make install && \

>> -    rm -rf /usr/src/binutils

>> +    CFLAGS=-w ./configure --prefix=/usr/local --disable-nls --target=tricore && \

>> +    make && make install

>>   -# This image isn't designed for building QEMU but building tests

>> -ENV QEMU_CONFIGURE_OPTS --disable-system --disable-user

>> +FROM debian:buster-slim

>> +# Duplicate deb line as deb-src

>> +RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list

>> +# Install very minimal QEMU build deps for use in CI

>> +# $ lcitool variables debian-10 qemu+minimal

>> +RUN apt update && \

>

> Is there really an advantage here above basing this on debian-amd64?


It's mostly about reducing size. The current qemu/debian10 based image
takes:

  794Mb

and can't even build a simple qemu because of missing dev libraries.
Where as the split build approach results in an image that is:

  604Mb

However if I build the whole thing as one I can get it down to:

  580MB

#
# Docker TriCore cross-compiler target
#
# This docker target builds on the Debian Buster base image but
# doesn't inherit from the common one to avoid bringing in unneeded
# dependencies.
#
# Copyright (c) 2018 Philippe Mathieu-Daudé
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
FROM docker.io/library/debian:buster-slim

MAINTAINER Philippe Mathieu-Daudé <f4bug@amsat.org>

RUN apt update && \
    DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
    DEBIAN_FRONTEND=noninteractive eatmydata apt install -yy \
       bzip2 \
       ca-certificates \
       ccache \
       g++ \
       gcc \
       git \
       libglib2.0-dev \
       libpixman-1-dev \
       libtest-harness-perl \
       locales \
       make \
       ninja-build \
       perl-base \
       pkgconf \
       python3-pip \
       python3-setuptools \
       python3-wheel

RUN git clone --single-branch \
        https://github.com/bkoppelmann/tricore-binutils.git \
        /usr/src/binutils && \
    cd /usr/src/binutils && chmod +x missing && \
    CFLAGS=-w ./configure --prefix=/usr/local --disable-nls --target=tricore && \
    make && make install && \
    rm -rf /usr/src/binutils

# This image can only build a very minimal QEMU as well as the tests
ENV DEF_TARGET_LIST tricore-softmmu
ENV QEMU_CONFIGURE_OPTS --disable-user --disable-tools --disable-fdt


>

>

> r~



-- 
Alex Bennée
diff mbox series

Patch

diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index 89df51517c..5198b79deb 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -354,6 +354,17 @@  build-some-softmmu:
     TARGETS: xtensa-softmmu arm-softmmu aarch64-softmmu alpha-softmmu
     MAKE_CHECK_ARGS: check-tcg
 
+# We build tricore in a very minimal tricore only container
+build-tricore-softmmu:
+  extends: .native_build_job_template
+  needs:
+    job: tricore-debian-cross-container
+  variables:
+    IMAGE: debian-tricore-cross
+    CONFIGURE_ARGS: --disable-tools --enable-debug
+    TARGETS: tricore-softmmu
+    MAKE_CHECK_ARGS: check-tcg
+
 clang-system:
   extends: .native_build_job_template
   needs:
diff --git a/tests/docker/dockerfiles/debian-tricore-cross.docker b/tests/docker/dockerfiles/debian-tricore-cross.docker
index 985925134c..4ea9112289 100644
--- a/tests/docker/dockerfiles/debian-tricore-cross.docker
+++ b/tests/docker/dockerfiles/debian-tricore-cross.docker
@@ -15,9 +15,39 @@  RUN git clone --single-branch \
         https://github.com/bkoppelmann/tricore-binutils.git \
         /usr/src/binutils && \
     cd /usr/src/binutils && chmod +x missing && \
-    CFLAGS=-w ./configure --prefix=/usr --disable-nls --target=tricore && \
-    make && make install && \
-    rm -rf /usr/src/binutils
+    CFLAGS=-w ./configure --prefix=/usr/local --disable-nls --target=tricore && \
+    make && make install
 
-# This image isn't designed for building QEMU but building tests
-ENV QEMU_CONFIGURE_OPTS --disable-system --disable-user
+FROM debian:buster-slim
+# Duplicate deb line as deb-src
+RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
+# Install very minimal QEMU build deps for use in CI
+# $ lcitool variables debian-10 qemu+minimal
+RUN apt update && \
+    DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
+    DEBIAN_FRONTEND=noninteractive eatmydata apt install -yy \
+       bzip2 \
+       ca-certificates \
+       ccache \
+       g++ \
+       gcc \
+       git \
+       libcapstone-dev \
+       libfdt-dev \
+       libglib2.0-dev \
+       libpixman-1-dev \
+       libtest-harness-perl \
+       locales \
+       make \
+       ninja-build \
+       perl-base \
+       pkgconf \
+       python3-pip \
+       python3-setuptools \
+       python3-wheel
+COPY --from=0 /usr/local /usr/local
+ENV PATH $PATH:/usr/local/bin/
+
+# This image can only build a very minimal QEMU as well as the tests
+ENV DEF_TARGET_LIST tricore-softmmu
+ENV QEMU_CONFIGURE_OPTS --disable-user --disable-tools