Merge patch series "CI: Set up for an arm64 runner"

Tom Rini <trini@konsulko.com> says:

Hey all,

This is picking up Simon's v5 of the above-named series and making a few
more changes so that the follow-up series I have leads to arm64 being
supported for almost all jobs. To quote Simon's cover letter:

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.

The TARGET_... environment variables for grub could perhaps be adjusted,
using the new variables, but I have not done that for now.

Adding to what Simon said, we now build grub for all architectures as
the reason to install it was to be able to use the binaries in QEMU.
That won't provide us with amd64 binaries on arm64 hosts so we can't use
that shortcut anymore.

Link: https://lore.kernel.org/r/20241127172247.1488685-1-trini@konsulko.com
This commit is contained in:
Tom Rini 2024-12-02 16:36:06 -06:00
commit c33be116dc
9 changed files with 124 additions and 56 deletions

View file

@ -2,7 +2,7 @@ variables:
windows_vm: windows-2022 windows_vm: windows-2022
ubuntu_vm: ubuntu-24.04 ubuntu_vm: ubuntu-24.04
macos_vm: macOS-14 macos_vm: macOS-14
ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20240808-21Aug2024 ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20240808-03Dec2024
# Add '-u 0' options for Azure pipelines, otherwise we get "permission # Add '-u 0' options for Azure pipelines, otherwise we get "permission
# denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer", # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
# since our $(ci_runner_image) user is not root. # since our $(ci_runner_image) user is not root.
@ -245,8 +245,6 @@ stages:
ln -s u_boot_boardenv_qemu_arm64_na.py /tmp/uboot-test-hooks/py/travis-ci/u_boot_boardenv_qemu_arm64_lwip_na.py ln -s u_boot_boardenv_qemu_arm64_na.py /tmp/uboot-test-hooks/py/travis-ci/u_boot_boardenv_qemu_arm64_lwip_na.py
ln -s travis-ci /tmp/uboot-test-hooks/bin/\`hostname\` ln -s travis-ci /tmp/uboot-test-hooks/bin/\`hostname\`
ln -s travis-ci /tmp/uboot-test-hooks/py/\`hostname\` ln -s travis-ci /tmp/uboot-test-hooks/py/\`hostname\`
grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
grub-mkimage --prefix=\"\" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
if [[ "\${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then if [[ "\${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.3.1/opensbi-1.3.1-rv-bin.tar.xz | tar -C /tmp -xJ; wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.3.1/opensbi-1.3.1-rv-bin.tar.xz | tar -C /tmp -xJ;
export OPENSBI=/tmp/opensbi-1.3.1-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin; export OPENSBI=/tmp/opensbi-1.3.1-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin;
@ -268,8 +266,8 @@ stages:
fi fi
pip install -r tools/buildman/requirements.txt pip install -r tools/buildman/requirements.txt
tools/buildman/buildman -o \${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board \${TEST_PY_BD} \${OVERRIDE} tools/buildman/buildman -o \${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board \${TEST_PY_BD} \${OVERRIDE}
cp ~/grub_x86.efi \${UBOOT_TRAVIS_BUILD_DIR}/ cp /opt/grub/grub_x86.efi \${UBOOT_TRAVIS_BUILD_DIR}/
cp ~/grub_x64.efi \${UBOOT_TRAVIS_BUILD_DIR}/ cp /opt/grub/grub_x64.efi \${UBOOT_TRAVIS_BUILD_DIR}/
cp /opt/grub/grubriscv64.efi \${UBOOT_TRAVIS_BUILD_DIR}/grub_riscv64.efi cp /opt/grub/grubriscv64.efi \${UBOOT_TRAVIS_BUILD_DIR}/grub_riscv64.efi
cp /opt/grub/grubaa64.efi \${UBOOT_TRAVIS_BUILD_DIR}/grub_arm64.efi cp /opt/grub/grubaa64.efi \${UBOOT_TRAVIS_BUILD_DIR}/grub_arm64.efi
cp /opt/grub/grubarm.efi \${UBOOT_TRAVIS_BUILD_DIR}/grub_arm.efi cp /opt/grub/grubarm.efi \${UBOOT_TRAVIS_BUILD_DIR}/grub_arm.efi

View file

@ -4,6 +4,7 @@ variables:
DEFAULT_TAG: "" DEFAULT_TAG: ""
MIRROR_DOCKER: docker.io MIRROR_DOCKER: docker.io
SJG_LAB: "" SJG_LAB: ""
PLATFORM: linux/amd64,linux/arm64
default: default:
tags: tags:
@ -11,7 +12,7 @@ default:
# Grab our configured image. The source for this is found # Grab our configured image. The source for this is found
# in the u-boot tree at tools/docker/Dockerfile # in the u-boot tree at tools/docker/Dockerfile
image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20240808-21Aug2024 image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20240808-03Dec2024
# We run some tests in different order, to catch some failures quicker. # We run some tests in different order, to catch some failures quicker.
stages: stages:
@ -34,8 +35,6 @@ stages:
- ln -s conf.qemu_arm64_na /tmp/uboot-test-hooks/bin/travis-ci/conf.qemu_arm64_lwip_na - ln -s conf.qemu_arm64_na /tmp/uboot-test-hooks/bin/travis-ci/conf.qemu_arm64_lwip_na
- ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname` - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
- ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname` - ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
- grub-mkimage --prefix="" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
- grub-mkimage --prefix="" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
- if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then - if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.3.1/opensbi-1.3.1-rv-bin.tar.xz | tar -C /tmp -xJ; wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.3.1/opensbi-1.3.1-rv-bin.tar.xz | tar -C /tmp -xJ;
export OPENSBI=/tmp/opensbi-1.3.1-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin; export OPENSBI=/tmp/opensbi-1.3.1-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin;
@ -62,8 +61,8 @@ stages:
fi fi
- tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e - tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e
--board ${TEST_PY_BD} ${OVERRIDE} --board ${TEST_PY_BD} ${OVERRIDE}
- cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/ - cp /opt/grub/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/
- cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/ - cp /opt/grub/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/
- cp /opt/grub/grubriscv64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_riscv64.efi - cp /opt/grub/grubriscv64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_riscv64.efi
- cp /opt/grub/grubaa64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi - cp /opt/grub/grubaa64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi
- cp /opt/grub/grubarm.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi - cp /opt/grub/grubarm.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi

View file

@ -4,12 +4,18 @@
*/ */
#include <cpu_func.h> #include <cpu_func.h>
#include <mapmem.h>
#include <asm/state.h> #include <asm/state.h>
void flush_cache(unsigned long addr, unsigned long size) void flush_cache(unsigned long addr, unsigned long size)
{ {
void *ptr;
ptr = map_sysmem(addr, size);
/* Clang uses (char *) parameters, GCC (void *) */ /* 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) void invalidate_icache_all(void)

23
doc/build/docker.rst vendored
View file

@ -1,11 +1,30 @@
GitLab CI / U-Boot runner container 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).
You will need a multi-platform container, otherwise this error is shown::
ERROR: Multi-platform build is not supported for the docker driver.
Switch to a different driver, or turn on the containerd image store, and try again.
You can add one with::
sudo docker buildx create --name multiarch --driver docker-container --use
Building is supported on both amd64 (i.e. 64-bit x86) and arm64 machines. While
both amd64 and arm64 happen in parallel, the non-native part will take
considerably longer as it must use QEMU to emulate the foreign code.
To build the image yourself::
.. code-block:: bash .. code-block:: bash
sudo docker build -t your-namespace:your-tag . sudo docker buildx build --platform linux/arm64/v8,linux/amd64 -t your-namespace:your-tag .
Or to use an existing container Or to use an existing container

View file

@ -6,6 +6,7 @@
#include <dm.h> #include <dm.h>
#include <elf.h> #include <elf.h>
#include <log.h> #include <log.h>
#include <mapmem.h>
#include <remoteproc.h> #include <remoteproc.h>
#include <asm/cache.h> #include <asm/cache.h>
#include <dm/device_compat.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++) { for (i = 0; i < ehdr->e_phnum; i++, phdr++) {
void *dst = (void *)(uintptr_t)phdr->p_paddr; void *dst = (void *)(uintptr_t)phdr->p_paddr;
void *src = (void *)addr + phdr->p_offset; void *src = (void *)addr + phdr->p_offset;
ulong dst_addr;
if (phdr->p_type != PT_LOAD) if (phdr->p_type != PT_LOAD)
continue; 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) if (phdr->p_filesz != phdr->p_memsz)
memset(dst + phdr->p_filesz, 0x00, memset(dst + phdr->p_filesz, 0x00,
phdr->p_memsz - phdr->p_filesz); phdr->p_memsz - phdr->p_filesz);
flush_cache(rounddown((unsigned long)dst, ARCH_DMA_MINALIGN), dst_addr = map_to_sysmem(dst);
roundup((unsigned long)dst + phdr->p_filesz, flush_cache(rounddown(dst_addr, ARCH_DMA_MINALIGN),
roundup(dst_addr + phdr->p_filesz,
ARCH_DMA_MINALIGN) - ARCH_DMA_MINALIGN) -
rounddown((unsigned long)dst, ARCH_DMA_MINALIGN)); rounddown(dst_addr, ARCH_DMA_MINALIGN));
} }
return 0; return 0;
@ -377,6 +380,7 @@ int rproc_elf32_load_rsc_table(struct udevice *dev, ulong fw_addr,
const struct dm_rproc_ops *ops; const struct dm_rproc_ops *ops;
Elf32_Shdr *shdr; Elf32_Shdr *shdr;
void *src, *dst; void *src, *dst;
ulong dst_addr;
shdr = rproc_elf32_find_rsc_table(dev, fw_addr, fw_size); shdr = rproc_elf32_find_rsc_table(dev, fw_addr, fw_size);
if (!shdr) if (!shdr)
@ -398,10 +402,10 @@ int rproc_elf32_load_rsc_table(struct udevice *dev, ulong fw_addr,
(ulong)dst, *rsc_size); (ulong)dst, *rsc_size);
memcpy(dst, src, *rsc_size); memcpy(dst, src, *rsc_size);
flush_cache(rounddown((unsigned long)dst, ARCH_DMA_MINALIGN), dst_addr = map_to_sysmem(dst);
roundup((unsigned long)dst + *rsc_size, flush_cache(rounddown(dst_addr, ARCH_DMA_MINALIGN),
ARCH_DMA_MINALIGN) - roundup(dst_addr + *rsc_size, ARCH_DMA_MINALIGN) -
rounddown((unsigned long)dst, ARCH_DMA_MINALIGN)); rounddown(dst_addr, ARCH_DMA_MINALIGN));
return 0; return 0;
} }

View file

@ -13,6 +13,7 @@
#include <efi_loader.h> #include <efi_loader.h>
#include <log.h> #include <log.h>
#include <malloc.h> #include <malloc.h>
#include <mapmem.h>
#include <pe.h> #include <pe.h>
#include <sort.h> #include <sort.h>
#include <crypto/mscode.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 */
flush_cache((ulong)efi_reloc, flush_cache(map_to_sysmem(efi_reloc),
ALIGN(virt_size, EFI_CACHELINE_SIZE)); ALIGN(virt_size, EFI_CACHELINE_SIZE));
/* /*

View file

@ -241,7 +241,7 @@ COMMON_TEST(print_display_buffer, UTF_CONSOLE);
static int print_hexdump_line(struct unit_test_state *uts) static int print_hexdump_line(struct unit_test_state *uts)
{ {
char *linebuf; u8 *linebuf;
u8 *buf; u8 *buf;
int i; int i;
@ -254,10 +254,10 @@ static int print_hexdump_line(struct unit_test_state *uts)
linebuf = map_sysmem(0x400, BUF_SIZE); linebuf = map_sysmem(0x400, BUF_SIZE);
memset(linebuf, '\xff', BUF_SIZE); memset(linebuf, '\xff', BUF_SIZE);
ut_asserteq(-ENOSPC, hexdump_line(0, buf, 1, 0x10, 0, linebuf, 75)); 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(0x10, hexdump_line(0, buf, 1, 0x10, 0, linebuf, 76));
ut_asserteq(0, linebuf[75]); ut_asserteq('\0', linebuf[75]);
ut_asserteq(-1, linebuf[76]); ut_asserteq(0xff, linebuf[76]);
unmap_sysmem(buf); unmap_sysmem(buf);

Binary file not shown.

View file

@ -6,33 +6,58 @@ FROM ubuntu:jammy-20240808
LABEL org.opencontainers.image.authors="Tom Rini <trini@konsulko.com>" 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" LABEL org.opencontainers.image.description=" This image is for building U-Boot inside a container"
# 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
# Make sure apt is happy # Make sure apt is happy
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# Set architectures to build for (leaving out ARM which is an exception)
ENV ARCHS="aarch64 arc i386 m68k mips microblaze nios2 powerpc riscv64 riscv32 sh2 x86_64"
# Mirror containing the toolchains
ENV MIRROR=https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin
# Toolchain version
ENV TCVER=13.2.0
RUN echo "Building on $BUILDPLATFORM, for target $TARGETPLATFORM"
# Add LLVM repository # Add LLVM repository
RUN apt-get update && apt-get install -y gnupg2 wget xz-utils && rm -rf /var/lib/apt/lists/* 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 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-17 main | tee /etc/apt/sources.list.d/llvm.list
# Manually install the kernel.org "Crosstool" based toolchains for gcc-13.2.0 # Create a list of URLs to process, then pass them into a 'while read' loop
RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-aarch64-linux.tar.xz | tar -C /opt -xJ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then HOSTARCH=x86_64; else HOSTARCH=arm64; fi; ( \
RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-arc-linux.tar.xz | tar -C /opt -xJ # Manually install the kernel.org "Crosstool"-based toolchains
RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-arm-linux-gnueabi.tar.xz | tar -C /opt -xJ for arch in $ARCHS; do \
RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-i386-linux.tar.xz | tar -C /opt -xJ echo $MIRROR/$HOSTARCH/$TCVER/${HOSTARCH}-gcc-$TCVER-nolibc-${arch}-linux.tar.xz; \
RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-m68k-linux.tar.xz | tar -C /opt -xJ done; \
RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-mips-linux.tar.xz | tar -C /opt -xJ \
RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-microblaze-linux.tar.xz | tar -C /opt -xJ # Deal with ARM, which has a 'gnueabi' suffix
RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-nios2-linux.tar.xz | tar -C /opt -xJ echo $MIRROR/${HOSTARCH}/$TCVER/${HOSTARCH}-gcc-$TCVER-nolibc-arm-linux-gnueabi.tar.xz; \
RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-powerpc-linux.tar.xz | tar -C /opt -xJ \
RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-riscv64-linux.tar.xz | tar -C /opt -xJ ) | while read url; do \
RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-riscv32-linux.tar.xz | tar -C /opt -xJ # Read the URL and unpack it into /opt
RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-sh2-linux.tar.xz | tar -C /opt -xJ wget -O - $url | tar -C /opt -xJ; \
done
# Manually install other toolchains # Manually install other toolchains
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 RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
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; \
fi
# Update and install things from apt now # Update and install things from apt now
RUN apt-get update && apt-get install -y \ 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 \
automake \ automake \
autopoint \ autopoint \
bc \ bc \
@ -54,17 +79,15 @@ RUN apt-get update && apt-get install -y \
flex \ flex \
gawk \ gawk \
gdisk \ gdisk \
gettext \
git \ git \
gnu-efi \ gnu-efi \
gnutls-dev \ gnutls-dev \
graphviz \ graphviz \
grub-efi-amd64-bin \
grub-efi-ia32-bin \
help2man \ help2man \
iasl \ iasl \
imagemagick \ imagemagick \
iputils-ping \ iputils-ping \
libc6-i386 \
libconfuse-dev \ libconfuse-dev \
libgit2-dev \ libgit2-dev \
libjson-glib-dev \ libjson-glib-dev \
@ -82,7 +105,7 @@ RUN apt-get update && apt-get install -y \
libtool \ libtool \
libudev-dev \ libudev-dev \
libusb-1.0-0-dev \ libusb-1.0-0-dev \
linux-image-kvm \ linux-image-generic \
lzma-alone \ lzma-alone \
lzop \ lzop \
mount \ mount \
@ -118,8 +141,7 @@ RUN apt-get update && apt-get install -y \
vboot-utils \ vboot-utils \
xilinx-bootgen \ xilinx-bootgen \
xxd \ xxd \
zip \ zip
&& rm -rf /var/lib/apt/lists/*
# Make kernels readable for libguestfs tools to work correctly # Make kernels readable for libguestfs tools to work correctly
RUN chmod +r /boot/vmlinu* RUN chmod +r /boot/vmlinu*
@ -127,11 +149,9 @@ RUN chmod +r /boot/vmlinu*
# Build GRUB UEFI targets for ARM & RISC-V, 32-bit and 64-bit # 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 && \ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
cd /tmp/grub && \ cd /tmp/grub && \
git checkout grub-2.06 && \ git checkout grub-2.12 && \
git config --global user.name "GitLab CI Runner" && \ git config --global user.name "GitLab CI Runner" && \
git config --global user.email trini@konsulko.com && \ git config --global user.email trini@konsulko.com && \
git cherry-pick 049efdd72eb7baa7b2bf8884391ee7fe650da5a0 && \
git cherry-pick 403d6540cd608b2706cfa0cb4713f7e4b490ff45 && \
./bootstrap && \ ./bootstrap && \
mkdir -p /opt/grub && \ mkdir -p /opt/grub && \
./configure --target=aarch64 --with-platform=efi \ ./configure --target=aarch64 --with-platform=efi \
@ -141,7 +161,7 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
TARGET_STRIP=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-strip \ TARGET_STRIP=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-strip \
TARGET_NM=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-nm \ TARGET_NM=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-nm \
TARGET_RANLIB=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-ranlib && \ TARGET_RANLIB=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-ranlib && \
make && \ make -j$(nproc) && \
./grub-mkimage -O arm64-efi -o /opt/grub/grubaa64.efi --prefix= -d \ ./grub-mkimage -O arm64-efi -o /opt/grub/grubaa64.efi --prefix= -d \
grub-core cat chain configfile echo efinet ext2 fat halt help linux \ grub-core cat chain configfile echo efinet ext2 fat halt help linux \
lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \ lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \
@ -155,7 +175,7 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
TARGET_STRIP=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-strip \ TARGET_STRIP=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-strip \
TARGET_NM=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-nm \ TARGET_NM=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-nm \
TARGET_RANLIB=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ranlib && \ TARGET_RANLIB=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ranlib && \
make && \ make -j$(nproc) && \
./grub-mkimage -O arm-efi -o /opt/grub/grubarm.efi --prefix= -d \ ./grub-mkimage -O arm-efi -o /opt/grub/grubarm.efi --prefix= -d \
grub-core cat chain configfile echo efinet ext2 fat halt help linux \ grub-core cat chain configfile echo efinet ext2 fat halt help linux \
lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \ lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \
@ -169,12 +189,34 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
TARGET_STRIP=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-strip \ TARGET_STRIP=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-strip \
TARGET_NM=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-nm \ TARGET_NM=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-nm \
TARGET_RANLIB=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-ranlib && \ TARGET_RANLIB=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-ranlib && \
make && \ make -j$(nproc) && \
./grub-mkimage -O riscv64-efi -o /opt/grub/grubriscv64.efi --prefix= -d \ ./grub-mkimage -O riscv64-efi -o /opt/grub/grubriscv64.efi --prefix= -d \
grub-core cat chain configfile echo efinet ext2 fat halt help linux \ grub-core cat chain configfile echo efinet ext2 fat halt help linux \
lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \ lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \
search search_fs_file search_fs_uuid search_label serial sleep test \ search search_fs_file search_fs_uuid search_label serial sleep test \
true && \ true && \
make clean && \
./configure --target=i386 --with-platform=efi \
CC=gcc \
TARGET_CC=/opt/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-gcc \
TARGET_OBJCOPY=/opt/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-objcopy \
TARGET_STRIP=/opt/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-strip \
TARGET_NM=/opt/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-nm \
TARGET_RANLIB=/opt/gcc-13.2.0-nolibc/i386-linux/bin/i386-linux-ranlib && \
make -j$(nproc) && \
./grub-mkimage -O i386-efi -o /opt/grub/grub_x86.efi --prefix= -d \
grub-core normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd && \
make clean && \
./configure --target=x86_64 --with-platform=efi \
CC=gcc \
TARGET_CC=/opt/gcc-13.2.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc \
TARGET_OBJCOPY=/opt/gcc-13.2.0-nolibc/x86_64-linux/bin/x86_64-linux-objcopy \
TARGET_STRIP=/opt/gcc-13.2.0-nolibc/x86_64-linux/bin/x86_64-linux-strip \
TARGET_NM=/opt/gcc-13.2.0-nolibc/x86_64-linux/bin/x86_64-linux-nm \
TARGET_RANLIB=/opt/gcc-13.2.0-nolibc/x86_64-linux/bin/x86_64-linux-ranlib && \
make -j$(nproc) && \
./grub-mkimage -O x86_64-efi -o /opt/grub/grub_x64.efi --prefix= -d \
grub-core normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd && \
rm -rf /tmp/grub rm -rf /tmp/grub
RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \
@ -195,7 +237,7 @@ RUN git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git /tmp/t
cd /tmp/tf-a/ && \ cd /tmp/tf-a/ && \
git checkout v2.10.0 && \ git checkout v2.10.0 && \
cd tools/fiptool && \ cd tools/fiptool && \
make && \ make -j$(nproc) && \
mkdir -p /usr/local/bin && \ mkdir -p /usr/local/bin && \
cp fiptool /usr/local/bin && \ cp fiptool /usr/local/bin && \
rm -rf /tmp/tf-a rm -rf /tmp/tf-a
@ -280,9 +322,8 @@ RUN /bin/echo -e "[toolchain]\nroot = /usr" > ~/.buildman
RUN /bin/echo -e "kernelorg = /opt/gcc-13.2.0-nolibc/*" >> ~/.buildman RUN /bin/echo -e "kernelorg = /opt/gcc-13.2.0-nolibc/*" >> ~/.buildman
RUN /bin/echo -e "\n[toolchain-prefix]\nxtensa = /opt/2020.07/xtensa-dc233c-elf/bin/xtensa-dc233c-elf-" >> ~/.buildman; RUN /bin/echo -e "\n[toolchain-prefix]\nxtensa = /opt/2020.07/xtensa-dc233c-elf/bin/xtensa-dc233c-elf-" >> ~/.buildman;
RUN /bin/echo -e "\n[toolchain-alias]\nsh = sh2" >> ~/.buildman RUN /bin/echo -e "\n[toolchain-alias]\nsh = sh2" >> ~/.buildman
RUN /bin/echo -e "\nsandbox = x86_64" >> ~/.buildman
RUN /bin/echo -e "\nx86 = i386" >> ~/.buildman; RUN /bin/echo -e "\nx86 = i386" >> ~/.buildman;
# Add mkbootimg tool # Add mkbootimg tool
RUN git clone https://android.googlesource.com/platform/system/tools/mkbootimg /home/uboot/mkbootimg 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"