Skip to contentSkip to conversation

CI: Set up for an arm64 runner

PATCH Superseded Simon Glass 2 participants 16 messages Nov 5, 2024 – Nov 6, 2024 Remote processor (remoteproc)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover 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(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/9 sandbox: efi_loader: Correct use of addresses as pointers

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.

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(-)
arch/sandbox/cpu/cache.c +7 -1
index c8a5e64214b..96b3da47e8e 100644
@@ -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)
drivers/remoteproc/rproc-elf-loader.c +11 -7
index ab1836b3f07..0b3941b7798 100644
@@ -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;
 }
lib/efi_loader/efi_image_loader.c +2 -1
index 0ddf69a0918..bb58cf1badb 100644
@@ -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));
 
 	/*
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/9 test: Adjust print_ut test to use unsigned char

In reply to Simon Glass

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.

---

Changes in v2:
- Use '\0' instead of 0

 test/print_ut.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
test/print_ut.c +4 -4
index f5e607b21a3..7ab79e4617f 100644
@@ -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);
 
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 3/9 docker: Support building for multiple architectures

In reply to Simon Glass

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.

---

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(-)
doc/build/docker.rst +13 -3
index 45659b3b89d..b854fad43a9 100644
@@ -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
tools/docker/Dockerfile +12 -0
index 967ac89fbde..540718df062 100644
@@ -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 <[email protected]>"
 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 -
Signature · 1 line
2.34.1
#4 lore raw

PATCH v2 4/9 docker: Adjust packages for arm64

In reply to Simon Glass

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

---

Changes in v2:
- Swap order so that amd64 is the exception

 tools/docker/Dockerfile | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
tools/docker/Dockerfile +7 -5
index 540718df062..84661b036c6 100644
@@ -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-2020.07-xtensa-dc233c-elf.tar.gz | 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
Signature · 1 line
2.34.1
#5 lore raw

Re: [PATCH v2 4/9] docker: Adjust packages for arm64

Quoted 17 lines · Simon Glass

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

---

Changes in v2:
- Swap order so that amd64 is the exception

 tools/docker/Dockerfile | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
tools/docker/Dockerfile +0 -0
index 540718df062..84661b036c6 100644

tools/docker/Dockerfile RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ · line 44

Quoted 1 line
tools/docker/Dockerfile +0 -0
@@ -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-2020.07-xtensa-dc233c-elf.tar.gz | 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.

tools/docker/Dockerfile RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ · line 51

Quoted 7 lines
tools/docker/Dockerfile +5 -1
 # 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.

Signature · 1 line
Tom
#6 lore raw

Re: [PATCH v2 4/9] docker: Adjust packages for arm64

Hi Tom,

Quoted 14 lines · Tom Rini
Quoted 12 lines · Simon Glass

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

---

Changes in v2:
- Swap order so that amd64 is the exception

 tools/docker/Dockerfile | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
Quoted 10 lines

tools/docker/Dockerfile RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ · line 44

Quoted 6 lines
tools/docker/Dockerfile +0 -0
index 540718df062..84661b036c6 100644
@@ -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-2020.07-xtensa-dc233c-elf.tar.gz | 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.

Quoted 12 lines

tools/docker/Dockerfile RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ · line 51

Quoted 8 lines
tools/docker/Dockerfile +5 -1
 # 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

#7 lore raw

Re: [PATCH v2 4/9] docker: Adjust packages for arm64

Quoted 28 lines · Simon Glass

Hi Tom,

Quoted 14 lines · Tom Rini
Quoted 12 lines · Simon Glass

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

---

Changes in v2:
- Swap order so that amd64 is the exception

 tools/docker/Dockerfile | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
Quoted 10 lines

tools/docker/Dockerfile RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ · line 44

Quoted 6 lines
tools/docker/Dockerfile +0 -0
index 540718df062..84661b036c6 100644
@@ -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-2020.07-xtensa-dc233c-elf.tar.gz | 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.

Quoted 2 lines

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.

Quoted 15 lines

Same with all the variables being set for grub.

Quoted 12 lines

tools/docker/Dockerfile RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ · line 51

Quoted 8 lines
tools/docker/Dockerfile +5 -1
 # 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.

Quoted 6 lines

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.

Signature · 1 line
Tom
#8 lore raw

Re: [PATCH v2 4/9] docker: Adjust packages for arm64

HI Tom,

Quoted 30 lines · Tom Rini
Quoted 28 lines · Simon Glass

Hi Tom,

Quoted 24 lines · Tom Rini
Quoted 17 lines · Simon Glass

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

---

Changes in v2:
- Swap order so that amd64 is the exception

 tools/docker/Dockerfile | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
tools/docker/Dockerfile +0 -0
index 540718df062..84661b036c6 100644

tools/docker/Dockerfile RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ · line 44

Quoted 1 line
tools/docker/Dockerfile +0 -0
@@ -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-2020.07-xtensa-dc233c-elf.tar.gz | 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.

Quoted 5 lines
Quoted 2 lines

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

Quoted 18 lines
Quoted 18 lines

Same with all the variables being set for grub.

Quoted 12 lines

tools/docker/Dockerfile RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ · line 51

Quoted 8 lines
tools/docker/Dockerfile +5 -1
 # 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]

Quoted 7 lines
Quoted 4 lines

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

#9 lore raw

Re: [PATCH v2 4/9] docker: Adjust packages for arm64

Quoted 33 lines · Simon Glass

HI Tom,

Quoted 30 lines · Tom Rini
Quoted 28 lines · Simon Glass

Hi Tom,

Quoted 24 lines · Tom Rini
Quoted 17 lines · Simon Glass

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

---

Changes in v2:
- Swap order so that amd64 is the exception

 tools/docker/Dockerfile | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
tools/docker/Dockerfile +0 -0
index 540718df062..84661b036c6 100644

tools/docker/Dockerfile RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ · line 44

Quoted 1 line
tools/docker/Dockerfile +0 -0
@@ -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-2020.07-xtensa-dc233c-elf.tar.gz | 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.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

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.

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines

Same with all the variables being set for grub.

Quoted 12 lines

tools/docker/Dockerfile RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ · line 51

Quoted 8 lines
tools/docker/Dockerfile +5 -1
 # 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

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

[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.

Quoted 8 lines

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.

Signature · 1 line
Tom
#10 lore raw

Re: [PATCH v2 4/9] docker: Adjust packages for arm64

Hi Tom,

Quoted 68 lines · Tom Rini
Quoted 33 lines · Simon Glass

HI Tom,

Quoted 30 lines · Tom Rini
Quoted 28 lines · Simon Glass

Hi Tom,

Quoted 24 lines · Tom Rini
Quoted 17 lines · Simon Glass

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

---

Changes in v2:
- Swap order so that amd64 is the exception

 tools/docker/Dockerfile | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
tools/docker/Dockerfile +0 -0
index 540718df062..84661b036c6 100644

tools/docker/Dockerfile RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ · line 44

Quoted 1 line
tools/docker/Dockerfile +0 -0
@@ -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-2020.07-xtensa-dc233c-elf.tar.gz | 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.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

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.

Quoted 22 lines
Quoted 22 lines
Quoted 21 lines

Same with all the variables being set for grub.

Quoted 12 lines

tools/docker/Dockerfile RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_ · line 51

Quoted 8 lines
tools/docker/Dockerfile +5 -1
 # 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

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

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

Quoted 10 lines
Quoted 9 lines

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?

Quoted 6 lines

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

#11 lore raw

PATCH v2 5/9 docker: Drop grub for arm64

In reply to Simon Glass

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.

---

Changes in v2:
- Expand commit-message to show the problem

 tools/docker/Dockerfile | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/docker/Dockerfile +5 -2
index 84661b036c6..458deb7c1ad 100644
@@ -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 && \
Signature · 1 line
2.34.1
#12 lore raw

PATCH v2 6/9 docker: Drop tracing for arm64

In reply to Simon Glass

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'

---

(no changes since v1)

 tools/docker/Dockerfile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tools/docker/Dockerfile +4 -2
index 458deb7c1ad..43b789a0c3e 100644
@@ -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 && \
Signature · 1 line
2.34.1
#13 lore raw

PATCH v2 7/9 docker: Drop coreboot for arm64

In reply to Simon Glass

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.

---

(no changes since v1)

 tools/docker/Dockerfile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tools/docker/Dockerfile +4 -2
index 43b789a0c3e..9eda6d8d402 100644
@@ -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
Signature · 1 line
2.34.1
#14 lore raw

PATCH v2 8/9 docker: Fix LegacyKeyValueFormat warning with PYTHONPATH

In reply to Simon Glass

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)

---

(no changes since v1)

 tools/docker/Dockerfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/docker/Dockerfile +1 -1
index 9eda6d8d402..72844d2c50b 100644
@@ -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"
Signature · 1 line
2.34.1
#15 lore raw

PATCH v2 9/9 CI: Add platform variable

In reply to Simon Glass

Add a list of possible platforms that can be used by gitlab runners.

---

(no changes since v1)

 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)
.gitlab-ci.yml +1 -0
index 0aeda53bc2d..e152060b046 100644
@@ -3,6 +3,7 @@
 variables:
   DEFAULT_TAG: ""
   MIRROR_DOCKER: docker.io
+  PLATFORM: linux/amd64,linux/arm64
 
 default:
   tags:
Signature · 1 line
2.34.1