[PATCH v2 0/9] CI: Set up for an arm64 runner

All gitlab runners are currently amd64 machines. This series attempts to create a docker image which can also support arm64 so that sandbox tests can be run on it.
Changes in v2: - Drop message about EFI_LOADER - Use '\0' instead of 0 - Update docs also - Add comments to the ARG variables - Swap order so that amd64 is the exception - Expand commit-message to show the problem
Simon Glass (9): sandbox: efi_loader: Correct use of addresses as pointers test: Adjust print_ut test to use unsigned char docker: Support building for multiple architectures docker: Adjust packages for arm64 docker: Drop grub for arm64 docker: Drop tracing for arm64 docker: Drop coreboot for arm64 docker: Fix LegacyKeyValueFormat warning with PYTHONPATH CI: Add platform variable
.gitlab-ci.yml | 1 + arch/sandbox/cpu/cache.c | 8 ++++- doc/build/docker.rst | 16 ++++++++-- drivers/remoteproc/rproc-elf-loader.c | 18 ++++++----- lib/efi_loader/efi_image_loader.c | 3 +- test/print_ut.c | 8 ++--- tools/docker/Dockerfile | 45 ++++++++++++++++++++------- 7 files changed, 71 insertions(+), 28 deletions(-)

The cache-flush function is incorrect which causes a crash in the remoteproc tests with arm64.
Fix both problems by using map_sysmem() to convert an address to a pointer and map_to_sysmem() to convert a pointer to an address.
Also update the image-loader's cache-flushing logic.
Signed-off-by: Simon Glass sjg@chromium.org Fixes: 3286d223fd7 ("sandbox: implement invalidate_icache_all()") ---
Changes in v2: - Drop message about EFI_LOADER
arch/sandbox/cpu/cache.c | 8 +++++++- drivers/remoteproc/rproc-elf-loader.c | 18 +++++++++++------- lib/efi_loader/efi_image_loader.c | 3 ++- 3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/arch/sandbox/cpu/cache.c b/arch/sandbox/cpu/cache.c index c8a5e64214b..96b3da47e8e 100644 --- a/arch/sandbox/cpu/cache.c +++ b/arch/sandbox/cpu/cache.c @@ -4,12 +4,18 @@ */
#include <cpu_func.h> +#include <mapmem.h> #include <asm/state.h>
void flush_cache(unsigned long addr, unsigned long size) { + void *ptr; + + ptr = map_sysmem(addr, size); + /* Clang uses (char *) parameters, GCC (void *) */ - __builtin___clear_cache((void *)addr, (void *)(addr + size)); + __builtin___clear_cache(map_sysmem(addr, size), ptr + size); + unmap_sysmem(ptr); }
void invalidate_icache_all(void) diff --git a/drivers/remoteproc/rproc-elf-loader.c b/drivers/remoteproc/rproc-elf-loader.c index ab1836b3f07..0b3941b7798 100644 --- a/drivers/remoteproc/rproc-elf-loader.c +++ b/drivers/remoteproc/rproc-elf-loader.c @@ -6,6 +6,7 @@ #include <dm.h> #include <elf.h> #include <log.h> +#include <mapmem.h> #include <remoteproc.h> #include <asm/cache.h> #include <dm/device_compat.h> @@ -180,6 +181,7 @@ int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size) for (i = 0; i < ehdr->e_phnum; i++, phdr++) { void *dst = (void *)(uintptr_t)phdr->p_paddr; void *src = (void *)addr + phdr->p_offset; + ulong dst_addr;
if (phdr->p_type != PT_LOAD) continue; @@ -195,10 +197,11 @@ int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size) if (phdr->p_filesz != phdr->p_memsz) memset(dst + phdr->p_filesz, 0x00, phdr->p_memsz - phdr->p_filesz); - flush_cache(rounddown((unsigned long)dst, ARCH_DMA_MINALIGN), - roundup((unsigned long)dst + phdr->p_filesz, + dst_addr = map_to_sysmem(dst); + flush_cache(rounddown(dst_addr, ARCH_DMA_MINALIGN), + roundup(dst_addr + phdr->p_filesz, ARCH_DMA_MINALIGN) - - rounddown((unsigned long)dst, ARCH_DMA_MINALIGN)); + rounddown(dst_addr, ARCH_DMA_MINALIGN)); }
return 0; @@ -377,6 +380,7 @@ int rproc_elf32_load_rsc_table(struct udevice *dev, ulong fw_addr, const struct dm_rproc_ops *ops; Elf32_Shdr *shdr; void *src, *dst; + ulong dst_addr;
shdr = rproc_elf32_find_rsc_table(dev, fw_addr, fw_size); if (!shdr) @@ -398,10 +402,10 @@ int rproc_elf32_load_rsc_table(struct udevice *dev, ulong fw_addr, (ulong)dst, *rsc_size);
memcpy(dst, src, *rsc_size); - flush_cache(rounddown((unsigned long)dst, ARCH_DMA_MINALIGN), - roundup((unsigned long)dst + *rsc_size, - ARCH_DMA_MINALIGN) - - rounddown((unsigned long)dst, ARCH_DMA_MINALIGN)); + dst_addr = map_to_sysmem(dst); + flush_cache(rounddown(dst_addr, ARCH_DMA_MINALIGN), + roundup(dst_addr + *rsc_size, ARCH_DMA_MINALIGN) - + rounddown(dst_addr, ARCH_DMA_MINALIGN));
return 0; } diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c index 0ddf69a0918..bb58cf1badb 100644 --- a/lib/efi_loader/efi_image_loader.c +++ b/lib/efi_loader/efi_image_loader.c @@ -13,6 +13,7 @@ #include <efi_loader.h> #include <log.h> #include <malloc.h> +#include <mapmem.h> #include <pe.h> #include <sort.h> #include <crypto/mscode.h> @@ -977,7 +978,7 @@ efi_status_t efi_load_pe(struct efi_loaded_image_obj *handle, }
/* Flush cache */ - flush_cache((ulong)efi_reloc, + flush_cache(map_to_sysmem(efi_reloc), ALIGN(virt_size, EFI_CACHELINE_SIZE));
/*

Since char is unsigned on arm64, this test currently fails. It seems better to use unsigned anyway, since 0xff is written into the string at the start. Update the terminator-assert to use a character instead of a byte.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Heinrich Schuchardt xypron.glpk@gmx.de ---
Changes in v2: - Use '\0' instead of 0
test/print_ut.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/print_ut.c b/test/print_ut.c index f5e607b21a3..7ab79e4617f 100644 --- a/test/print_ut.c +++ b/test/print_ut.c @@ -242,7 +242,7 @@ PRINT_TEST(print_display_buffer, UTF_CONSOLE);
static int print_hexdump_line(struct unit_test_state *uts) { - char *linebuf; + u8 *linebuf; u8 *buf; int i;
@@ -255,10 +255,10 @@ static int print_hexdump_line(struct unit_test_state *uts) linebuf = map_sysmem(0x400, BUF_SIZE); memset(linebuf, '\xff', BUF_SIZE); ut_asserteq(-ENOSPC, hexdump_line(0, buf, 1, 0x10, 0, linebuf, 75)); - ut_asserteq(-1, linebuf[0]); + ut_asserteq(0xff, linebuf[0]); ut_asserteq(0x10, hexdump_line(0, buf, 1, 0x10, 0, linebuf, 76)); - ut_asserteq(0, linebuf[75]); - ut_asserteq(-1, linebuf[76]); + ut_asserteq('\0', linebuf[75]); + ut_asserteq(0xff, linebuf[76]);
unmap_sysmem(buf);

Add instructions on how to build the file for multiple architectures. Add a message indicating what is happening.
Update the documentation as well. Drop the 'sudo' since these should not be needed if Docker is correctly configured.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Update docs also - Add comments to the ARG variables
doc/build/docker.rst | 16 +++++++++++++--- tools/docker/Dockerfile | 12 ++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/doc/build/docker.rst b/doc/build/docker.rst index 45659b3b89d..b854fad43a9 100644 --- a/doc/build/docker.rst +++ b/doc/build/docker.rst @@ -1,14 +1,24 @@ GitLab CI / U-Boot runner container ===================================
-In order to have a reproducible and portable build environment for CI we use a container for building in. This means that developers can also reproduce the CI environment, to a large degree at least, locally. This file is located in the tools/docker directory. To build the image yourself +In order to have a reproducible and portable build environment for CI we use a container for building in. This means that developers can also reproduce the CI environment, to a large degree at least, locally. This file is located in the tools/docker directory. + +The docker image supports both amd64 and arm64. Ensure that the +'docker-buildx' Debian package is installed (or the equivalent on another +distribution). + +Building is currently only supports on an amd64 machine (i.e. 64-bit x86). While +both amd64 and arm64 happen in parallel, the arm64 part will take considerably +longer as it must use QEMU to emulate the arm64 code. + +To build the image yourself::
.. code-block:: bash
- sudo docker build -t your-namespace:your-tag . + docker buildx build --platform linux/arm64/v8,linux/amd64 -t your-namespace:your-tag .
Or to use an existing container
.. code-block:: bash
- sudo docker pull trini/u-boot-gitlab-ci-runner:jammy-20240227-14Mar2024 + docker pull trini/u-boot-gitlab-ci-runner:jammy-20240227-14Mar2024 diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 967ac89fbde..540718df062 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -2,6 +2,9 @@ # This Dockerfile is used to build an image containing basic stuff to be used # to build U-Boot and run our test suites.
+# Build with (for example): +# docker buildx build --platform linux/arm64/v8,linux/amd64 --tag sjg20/u-boot-gitlab-ci-runner-multiarch:jammy-20240808-03Nov2024 . + FROM ubuntu:jammy-20240808 LABEL org.opencontainers.image.authors="Tom Rini trini@konsulko.com" LABEL org.opencontainers.image.description=" This image is for building U-Boot inside a container" @@ -9,6 +12,15 @@ LABEL org.opencontainers.image.description=" This image is for building U-Boot i # Make sure apt is happy ENV DEBIAN_FRONTEND=noninteractive
+# Used by docker to set the target platform: valid values are linux/arm64/v8 +# and linux/amd64 +ARG TARGETPLATFORM + +# Used by docker to set the build platform: the only valid value is linux/amd64 +ARG BUILDPLATFORM + +RUN echo "Building on $BUILDPLATFORM, for target $TARGETPLATFORM" + # Add LLVM repository RUN apt-get update && apt-get install -y gnupg2 wget xz-utils && rm -rf /var/lib/apt/lists/* RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -

The package names are slightly different for arm64 and we don't seem to have a linux-image-kvm package. Provide a different set for arm64
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Swap order so that amd64 is the exception
tools/docker/Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 540718df062..84661b036c6 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -44,7 +44,12 @@ RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ RUN wget -O - https://github.com/foss-xtensa/toolchain/releases/download/2020.07/x86_64-20... | tar -C /opt -xz
# Update and install things from apt now -RUN apt-get update && apt-get install -y \ +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ + EXTRA_PACKAGES="grub-efi-amd64-bin grub-efi-ia32-bin libc6-i386 linux-image-kvm"; \ + else \ + EXTRA_PACKAGES="grub-efi linux-image-generic"; \ + fi; \ + apt-get update && apt-get install -y \ automake \ autopoint \ bc \ @@ -70,13 +75,10 @@ RUN apt-get update && apt-get install -y \ gnu-efi \ gnutls-dev \ graphviz \ - grub-efi-amd64-bin \ - grub-efi-ia32-bin \ help2man \ iasl \ imagemagick \ iputils-ping \ - libc6-i386 \ libconfuse-dev \ libgit2-dev \ libjson-glib-dev \ @@ -94,7 +96,6 @@ RUN apt-get update && apt-get install -y \ libtool \ libudev-dev \ libusb-1.0-0-dev \ - linux-image-kvm \ lzma-alone \ lzop \ mount \ @@ -131,6 +132,7 @@ RUN apt-get update && apt-get install -y \ xilinx-bootgen \ xxd \ zip \ + ${EXTRA_PACKAGES} \ && rm -rf /var/lib/apt/lists/*
# Make kernels readable for libguestfs tools to work correctly

On Tue, Nov 05, 2024 at 09:07:33AM -0700, Simon Glass wrote:
The package names are slightly different for arm64 and we don't seem to have a linux-image-kvm package. Provide a different set for arm64
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2:
- Swap order so that amd64 is the exception
tools/docker/Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 540718df062..84661b036c6 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -44,7 +44,12 @@ RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ RUN wget -O - https://github.com/foss-xtensa/toolchain/releases/download/2020.07/x86_64-20... | tar -C /opt -xz
Oh no, here's a big problem ^^^^^ You didn't switch to downloading arm64 toolchains, no wonder everything else blows up.
# Update and install things from apt now -RUN apt-get update && apt-get install -y \ +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
EXTRA_PACKAGES="grub-efi-amd64-bin grub-efi-ia32-bin libc6-i386 linux-image-kvm"; \
- else \
EXTRA_PACKAGES="grub-efi linux-image-generic"; \
- fi; \
Again, grub-efi should be used for everyone and linux/amd64 adds grub-efi-ia32-bin. And linux-image-generic should work for everyone, too.

Hi Tom,
On Tue, 5 Nov 2024 at 09:11, Tom Rini trini@konsulko.com wrote:
On Tue, Nov 05, 2024 at 09:07:33AM -0700, Simon Glass wrote:
The package names are slightly different for arm64 and we don't seem to have a linux-image-kvm package. Provide a different set for arm64
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2:
- Swap order so that amd64 is the exception
tools/docker/Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 540718df062..84661b036c6 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -44,7 +44,12 @@ RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ RUN wget -O - https://github.com/foss-xtensa/toolchain/releases/download/2020.07/x86_64-20... | tar -C /opt -xz
Oh no, here's a big problem ^^^^^ You didn't switch to downloading arm64 toolchains, no wonder everything else blows up.
Er, yes I know that...I would have to put 'if' statements on each one, but I was hoping we could come up with a better way of handling this. Same with all the variables being set for grub.
# Update and install things from apt now -RUN apt-get update && apt-get install -y \ +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
EXTRA_PACKAGES="grub-efi-amd64-bin grub-efi-ia32-bin libc6-i386 linux-image-kvm"; \
else \
EXTRA_PACKAGES="grub-efi linux-image-generic"; \
fi; \
Again, grub-efi should be used for everyone and linux/amd64 adds grub-efi-ia32-bin. And linux-image-generic should work for everyone, too.
So what about this commit?[1]
Regards, Simon
[1] f9abaa53ec8 tools: docker: Install a readable kernel for libguestfs-tools

On Tue, Nov 05, 2024 at 09:26:10AM -0700, Simon Glass wrote:
Hi Tom,
On Tue, 5 Nov 2024 at 09:11, Tom Rini trini@konsulko.com wrote:
On Tue, Nov 05, 2024 at 09:07:33AM -0700, Simon Glass wrote:
The package names are slightly different for arm64 and we don't seem to have a linux-image-kvm package. Provide a different set for arm64
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2:
- Swap order so that amd64 is the exception
tools/docker/Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 540718df062..84661b036c6 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -44,7 +44,12 @@ RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ RUN wget -O - https://github.com/foss-xtensa/toolchain/releases/download/2020.07/x86_64-20... | tar -C /opt -xz
Oh no, here's a big problem ^^^^^ You didn't switch to downloading arm64 toolchains, no wonder everything else blows up.
Er, yes I know that...I would have to put 'if' statements on each one, but I was hoping we could come up with a better way of handling this.
Yes, hopefully we can do something with $TARGETPLATFORM to set another variable that's exposed for wider use.
Same with all the variables being set for grub.
# Update and install things from apt now -RUN apt-get update && apt-get install -y \ +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
EXTRA_PACKAGES="grub-efi-amd64-bin grub-efi-ia32-bin libc6-i386 linux-image-kvm"; \
else \
EXTRA_PACKAGES="grub-efi linux-image-generic"; \
fi; \
Again, grub-efi should be used for everyone and linux/amd64 adds grub-efi-ia32-bin. And linux-image-generic should work for everyone, too.
So what about this commit?[1]
Regards, Simon
[1] f9abaa53ec8 tools: docker: Install a readable kernel for libguestfs-tools
Yes, linux-image-generic should also provide a useful image, and you would need to check what CI says when using this image.

HI Tom,
On Tue, 5 Nov 2024 at 09:45, Tom Rini trini@konsulko.com wrote:
On Tue, Nov 05, 2024 at 09:26:10AM -0700, Simon Glass wrote:
Hi Tom,
On Tue, 5 Nov 2024 at 09:11, Tom Rini trini@konsulko.com wrote:
On Tue, Nov 05, 2024 at 09:07:33AM -0700, Simon Glass wrote:
The package names are slightly different for arm64 and we don't seem to have a linux-image-kvm package. Provide a different set for arm64
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2:
- Swap order so that amd64 is the exception
tools/docker/Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 540718df062..84661b036c6 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -44,7 +44,12 @@ RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ RUN wget -O - https://github.com/foss-xtensa/toolchain/releases/download/2020.07/x86_64-20... | tar -C /opt -xz
Oh no, here's a big problem ^^^^^ You didn't switch to downloading arm64 toolchains, no wonder everything else blows up.
Er, yes I know that...I would have to put 'if' statements on each one, but I was hoping we could come up with a better way of handling this.
Yes, hopefully we can do something with $TARGETPLATFORM to set another variable that's exposed for wider use.
I recall that docker doesn't let variables set in one phase affect subsequent ones, but perhaps something can be done in the ENV section
Same with all the variables being set for grub.
# Update and install things from apt now -RUN apt-get update && apt-get install -y \ +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
EXTRA_PACKAGES="grub-efi-amd64-bin grub-efi-ia32-bin libc6-i386 linux-image-kvm"; \
else \
EXTRA_PACKAGES="grub-efi linux-image-generic"; \
fi; \
Again, grub-efi should be used for everyone and linux/amd64 adds grub-efi-ia32-bin. And linux-image-generic should work for everyone, too.
So what about this commit?[1]
Regards, Simon
[1] f9abaa53ec8 tools: docker: Install a readable kernel for libguestfs-tools
Yes, linux-image-generic should also provide a useful image, and you would need to check what CI says when using this image.
OK, so we don't actually need the kvm one, it seems?
Anyway, the upshot of all of this is that you want arm64 to run the full suite of tests, including kvm and world builds. But presumably not in addition to the x86_64 ones...? I suppose I am just unclear as to what you are looking for. Are you trying to test that QEMU works properly, or that U-Boot's code works?
My expectation was that we just want sandbox testing on arm64...I don't see much point in anything else. What am I missing?
Regards, Simon

On Tue, Nov 05, 2024 at 12:20:51PM -0700, Simon Glass wrote:
HI Tom,
On Tue, 5 Nov 2024 at 09:45, Tom Rini trini@konsulko.com wrote:
On Tue, Nov 05, 2024 at 09:26:10AM -0700, Simon Glass wrote:
Hi Tom,
On Tue, 5 Nov 2024 at 09:11, Tom Rini trini@konsulko.com wrote:
On Tue, Nov 05, 2024 at 09:07:33AM -0700, Simon Glass wrote:
The package names are slightly different for arm64 and we don't seem to have a linux-image-kvm package. Provide a different set for arm64
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2:
- Swap order so that amd64 is the exception
tools/docker/Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 540718df062..84661b036c6 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -44,7 +44,12 @@ RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ RUN wget -O - https://github.com/foss-xtensa/toolchain/releases/download/2020.07/x86_64-20... | tar -C /opt -xz
Oh no, here's a big problem ^^^^^ You didn't switch to downloading arm64 toolchains, no wonder everything else blows up.
Er, yes I know that...I would have to put 'if' statements on each one, but I was hoping we could come up with a better way of handling this.
Yes, hopefully we can do something with $TARGETPLATFORM to set another variable that's exposed for wider use.
I recall that docker doesn't let variables set in one phase affect subsequent ones, but perhaps something can be done in the ENV section
Yes, my hope is we could set something in the ENV section.
Same with all the variables being set for grub.
# Update and install things from apt now -RUN apt-get update && apt-get install -y \ +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
EXTRA_PACKAGES="grub-efi-amd64-bin grub-efi-ia32-bin libc6-i386 linux-image-kvm"; \
else \
EXTRA_PACKAGES="grub-efi linux-image-generic"; \
fi; \
Again, grub-efi should be used for everyone and linux/amd64 adds grub-efi-ia32-bin. And linux-image-generic should work for everyone, too.
So what about this commit?[1]
Regards, Simon
[1] f9abaa53ec8 tools: docker: Install a readable kernel for libguestfs-tools
Yes, linux-image-generic should also provide a useful image, and you would need to check what CI says when using this image.
OK, so we don't actually need the kvm one, it seems?
No, that was just a reasonable at the time choice for a kernel image file.
Anyway, the upshot of all of this is that you want arm64 to run the full suite of tests, including kvm and world builds. But presumably not in addition to the x86_64 ones...? I suppose I am just unclear as to what you are looking for. Are you trying to test that QEMU works properly, or that U-Boot's code works?
My expectation was that we just want sandbox testing on arm64...I don't see much point in anything else. What am I missing?
I would like, especially if we get additional compute resources donated, to duplicate much of the testing we do _also_ on arm64 as a host, at least on tagged releases. This is a thing more and more people do, and it would be good to be able to point at CI when something like: https://source.denx.de/u-boot/u-boot/-/issues/44 is filed.

Hi Tom,
On Tue, 5 Nov 2024 at 13:55, Tom Rini trini@konsulko.com wrote:
On Tue, Nov 05, 2024 at 12:20:51PM -0700, Simon Glass wrote:
HI Tom,
On Tue, 5 Nov 2024 at 09:45, Tom Rini trini@konsulko.com wrote:
On Tue, Nov 05, 2024 at 09:26:10AM -0700, Simon Glass wrote:
Hi Tom,
On Tue, 5 Nov 2024 at 09:11, Tom Rini trini@konsulko.com wrote:
On Tue, Nov 05, 2024 at 09:07:33AM -0700, Simon Glass wrote:
The package names are slightly different for arm64 and we don't seem to have a linux-image-kvm package. Provide a different set for arm64
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2:
- Swap order so that amd64 is the exception
tools/docker/Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 540718df062..84661b036c6 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -44,7 +44,12 @@ RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ RUN wget -O - https://github.com/foss-xtensa/toolchain/releases/download/2020.07/x86_64-20... | tar -C /opt -xz
Oh no, here's a big problem ^^^^^ You didn't switch to downloading arm64 toolchains, no wonder everything else blows up.
Er, yes I know that...I would have to put 'if' statements on each one, but I was hoping we could come up with a better way of handling this.
Yes, hopefully we can do something with $TARGETPLATFORM to set another variable that's exposed for wider use.
I recall that docker doesn't let variables set in one phase affect subsequent ones, but perhaps something can be done in the ENV section
Yes, my hope is we could set something in the ENV section.
Same with all the variables being set for grub.
# Update and install things from apt now -RUN apt-get update && apt-get install -y \ +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
EXTRA_PACKAGES="grub-efi-amd64-bin grub-efi-ia32-bin libc6-i386 linux-image-kvm"; \
else \
EXTRA_PACKAGES="grub-efi linux-image-generic"; \
fi; \
Again, grub-efi should be used for everyone and linux/amd64 adds grub-efi-ia32-bin. And linux-image-generic should work for everyone, too.
So what about this commit?[1]
Regards, Simon
[1] f9abaa53ec8 tools: docker: Install a readable kernel for libguestfs-tools
Yes, linux-image-generic should also provide a useful image, and you would need to check what CI says when using this image.
OK, so we don't actually need the kvm one, it seems?
No, that was just a reasonable at the time choice for a kernel image file.
OK
Anyway, the upshot of all of this is that you want arm64 to run the full suite of tests, including kvm and world builds. But presumably not in addition to the x86_64 ones...? I suppose I am just unclear as to what you are looking for. Are you trying to test that QEMU works properly, or that U-Boot's code works?
My expectation was that we just want sandbox testing on arm64...I don't see much point in anything else. What am I missing?
I would like, especially if we get additional compute resources donated, to duplicate much of the testing we do _also_ on arm64 as a host, at least on tagged releases. This is a thing more and more people do, and it would be good to be able to point at CI when something like: https://source.denx.de/u-boot/u-boot/-/issues/44 is filed.
Well, that issue is a mystery to me too.
Anyway, this is mostly a difference in approach. I like to do things incrementally, rather than trying to do everything at once.
Regards, Simon

This doesn't build on arm64 at present, so drop it for now. We only expect to run sandbox tests, so perhaps it isn't needed.
The error seems to be due to not using the correct toolchains:
./configure: line 32517: /opt/gcc-13.2.0-nolibc/aarch64-linux/ bin/aarch64-linux-gcc: No such file or directory checking for options to get soft-float... no configure: error: could not force soft-float
That is at the top of the file, and needs adjusting.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Expand commit-message to show the problem
tools/docker/Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 84661b036c6..458deb7c1ad 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -139,7 +139,9 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ RUN chmod +r /boot/vmlinu*
# Build GRUB UEFI targets for ARM & RISC-V, 32-bit and 64-bit -RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \ +# This fails on arm64 +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ + git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \ cd /tmp/grub && \ git checkout grub-2.06 && \ git config --global user.name "GitLab CI Runner" && \ @@ -189,7 +191,8 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \ lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \ search search_fs_file search_fs_uuid search_label serial sleep test \ true && \ - rm -rf /tmp/grub + rm -rf /tmp/grub; \ + fi
RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ cd /tmp/qemu && \

This doesn't build on arm64 at present, so drop it for now. This can be revisited if we wish to support arm64 for the sandbox trace-test.
The error is: /usr/bin/ld: /usr/local/lib64/libtracefs.so: undefined reference to `trace_seq_vprintf'
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/docker/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 458deb7c1ad..43b789a0c3e 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -245,7 +245,8 @@ RUN git clone https://github.com/stefanberger/swtpm /tmp/swtpm && \ rm -rf /tmp/swtpm
# Build trace-cmd -RUN mkdir /tmp/trace && \ +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ + mkdir /tmp/trace && \ git clone https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git /tmp/trace/libtraceevent && \ cd /tmp/trace/libtraceevent && \ make -j$(nproc) && \ @@ -258,7 +259,8 @@ RUN mkdir /tmp/trace && \ cd /tmp/trace/trace-cmd && \ make -j$(nproc) && \ sudo make install && \ - rm -rf /tmp/trace + rm -rf /tmp/trace; \ + fi
# Build coreboot RUN wget -O - https://coreboot.org/releases/coreboot-24.08.tar.xz | tar -C /tmp -xJ && \

This isn't needed for sandbox builds and coreboot isn't much used on arm64, nor does U-Boot have a build that supports running from coreboot on any ARM target.
So drop it.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Tom Rini trini@konsulko.com ---
(no changes since v1)
tools/docker/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 43b789a0c3e..9eda6d8d402 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -263,7 +263,8 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ fi
# Build coreboot -RUN wget -O - https://coreboot.org/releases/coreboot-24.08.tar.xz | tar -C /tmp -xJ && \ +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ + wget -O - https://coreboot.org/releases/coreboot-24.08.tar.xz | tar -C /tmp -xJ && \ cd /tmp/coreboot-24.08 && \ make crossgcc-i386 CPUS=$(nproc) && \ make -C payloads/coreinfo olddefconfig && \ @@ -274,7 +275,8 @@ RUN wget -O - https://coreboot.org/releases/coreboot-24.08.tar.xz | tar -C /tmp make olddefconfig && \ make -j $(nproc) && \ sudo mkdir /opt/coreboot && \ - sudo cp build/coreboot.rom build/cbfstool /opt/coreboot/ + sudo cp build/coreboot.rom build/cbfstool /opt/coreboot/; \ + fi
# Create our user/group RUN echo uboot ALL=NOPASSWD: ALL > /etc/sudoers.d/uboot

Fix a warning due to the syntax used for PYTHONPATH:
LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 304)
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Heinrich Schuchardt xypron.glpk@gmx.de Reviewed-by: Tom Rini trini@konsulko.com ---
(no changes since v1)
tools/docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 9eda6d8d402..72844d2c50b 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -306,4 +306,4 @@ RUN /bin/echo -e "\nx86 = i386" >> ~/.buildman;
# Add mkbootimg tool RUN git clone https://android.googlesource.com/platform/system/tools/mkbootimg /home/uboot/mkbootimg -ENV PYTHONPATH "${PYTHONPATH}:/home/uboot/mkbootimg" +ENV PYTHONPATH="${PYTHONPATH}:/home/uboot/mkbootimg"

Add a list of possible platforms that can be used by gitlab runners.
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Tom Rini trini@konsulko.com ---
(no changes since v1)
.gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0aeda53bc2d..e152060b046 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ variables: DEFAULT_TAG: "" MIRROR_DOCKER: docker.io + PLATFORM: linux/amd64,linux/arm64
default: tags:
participants (2)
-
Simon Glass
-
Tom Rini