Skip to contentSkip to conversation

Dockerfile: Update to gcc-14.2.0 and clang-18

PATCH In review Tom Rini 2 participants 4 messages Jan 28, 2025 – Apr 11, 2025

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 Dockerfile: Update to gcc-14.2.0 and clang-18

Outside of changing versions here the other visible change is that we tell grub that riscv64 does not have "large model" support. Without this change the resulting mkimage is non-functional. This is known upstream already.

---
 .azure-pipelines.yml    | 8 ++++----
 .gitlab-ci.yml          | 6 +++---
 tools/docker/Dockerfile | 8 ++++----
 3 files changed, 11 insertions(+), 11 deletions(-)
.azure-pipelines.yml +4 -4
index ba351b9802d1..4d3a5800beb3 100644
@@ -2,7 +2,7 @@ variables:
   windows_vm: windows-2022
   ubuntu_vm: ubuntu-24.04
   macos_vm: macOS-14
-  ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20240911.1-08Dec2024
+  ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20240911.1-28Jan2025
   # Add '-u 0' options for Azure pipelines, otherwise we get "permission
   # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
   # since our $(ci_runner_image) user is not root.
@@ -324,16 +324,16 @@ stages:
           TEST_PY_TEST_SPEC: "version"
         sandbox_clang:
           TEST_PY_BD: "sandbox"
-          OVERRIDE: "-O clang-17"
+          OVERRIDE: "-O clang-18"
         sandbox_clang_asan:
           TEST_PY_BD: "sandbox"
-          OVERRIDE: "-O clang-17 -a ASAN"
+          OVERRIDE: "-O clang-18 -a ASAN"
           TEST_PY_TEST_SPEC: "version"
         sandbox64:
           TEST_PY_BD: "sandbox64"
         sandbox64_clang:
           TEST_PY_BD: "sandbox64"
-          OVERRIDE: "-O clang-17"
+          OVERRIDE: "-O clang-18"
         sandbox_spl:
           TEST_PY_BD: "sandbox_spl"
           TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
.gitlab-ci.yml +3 -3
index 74dc05d58a70..c3c38e24fd1d 100644
@@ -20,7 +20,7 @@ workflow:
 
 # Grab our configured image.  The source for this is found
 # in the u-boot tree at tools/docker/Dockerfile
-image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20240911.1-08Dec2024
+image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20240911.1-28Jan2025
 
 # We run some tests in different order, to catch some failures quicker.
 stages:
@@ -241,7 +241,7 @@ sandbox with clang test.py:
     - ${DEFAULT_AMD64_TAG}
   variables:
     TEST_PY_BD: "sandbox"
-    OVERRIDE: "-O clang-17"
+    OVERRIDE: "-O clang-18"
   <<: *buildman_and_testpy_dfn
 
 sandbox64 test.py:
@@ -256,7 +256,7 @@ sandbox64 with clang test.py:
     - ${DEFAULT_AMD64_TAG}
   variables:
     TEST_PY_BD: "sandbox64"
-    OVERRIDE: "-O clang-17"
+    OVERRIDE: "-O clang-18"
   <<: *buildman_and_testpy_dfn
 
 sandbox_spl test.py:
tools/docker/Dockerfile +4 -4
index d2848ab85f35..b72ed357fa36 100644
@@ -23,7 +23,7 @@ ENV ARCHS="aarch64 arc i386 m68k mips microblaze nios2 powerpc riscv64 riscv32 s
 ENV MIRROR=https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin
 
 # Toolchain version
-ENV TCVER=13.2.0
+ENV TCVER=14.2.0
 
 RUN echo "Building on $BUILDPLATFORM, for target $TARGETPLATFORM"
 
@@ -32,7 +32,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
     --mount=type=cache,target=/var/lib/apt,sharing=locked \
     apt-get update && apt-get install -y gnupg2 wget xz-utils
 RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
-RUN echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main | tee /etc/apt/sources.list.d/llvm.list
+RUN echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main | tee /etc/apt/sources.list.d/llvm.list
 
 # Create a list of URLs to process, then pass them into a 'while read' loop
 RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then HOSTARCH=x86_64; else HOSTARCH=arm64; fi; ( \
@@ -65,7 +65,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
 	bison \
 	build-essential \
 	cgpt \
-	clang-17 \
+	clang-18 \
 	coreutils \
 	cpio \
 	curl \
@@ -182,7 +182,7 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
 	search search_fs_file search_fs_uuid search_label serial sleep test \
 	true && \
 	make clean && \
-	./configure --target=riscv64 --with-platform=efi \
+	grub_cv_cc_mcmodel=no ./configure --target=riscv64 --with-platform=efi \
 	CC=gcc \
 	TARGET_CC=/opt/gcc-${TCVER}-nolibc/riscv64-linux/bin/riscv64-linux-gcc \
 	TARGET_OBJCOPY=/opt/gcc-${TCVER}-nolibc/riscv64-linux/bin/riscv64-linux-objcopy \
Signature · 1 line
2.43.0
author
#1 lore raw
Quoted 6 lines · Tom Rini

Outside of changing versions here the other visible change is that we tell grub that riscv64 does not have "large model" support. Without this change the resulting mkimage is non-functional. This is known upstream already.

Applied to u-boot/master, thanks!

[1/1] Dockerfile: Update to gcc-14.2.0 and clang-18

      commit: 001bac5f16adfc131ade7de73ee681972a89df1a
Signature · 1 line
Tom
#2 lore raw
In reply to Tom Rini
Quoted 109 lines · Tom Rini

Outside of changing versions here the other visible change is that we tell grub that riscv64 does not have "large model" support. Without this change the resulting mkimage is non-functional. This is known upstream already.

---
  .azure-pipelines.yml    | 8 ++++----
  .gitlab-ci.yml          | 6 +++---
  tools/docker/Dockerfile | 8 ++++----
  3 files changed, 11 insertions(+), 11 deletions(-)
.azure-pipelines.yml +4 -4
index ba351b9802d1..4d3a5800beb3 100644
@@ -2,7 +2,7 @@ variables:
    windows_vm: windows-2022
    ubuntu_vm: ubuntu-24.04
    macos_vm: macOS-14
-  ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20240911.1-08Dec2024
+  ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20240911.1-28Jan2025
    # Add '-u 0' options for Azure pipelines, otherwise we get "permission
    # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
    # since our $(ci_runner_image) user is not root.
@@ -324,16 +324,16 @@ stages:
            TEST_PY_TEST_SPEC: "version"
          sandbox_clang:
            TEST_PY_BD: "sandbox"
-          OVERRIDE: "-O clang-17"
+          OVERRIDE: "-O clang-18"
          sandbox_clang_asan:
            TEST_PY_BD: "sandbox"
-          OVERRIDE: "-O clang-17 -a ASAN"
+          OVERRIDE: "-O clang-18 -a ASAN"
            TEST_PY_TEST_SPEC: "version"
          sandbox64:
            TEST_PY_BD: "sandbox64"
          sandbox64_clang:
            TEST_PY_BD: "sandbox64"
-          OVERRIDE: "-O clang-17"
+          OVERRIDE: "-O clang-18"
          sandbox_spl:
            TEST_PY_BD: "sandbox_spl"
            TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
.gitlab-ci.yml +3 -3
index 74dc05d58a70..c3c38e24fd1d 100644
@@ -20,7 +20,7 @@ workflow:
 
  # Grab our configured image.  The source for this is found
  # in the u-boot tree at tools/docker/Dockerfile
-image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20240911.1-08Dec2024
+image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20240911.1-28Jan2025
 
  # We run some tests in different order, to catch some failures quicker.
  stages:
@@ -241,7 +241,7 @@ sandbox with clang test.py:
      - ${DEFAULT_AMD64_TAG}
    variables:
      TEST_PY_BD: "sandbox"
-    OVERRIDE: "-O clang-17"
+    OVERRIDE: "-O clang-18"
    <<: *buildman_and_testpy_dfn
 
  sandbox64 test.py:
@@ -256,7 +256,7 @@ sandbox64 with clang test.py:
      - ${DEFAULT_AMD64_TAG}
    variables:
      TEST_PY_BD: "sandbox64"
-    OVERRIDE: "-O clang-17"
+    OVERRIDE: "-O clang-18"
    <<: *buildman_and_testpy_dfn
 
  sandbox_spl test.py:
tools/docker/Dockerfile +3 -3
index d2848ab85f35..b72ed357fa36 100644
@@ -23,7 +23,7 @@ ENV ARCHS="aarch64 arc i386 m68k mips microblaze nios2 powerpc riscv64 riscv32 s
  ENV MIRROR=https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin
 
  # Toolchain version
-ENV TCVER=13.2.0
+ENV TCVER=14.2.0
 
  RUN echo "Building on $BUILDPLATFORM, for target $TARGETPLATFORM"
 
@@ -32,7 +32,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
      --mount=type=cache,target=/var/lib/apt,sharing=locked \
      apt-get update && apt-get install -y gnupg2 wget xz-utils
  RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
-RUN echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main | tee /etc/apt/sources.list.d/llvm.list
+RUN echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main | tee /etc/apt/sources.list.d/llvm.list
 
  # Create a list of URLs to process, then pass them into a 'while read' loop
  RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then HOSTARCH=x86_64; else HOSTARCH=arm64; fi; ( \
@@ -65,7 +65,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
  	bison \
  	build-essential \
  	cgpt \
-	clang-17 \
+	clang-18 \
  	coreutils \
  	cpio \
  	curl \

tools/docker/Dockerfile RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \ · line 185

Quoted 5 lines
tools/docker/Dockerfile +1 -1
@@ -182,7 +182,7 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
  	search search_fs_file search_fs_uuid search_label serial sleep test \
  	true && \
  	make clean && \
-	./configure --target=riscv64 --with-platform=efi \
+	grub_cv_cc_mcmodel=no ./configure --target=riscv64 --with-platform=efi \

Hello Tom,

The upstream GRUB code already has a test in autoconfigure.ac to check if the large model is supported:

if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64 ; then
# Use large model to support 4G memory AC_CACHE_CHECK([whether option -mcmodel=large works],
grub_cv_cc_mcmodel, [

    CFLAGS="$TARGET_CFLAGS -mcmodel=large"
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],

                 [grub_cv_cc_mcmodel=yes], [grub_cv_cc_mcmodel=no])
])
if test "x$grub_cv_cc_mcmodel" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
elif test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64; then
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany"
fi
fi

Why did you have to put grub_cv_cc_mcmodel=no on the command line?

I would prefer to leave it to GRUB to figure out which model is supported.

Best regards

Heinrich

Quoted 3 lines
tools/docker/Dockerfile +0 -0
  	CC=gcc \
  	TARGET_CC=/opt/gcc-${TCVER}-nolibc/riscv64-linux/bin/riscv64-linux-gcc \
  	TARGET_OBJCOPY=/opt/gcc-${TCVER}-nolibc/riscv64-linux/bin/riscv64-linux-objcopy \
author
#3 lore raw
Quoted 138 lines · Heinrich Schuchardt
Quoted 109 lines · Tom Rini

Outside of changing versions here the other visible change is that we tell grub that riscv64 does not have "large model" support. Without this change the resulting mkimage is non-functional. This is known upstream already.

---
  .azure-pipelines.yml    | 8 ++++----
  .gitlab-ci.yml          | 6 +++---
  tools/docker/Dockerfile | 8 ++++----
  3 files changed, 11 insertions(+), 11 deletions(-)
.azure-pipelines.yml +4 -4
index ba351b9802d1..4d3a5800beb3 100644
@@ -2,7 +2,7 @@ variables:
    windows_vm: windows-2022
    ubuntu_vm: ubuntu-24.04
    macos_vm: macOS-14
-  ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20240911.1-08Dec2024
+  ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20240911.1-28Jan2025
    # Add '-u 0' options for Azure pipelines, otherwise we get "permission
    # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
    # since our $(ci_runner_image) user is not root.
@@ -324,16 +324,16 @@ stages:
            TEST_PY_TEST_SPEC: "version"
          sandbox_clang:
            TEST_PY_BD: "sandbox"
-          OVERRIDE: "-O clang-17"
+          OVERRIDE: "-O clang-18"
          sandbox_clang_asan:
            TEST_PY_BD: "sandbox"
-          OVERRIDE: "-O clang-17 -a ASAN"
+          OVERRIDE: "-O clang-18 -a ASAN"
            TEST_PY_TEST_SPEC: "version"
          sandbox64:
            TEST_PY_BD: "sandbox64"
          sandbox64_clang:
            TEST_PY_BD: "sandbox64"
-          OVERRIDE: "-O clang-17"
+          OVERRIDE: "-O clang-18"
          sandbox_spl:
            TEST_PY_BD: "sandbox_spl"
            TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
.gitlab-ci.yml +3 -3
index 74dc05d58a70..c3c38e24fd1d 100644
@@ -20,7 +20,7 @@ workflow:
 
  # Grab our configured image.  The source for this is found
  # in the u-boot tree at tools/docker/Dockerfile
-image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20240911.1-08Dec2024
+image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20240911.1-28Jan2025
 
  # We run some tests in different order, to catch some failures quicker.
  stages:
@@ -241,7 +241,7 @@ sandbox with clang test.py:
      - ${DEFAULT_AMD64_TAG}
    variables:
      TEST_PY_BD: "sandbox"
-    OVERRIDE: "-O clang-17"
+    OVERRIDE: "-O clang-18"
    <<: *buildman_and_testpy_dfn
 
  sandbox64 test.py:
@@ -256,7 +256,7 @@ sandbox64 with clang test.py:
      - ${DEFAULT_AMD64_TAG}
    variables:
      TEST_PY_BD: "sandbox64"
-    OVERRIDE: "-O clang-17"
+    OVERRIDE: "-O clang-18"
    <<: *buildman_and_testpy_dfn
 
  sandbox_spl test.py:
tools/docker/Dockerfile +3 -3
index d2848ab85f35..b72ed357fa36 100644
@@ -23,7 +23,7 @@ ENV ARCHS="aarch64 arc i386 m68k mips microblaze nios2 powerpc riscv64 riscv32 s
  ENV MIRROR=https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin
 
  # Toolchain version
-ENV TCVER=13.2.0
+ENV TCVER=14.2.0
 
  RUN echo "Building on $BUILDPLATFORM, for target $TARGETPLATFORM"
 
@@ -32,7 +32,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
      --mount=type=cache,target=/var/lib/apt,sharing=locked \
      apt-get update && apt-get install -y gnupg2 wget xz-utils
  RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
-RUN echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main | tee /etc/apt/sources.list.d/llvm.list
+RUN echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main | tee /etc/apt/sources.list.d/llvm.list
 
  # Create a list of URLs to process, then pass them into a 'while read' loop
  RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then HOSTARCH=x86_64; else HOSTARCH=arm64; fi; ( \
@@ -65,7 +65,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
  	bison \
  	build-essential \
  	cgpt \
-	clang-17 \
+	clang-18 \
  	coreutils \
  	cpio \
  	curl \

tools/docker/Dockerfile RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \ · line 185

Quoted 5 lines
tools/docker/Dockerfile +1 -1
@@ -182,7 +182,7 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
  	search search_fs_file search_fs_uuid search_label serial sleep test \
  	true && \
  	make clean && \
-	./configure --target=riscv64 --with-platform=efi \
+	grub_cv_cc_mcmodel=no ./configure --target=riscv64 --with-platform=efi \

Hello Tom,

The upstream GRUB code already has a test in autoconfigure.ac to check if the large model is supported:

if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64 ; then
# Use large model to support 4G memory AC_CACHE_CHECK([whether option -mcmodel=large works],
grub_cv_cc_mcmodel, [

    CFLAGS="$TARGET_CFLAGS -mcmodel=large"
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],

                 [grub_cv_cc_mcmodel=yes], [grub_cv_cc_mcmodel=no])
])
if test "x$grub_cv_cc_mcmodel" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
elif test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64; then
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany"
fi
fi

Quoted 3 lines

Why did you have to put grub_cv_cc_mcmodel=no on the command line?

I would prefer to leave it to GRUB to figure out which model is supported.

Because the test is wrong. It claims it's supported and then the tools fail to run and segfault. This is in the link at
https://savannah.gnu.org/bugs/?65909

Signature · 1 line
Tom