diff --git a/doc/build_system.md b/doc/build_system.md index 0ef62992346a9f5242fae9b18c4030c3c9d3ebc4..ee08affe29469bd620c29a85f22879da4faf7e7e 100644 --- a/doc/build_system.md +++ b/doc/build_system.md @@ -465,8 +465,6 @@ This Dockerfile has four variants: - `ci`: A continuous integration variant, which provides the tooling required for automating builds and quality assurance processes. -- `jenkins`: A Jenkins-specific continuous integration variant, which includes - additional steps required to use it from Jenkins. - `dev`: A development variant, which includes additional tools for developers accessing the container directly. diff --git a/docker/Dockerfile b/docker/Dockerfile index 42f41f7969712637c0ed89659f78ce595250ecef..7c4dd02585d164ec738e433e16b8a7021110bb0f 100755 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,32 +5,41 @@ # SPDX-License-Identifier: BSD-3-Clause # -FROM ubuntu:20.04@sha256:9fa30fcef427e5e88c76bc41ad37b7cc573e1d79cecb23035e413c4be6e476ab AS common +FROM ubuntu:22.04@sha256:d80997daaa3811b175119350d84305e1ec9129e1799bba0bd1e3120da3ff52c3 AS common -ARG ARM_NONE_EABI_VERSION="10.3-2021.10" +ARG ARM_NONE_EABI_VERSION="13.3.rel1" ARG AARCH64_NONE_ELF_VERSION="13.3.rel1" +ARG ARM_NONE_LINUX_GNUEABI_VERSION="10.3-2021.07" +ARG LCOV_VERSION="v1.16" ARG CMAKE_VERSION="3.25.2" ARG LLVM_VERSION="19.1.5" ARG CPPCHECK_VERSION="2.8" -ARG DOXYGEN_VERSION="1.8.13" +ARG DOXYGEN_VERSION="1.13.2" ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && \ +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + apt-get update && \ apt-get dist-upgrade -y && \ apt-get install -y --no-install-recommends \ + bzip2 \ + cpanminus \ gcc \ + flex \ + bison \ g++ \ git \ make \ ninja-build \ + perl \ python-is-python3 \ python3 \ python3-pip \ software-properties-common \ wget \ xz-utils && \ - python3 -m pip install --upgrade pip + python3 -m pip install --no-cache-dir --upgrade pip ENV DEBIAN_FRONTEND= @@ -41,8 +50,6 @@ COPY docker/installer-scripts/install-gcc-arm-none-eabi.sh \ RUN bash /tmp/install-gcc-arm-none-eabi.sh /opt/arm-none-eabi \ "${ARM_NONE_EABI_VERSION}" - - # Install GCC aarch64-none-elf FROM common AS aarch64-none-elf COPY docker/installer-scripts/install-gcc-aarch64-none-elf.sh \ @@ -50,6 +57,19 @@ COPY docker/installer-scripts/install-gcc-aarch64-none-elf.sh \ RUN bash /tmp/install-gcc-aarch64-none-elf.sh /opt/aarch64-none-elf \ "${AARCH64_NONE_ELF_VERSION}"; +# Install GCC arm-none-linux-gnueabihf +FROM common AS arm-none-linux-gnueabihf +COPY container-files/installer-scripts/install-gcc-arm-none-linux-gnueabihf.sh \ + /tmp +RUN bash /tmp/install-gcc-arm-none-linux-gnueabihf.sh \ + /opt/arm-none-linux-gnueabihf \ + "${ARM_NONE_LINUX_GNUEABI_VERSION}"; + +# Install LCOV # +FROM common AS lcov +COPY container-files/installer-scripts/install-lcov.sh /tmp +RUN bash /tmp/install-lcov.sh /opt/lcov "${LCOV_VERSION}"; +ENV PATH="${PATH}:/opt/lcov/bin" # Install CMake, it needs to be installed before LLVM and cppcheck FROM common AS cmake @@ -120,7 +140,7 @@ RUN PIP_ROOT_USER_ACTION=ignore \ ENTRYPOINT ["sh"] -FROM ci as user +FROM ci AS user ENV DEBIAN_FRONTEND=noninteractive @@ -134,7 +154,7 @@ COPY "docker/rootfs/usr/local/bin/init" "/usr/local/bin/init" RUN chmod +x /usr/local/bin/init -FROM user as dev +FROM user AS dev VOLUME /scp-firmware WORKDIR /scp-firmware diff --git a/docker/installer-scripts/install-gcc-arm-none-eabi.sh b/docker/installer-scripts/install-gcc-arm-none-eabi.sh index 0faedd52bdb6f785fcdf2d32d3a853742d111bf7..768e38a352f3af4c538d921ec56c92ffeaaac082 100644 --- a/docker/installer-scripts/install-gcc-arm-none-eabi.sh +++ b/docker/installer-scripts/install-gcc-arm-none-eabi.sh @@ -11,8 +11,57 @@ tool_dir=$1 version=$2 hostarch=$(uname -m) -toolchain="gcc-arm-none-eabi-${version}-${hostarch}-linux" -url="https://developer.arm.com/-/media/Files/downloads/gnu-rm/${version}/${toolchain}.tar.bz2" +# Supported versions +case $version in +"9-2019-q4-major") + compact_vers=9-2019q4 + archive_ext=tar.bz2 + extract_flags="-xf" + gnu_frag="gnu-rm" + toolchain="gcc-arm-none-eabi-${version}-${hostarch}-linux" + ;; +"9-2020-q2-update") + compact_vers=9-2020q2 + archive_ext=tar.bz2 + extract_flags="-xf" + gnu_frag="gnu-rm" + toolchain="gcc-arm-none-eabi-${version}-${hostarch}-linux" + ;; +"10-2020-q4-major") + compact_vers=10-2020q4 + archive_ext=tar.bz2 + extract_flags="-xf" + gnu_frag="gnu-rm" + toolchain="gcc-arm-none-eabi-${version}-${hostarch}-linux" + ;; +"10.3-2021.07"|"10.3-2021.10") + compact_vers=$version + archive_ext=tar.bz2 + extract_flags="-xf" + gnu_frag="gnu-rm" + toolchain="gcc-arm-none-eabi-${version}-${hostarch}-linux" + ;; +"11.2-2022.02") + compact_vers=$version"/binrel" + archive_ext=tar.xz + extract_flags="-xf" + gnu_frag="gnu" + toolchain="gcc-arm-${version}-${hostarch}-arm-none-eabi" + ;; +*[rel1]) + compact_vers=$version"/binrel" + archive_ext=tar.xz + extract_flags="-xf" + gnu_frag="gnu" + toolchain="arm-gnu-toolchain-${version}-${hostarch}-arm-none-eabi" + ;; +*) + echo "Error: gcc version not listed" + exit 1 + ;; +esac + +url="https://developer.arm.com/-/media/Files/downloads/${gnu_frag}/${compact_vers}/${toolchain}.${archive_ext}" echo -e "Installing ${toolchain}\n" @@ -23,7 +72,7 @@ mkdir -p ${tool_dir} wget -nv ${url} # Extract -tar -xf ${toolchain}.tar.bz2 -C ${tool_dir} --strip-components=1 +tar ${extract_flags} ${toolchain}.${archive_ext} -C ${tool_dir} --strip-components=1 # Clean up -rm ${toolchain}.tar.bz2 +rm ${toolchain}.${archive_ext} diff --git a/docker/installer-scripts/install-gcc-arm-none-linux-gnueabihf.sh b/docker/installer-scripts/install-gcc-arm-none-linux-gnueabihf.sh new file mode 100644 index 0000000000000000000000000000000000000000..b0485af8952039629d1b695c8242d5e6b2ff3e44 --- /dev/null +++ b/docker/installer-scripts/install-gcc-arm-none-linux-gnueabihf.sh @@ -0,0 +1,28 @@ +# +# Arm SCP/MCP Software +# Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +set -e + +tool_dir=$1 +version=$2 +hostarch=$(uname -m) +toolchain="gcc-arm-${version}-${hostarch}-arm-none-linux-gnueabihf" +url="https://developer.arm.com/-/media/Files/downloads/gnu-a/${version}/binrel/${toolchain}.tar.xz" + +echo -e "Installing ${toolchain}\n" + +# Create target folder +mkdir -p ${tool_dir} + +# Download +wget -nv ${url} + +# Extract +tar -xf ${toolchain}.tar.xz -C ${tool_dir} --strip-components=1 + +# Clean up +rm ${toolchain}.tar.xz diff --git a/docker/installer-scripts/install-lcov.sh b/docker/installer-scripts/install-lcov.sh new file mode 100755 index 0000000000000000000000000000000000000000..e95ee33d135db7dca8f3e859ccf04513a6daa4f2 --- /dev/null +++ b/docker/installer-scripts/install-lcov.sh @@ -0,0 +1,29 @@ +# +# Arm SCP/MCP Software +# Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +set -e + +tool_dir=$1 +version=$2 + +url="https://github.com/linux-test-project/lcov.git" + +echo -e "Installing LCOV tool version: ${version}\n" + +# Create target folder +mkdir -p ${tool_dir} +pushd ${tool_dir} + +# Download +git clone "${url}" --depth 1 --branch "${version}" source + +# Install +pushd source + +make PREFIX=${tool_dir} install + +popd