Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0+ |
| 2 | # This Dockerfile is used to build an image containing basic stuff to be used |
| 3 | # to build U-Boot and run our test suites. |
| 4 | |
Tom Rini | eed9e69 | 2025-04-10 09:15:05 -0600 | [diff] [blame] | 5 | FROM ubuntu:jammy-20250404 |
Tom Rini | 92160da | 2024-08-19 15:07:19 -0600 | [diff] [blame] | 6 | LABEL org.opencontainers.image.authors="Tom Rini <trini@konsulko.com>" |
| 7 | LABEL org.opencontainers.image.description=" This image is for building U-Boot inside a container" |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 8 | |
Simon Glass | 7aafac0 | 2024-11-27 11:17:26 -0600 | [diff] [blame] | 9 | # Used by docker to set the target platform: valid values are linux/arm64/v8 |
| 10 | # and linux/amd64 |
| 11 | ARG TARGETPLATFORM |
| 12 | |
| 13 | # Used by docker to set the build platform: the only valid value is linux/amd64 |
| 14 | ARG BUILDPLATFORM |
| 15 | |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 16 | # Make sure apt is happy |
| 17 | ENV DEBIAN_FRONTEND=noninteractive |
| 18 | |
Simon Glass | ef4ca58 | 2024-11-27 11:17:29 -0600 | [diff] [blame] | 19 | # Set architectures to build for (leaving out ARM which is an exception) |
| 20 | ENV ARCHS="aarch64 arc i386 m68k mips microblaze nios2 powerpc riscv64 riscv32 sh2 x86_64" |
| 21 | |
| 22 | # Mirror containing the toolchains |
| 23 | ENV MIRROR=https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin |
| 24 | |
| 25 | # Toolchain version |
Tom Rini | b76fa13 | 2025-01-28 17:02:05 -0600 | [diff] [blame] | 26 | ENV TCVER=14.2.0 |
Simon Glass | ef4ca58 | 2024-11-27 11:17:29 -0600 | [diff] [blame] | 27 | |
Simon Glass | 7aafac0 | 2024-11-27 11:17:26 -0600 | [diff] [blame] | 28 | RUN echo "Building on $BUILDPLATFORM, for target $TARGETPLATFORM" |
| 29 | |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 30 | # Add LLVM repository |
Tom Rini | 3f88c79 | 2024-11-27 11:17:25 -0600 | [diff] [blame] | 31 | RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ |
| 32 | --mount=type=cache,target=/var/lib/apt,sharing=locked \ |
| 33 | apt-get update && apt-get install -y gnupg2 wget xz-utils |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 34 | RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - |
Tom Rini | b76fa13 | 2025-01-28 17:02:05 -0600 | [diff] [blame] | 35 | RUN echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main | tee /etc/apt/sources.list.d/llvm.list |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 36 | |
Simon Glass | ef4ca58 | 2024-11-27 11:17:29 -0600 | [diff] [blame] | 37 | # Create a list of URLs to process, then pass them into a 'while read' loop |
| 38 | RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then HOSTARCH=x86_64; else HOSTARCH=arm64; fi; ( \ |
| 39 | # Manually install the kernel.org "Crosstool"-based toolchains |
| 40 | for arch in $ARCHS; do \ |
| 41 | echo $MIRROR/$HOSTARCH/$TCVER/${HOSTARCH}-gcc-$TCVER-nolibc-${arch}-linux.tar.xz; \ |
| 42 | done; \ |
| 43 | \ |
| 44 | # Deal with ARM, which has a 'gnueabi' suffix |
| 45 | echo $MIRROR/${HOSTARCH}/$TCVER/${HOSTARCH}-gcc-$TCVER-nolibc-arm-linux-gnueabi.tar.xz; \ |
| 46 | \ |
| 47 | ) | while read url; do \ |
| 48 | # Read the URL and unpack it into /opt |
| 49 | wget -O - $url | tar -C /opt -xJ; \ |
| 50 | done |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 51 | |
| 52 | # Manually install other toolchains |
Simon Glass | ef4ca58 | 2024-11-27 11:17:29 -0600 | [diff] [blame] | 53 | RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ |
| 54 | 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; \ |
| 55 | fi |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 56 | |
| 57 | # Update and install things from apt now |
Tom Rini | 3f88c79 | 2024-11-27 11:17:25 -0600 | [diff] [blame] | 58 | RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ |
| 59 | --mount=type=cache,target=/var/lib/apt,sharing=locked \ |
| 60 | apt-get update && apt-get install -y \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 61 | automake \ |
| 62 | autopoint \ |
| 63 | bc \ |
| 64 | binutils-dev \ |
| 65 | bison \ |
| 66 | build-essential \ |
Leonard Anderweit | 8957b2e | 2025-04-01 10:46:41 +0200 | [diff] [blame] | 67 | byacc \ |
Simon Glass | be17cb3 | 2023-08-24 13:55:46 -0600 | [diff] [blame] | 68 | cgpt \ |
Tom Rini | b76fa13 | 2025-01-28 17:02:05 -0600 | [diff] [blame] | 69 | clang-18 \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 70 | coreutils \ |
| 71 | cpio \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 72 | curl \ |
| 73 | device-tree-compiler \ |
| 74 | dosfstools \ |
| 75 | e2fsprogs \ |
| 76 | efitools \ |
Huang Jianan | 11e0443 | 2022-02-26 15:05:51 +0800 | [diff] [blame] | 77 | erofs-utils \ |
Marek Vasut | 60b8367 | 2025-03-17 04:12:50 +0100 | [diff] [blame] | 78 | exfatprogs \ |
Heinrich Schuchardt | 4e20267 | 2021-11-09 19:51:20 +0100 | [diff] [blame] | 79 | expect \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 80 | fakeroot \ |
Tom Rini | 4da79d4 | 2025-04-10 10:54:03 -0600 | [diff] [blame] | 81 | fdisk \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 82 | flex \ |
Heinrich Schuchardt | 4e20267 | 2021-11-09 19:51:20 +0100 | [diff] [blame] | 83 | gawk \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 84 | gdisk \ |
Tom Rini | 12248ed | 2024-11-27 11:17:23 -0600 | [diff] [blame] | 85 | gettext \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 86 | git \ |
| 87 | gnu-efi \ |
Heinrich Schuchardt | 4e20267 | 2021-11-09 19:51:20 +0100 | [diff] [blame] | 88 | gnutls-dev \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 89 | graphviz \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 90 | help2man \ |
| 91 | iasl \ |
| 92 | imagemagick \ |
| 93 | iputils-ping \ |
Bin Meng | f551a53 | 2021-08-26 23:33:33 +0800 | [diff] [blame] | 94 | libconfuse-dev \ |
Tom Rini | c8982d2 | 2021-06-10 10:57:36 -0400 | [diff] [blame] | 95 | libgit2-dev \ |
Heinrich Schuchardt | 4e20267 | 2021-11-09 19:51:20 +0100 | [diff] [blame] | 96 | libjson-glib-dev \ |
AKASHI Takahiro | 3edc347 | 2022-02-01 10:32:36 +0900 | [diff] [blame] | 97 | libgnutls28-dev \ |
| 98 | libgnutls30 \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 99 | liblz4-tool \ |
| 100 | libpixman-1-dev \ |
Tom Rini | c8982d2 | 2021-06-10 10:57:36 -0400 | [diff] [blame] | 101 | libpython3-dev \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 102 | libsdl1.2-dev \ |
| 103 | libsdl2-dev \ |
Heinrich Schuchardt | 4e20267 | 2021-11-09 19:51:20 +0100 | [diff] [blame] | 104 | libseccomp-dev \ |
Tom Rini | 83da232 | 2023-07-13 10:16:28 -0400 | [diff] [blame] | 105 | libslirp-dev \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 106 | libssl-dev \ |
Heinrich Schuchardt | 4e20267 | 2021-11-09 19:51:20 +0100 | [diff] [blame] | 107 | libtool \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 108 | libudev-dev \ |
| 109 | libusb-1.0-0-dev \ |
| 110 | lzma-alone \ |
| 111 | lzop \ |
| 112 | mount \ |
| 113 | mtd-utils \ |
| 114 | mtools \ |
Heinrich Schuchardt | 4e20267 | 2021-11-09 19:51:20 +0100 | [diff] [blame] | 115 | net-tools \ |
Bin Meng | 00afccd | 2021-08-26 23:33:32 +0800 | [diff] [blame] | 116 | ninja-build \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 117 | openssl \ |
| 118 | picocom \ |
| 119 | parted \ |
| 120 | pkg-config \ |
Tom Rini | c8982d2 | 2021-06-10 10:57:36 -0400 | [diff] [blame] | 121 | python-is-python3 \ |
| 122 | python2.7 \ |
| 123 | python3 \ |
| 124 | python3-dev \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 125 | python3-pip \ |
| 126 | python3-sphinx \ |
Tom Rini | c8982d2 | 2021-06-10 10:57:36 -0400 | [diff] [blame] | 127 | python3-virtualenv \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 128 | rpm2cpio \ |
| 129 | sbsigntool \ |
Heinrich Schuchardt | 4e20267 | 2021-11-09 19:51:20 +0100 | [diff] [blame] | 130 | socat \ |
| 131 | softhsm2 \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 132 | sparse \ |
| 133 | srecord \ |
| 134 | sudo \ |
| 135 | swig \ |
Heinrich Schuchardt | c2c98ea | 2022-12-30 05:41:01 +0100 | [diff] [blame] | 136 | texinfo \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 137 | util-linux \ |
| 138 | uuid-dev \ |
| 139 | virtualenv \ |
Simon Glass | be17cb3 | 2023-08-24 13:55:46 -0600 | [diff] [blame] | 140 | vboot-kernel-utils \ |
| 141 | vboot-utils \ |
Heinrich Schuchardt | 905d075 | 2024-02-28 08:23:09 +0100 | [diff] [blame] | 142 | xilinx-bootgen \ |
Tom Rini | 0a78bc3 | 2021-07-02 10:41:58 -0400 | [diff] [blame] | 143 | xxd \ |
Tom Rini | 3f88c79 | 2024-11-27 11:17:25 -0600 | [diff] [blame] | 144 | zip |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 145 | |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 146 | # Build GRUB UEFI targets for ARM & RISC-V, 32-bit and 64-bit |
| 147 | RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \ |
| 148 | cd /tmp/grub && \ |
Tom Rini | 12248ed | 2024-11-27 11:17:23 -0600 | [diff] [blame] | 149 | git checkout grub-2.12 && \ |
Tom Rini | 77d48f1 | 2022-11-22 12:31:58 -0500 | [diff] [blame] | 150 | git config --global user.name "GitLab CI Runner" && \ |
| 151 | git config --global user.email trini@konsulko.com && \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 152 | ./bootstrap && \ |
| 153 | mkdir -p /opt/grub && \ |
| 154 | ./configure --target=aarch64 --with-platform=efi \ |
| 155 | CC=gcc \ |
Tom Rini | 6934988 | 2024-12-08 11:07:25 -0600 | [diff] [blame] | 156 | TARGET_CC=/opt/gcc-${TCVER}-nolibc/aarch64-linux/bin/aarch64-linux-gcc \ |
| 157 | TARGET_OBJCOPY=/opt/gcc-${TCVER}-nolibc/aarch64-linux/bin/aarch64-linux-objcopy \ |
| 158 | TARGET_STRIP=/opt/gcc-${TCVER}-nolibc/aarch64-linux/bin/aarch64-linux-strip \ |
| 159 | TARGET_NM=/opt/gcc-${TCVER}-nolibc/aarch64-linux/bin/aarch64-linux-nm \ |
| 160 | TARGET_RANLIB=/opt/gcc-${TCVER}-nolibc/aarch64-linux/bin/aarch64-linux-ranlib && \ |
Tom Rini | 4bac039 | 2024-11-27 11:17:22 -0600 | [diff] [blame] | 161 | make -j$(nproc) && \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 162 | ./grub-mkimage -O arm64-efi -o /opt/grub/grubaa64.efi --prefix= -d \ |
| 163 | grub-core cat chain configfile echo efinet ext2 fat halt help linux \ |
| 164 | lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \ |
| 165 | search search_fs_file search_fs_uuid search_label serial sleep test \ |
| 166 | true && \ |
| 167 | make clean && \ |
| 168 | ./configure --target=arm --with-platform=efi \ |
| 169 | CC=gcc \ |
Tom Rini | 6934988 | 2024-12-08 11:07:25 -0600 | [diff] [blame] | 170 | TARGET_CC=/opt/gcc-${TCVER}-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc \ |
| 171 | TARGET_OBJCOPY=/opt/gcc-${TCVER}-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-objcopy \ |
| 172 | TARGET_STRIP=/opt/gcc-${TCVER}-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-strip \ |
| 173 | TARGET_NM=/opt/gcc-${TCVER}-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-nm \ |
| 174 | TARGET_RANLIB=/opt/gcc-${TCVER}-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ranlib && \ |
Tom Rini | 4bac039 | 2024-11-27 11:17:22 -0600 | [diff] [blame] | 175 | make -j$(nproc) && \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 176 | ./grub-mkimage -O arm-efi -o /opt/grub/grubarm.efi --prefix= -d \ |
| 177 | grub-core cat chain configfile echo efinet ext2 fat halt help linux \ |
| 178 | lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \ |
| 179 | search search_fs_file search_fs_uuid search_label serial sleep test \ |
| 180 | true && \ |
| 181 | make clean && \ |
Tom Rini | b76fa13 | 2025-01-28 17:02:05 -0600 | [diff] [blame] | 182 | grub_cv_cc_mcmodel=no ./configure --target=riscv64 --with-platform=efi \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 183 | CC=gcc \ |
Tom Rini | 6934988 | 2024-12-08 11:07:25 -0600 | [diff] [blame] | 184 | TARGET_CC=/opt/gcc-${TCVER}-nolibc/riscv64-linux/bin/riscv64-linux-gcc \ |
| 185 | TARGET_OBJCOPY=/opt/gcc-${TCVER}-nolibc/riscv64-linux/bin/riscv64-linux-objcopy \ |
| 186 | TARGET_STRIP=/opt/gcc-${TCVER}-nolibc/riscv64-linux/bin/riscv64-linux-strip \ |
| 187 | TARGET_NM=/opt/gcc-${TCVER}-nolibc/riscv64-linux/bin/riscv64-linux-nm \ |
| 188 | TARGET_RANLIB=/opt/gcc-${TCVER}-nolibc/riscv64-linux/bin/riscv64-linux-ranlib && \ |
Tom Rini | 4bac039 | 2024-11-27 11:17:22 -0600 | [diff] [blame] | 189 | make -j$(nproc) && \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 190 | ./grub-mkimage -O riscv64-efi -o /opt/grub/grubriscv64.efi --prefix= -d \ |
| 191 | grub-core cat chain configfile echo efinet ext2 fat halt help linux \ |
| 192 | lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \ |
| 193 | search search_fs_file search_fs_uuid search_label serial sleep test \ |
| 194 | true && \ |
Tom Rini | e8403a9 | 2024-11-27 11:17:24 -0600 | [diff] [blame] | 195 | make clean && \ |
| 196 | ./configure --target=i386 --with-platform=efi \ |
| 197 | CC=gcc \ |
Tom Rini | 6934988 | 2024-12-08 11:07:25 -0600 | [diff] [blame] | 198 | TARGET_CC=/opt/gcc-${TCVER}-nolibc/i386-linux/bin/i386-linux-gcc \ |
| 199 | TARGET_OBJCOPY=/opt/gcc-${TCVER}-nolibc/i386-linux/bin/i386-linux-objcopy \ |
| 200 | TARGET_STRIP=/opt/gcc-${TCVER}-nolibc/i386-linux/bin/i386-linux-strip \ |
| 201 | TARGET_NM=/opt/gcc-${TCVER}-nolibc/i386-linux/bin/i386-linux-nm \ |
| 202 | TARGET_RANLIB=/opt/gcc-${TCVER}-nolibc/i386-linux/bin/i386-linux-ranlib && \ |
Tom Rini | e8403a9 | 2024-11-27 11:17:24 -0600 | [diff] [blame] | 203 | make -j$(nproc) && \ |
| 204 | ./grub-mkimage -O i386-efi -o /opt/grub/grub_x86.efi --prefix= -d \ |
| 205 | grub-core normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd && \ |
| 206 | make clean && \ |
| 207 | ./configure --target=x86_64 --with-platform=efi \ |
| 208 | CC=gcc \ |
Tom Rini | 6934988 | 2024-12-08 11:07:25 -0600 | [diff] [blame] | 209 | TARGET_CC=/opt/gcc-${TCVER}-nolibc/x86_64-linux/bin/x86_64-linux-gcc \ |
| 210 | TARGET_OBJCOPY=/opt/gcc-${TCVER}-nolibc/x86_64-linux/bin/x86_64-linux-objcopy \ |
| 211 | TARGET_STRIP=/opt/gcc-${TCVER}-nolibc/x86_64-linux/bin/x86_64-linux-strip \ |
| 212 | TARGET_NM=/opt/gcc-${TCVER}-nolibc/x86_64-linux/bin/x86_64-linux-nm \ |
| 213 | TARGET_RANLIB=/opt/gcc-${TCVER}-nolibc/x86_64-linux/bin/x86_64-linux-ranlib && \ |
Tom Rini | e8403a9 | 2024-11-27 11:17:24 -0600 | [diff] [blame] | 214 | make -j$(nproc) && \ |
| 215 | ./grub-mkimage -O x86_64-efi -o /opt/grub/grub_x64.efi --prefix= -d \ |
| 216 | grub-core normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd && \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 217 | rm -rf /tmp/grub |
| 218 | |
Tom Rini | b60c1d7 | 2023-02-07 12:50:13 -0500 | [diff] [blame] | 219 | RUN git clone https://gitlab.com/qemu-project/qemu.git /tmp/qemu && \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 220 | cd /tmp/qemu && \ |
Heinrich Schuchardt | 24069c2 | 2024-01-12 03:17:57 +0100 | [diff] [blame] | 221 | git checkout v8.2.0 && \ |
Bin Meng | 00afccd | 2021-08-26 23:33:32 +0800 | [diff] [blame] | 222 | # config user.name and user.email to make 'git am' happy |
| 223 | git config user.name u-boot && \ |
| 224 | git config user.email u-boot@denx.de && \ |
Heinrich Schuchardt | 24069c2 | 2024-01-12 03:17:57 +0100 | [diff] [blame] | 225 | git format-patch 0c7ffc977195~..0c7ffc977195 && \ |
| 226 | git am 0001-hw-net-cadence_gem-Fix-MDIO_OP_xxx-values.patch && \ |
Tom Rini | 139e995 | 2024-03-11 10:02:43 -0400 | [diff] [blame] | 227 | git cherry-pick d3c79c3974 && \ |
Tom Rini | 26a4183 | 2023-03-21 15:28:00 -0400 | [diff] [blame] | 228 | ./configure --prefix=/opt/qemu --target-list="aarch64-softmmu,arm-softmmu,i386-softmmu,m68k-softmmu,mips-softmmu,mips64-softmmu,mips64el-softmmu,mipsel-softmmu,ppc-softmmu,riscv32-softmmu,riscv64-softmmu,sh4-softmmu,x86_64-softmmu,xtensa-softmmu" && \ |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 229 | make -j$(nproc) all install && \ |
| 230 | rm -rf /tmp/qemu |
| 231 | |
Heinrich Schuchardt | 2b4a656 | 2024-02-28 08:43:11 +0100 | [diff] [blame] | 232 | # Build fiptool |
| 233 | RUN git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git /tmp/tf-a && \ |
| 234 | cd /tmp/tf-a/ && \ |
Tom Rini | f1210b1 | 2025-04-08 14:21:40 -0600 | [diff] [blame] | 235 | git checkout v2.12.0 && \ |
Heinrich Schuchardt | 2b4a656 | 2024-02-28 08:43:11 +0100 | [diff] [blame] | 236 | cd tools/fiptool && \ |
Tom Rini | 4bac039 | 2024-11-27 11:17:22 -0600 | [diff] [blame] | 237 | make -j$(nproc) && \ |
Heinrich Schuchardt | 2b4a656 | 2024-02-28 08:43:11 +0100 | [diff] [blame] | 238 | mkdir -p /usr/local/bin && \ |
| 239 | cp fiptool /usr/local/bin && \ |
| 240 | rm -rf /tmp/tf-a |
| 241 | |
Tom Rini | 2182c48 | 2025-04-08 14:21:41 -0600 | [diff] [blame] | 242 | # Download the Arm Architecture FVP platform. This file is double compressed. |
| 243 | RUN wget -O - https://developer.arm.com/-/cdn-downloads/permalink/FVPs-Architecture/FM-11.28/FVP_Base_RevC-2xAEMvA_11.28_23_Linux64.tgz | gunzip -dc | tar -C /opt -x |
| 244 | |
Bin Meng | f551a53 | 2021-08-26 23:33:33 +0800 | [diff] [blame] | 245 | # Build genimage (required by some targets to generate disk images) |
| 246 | RUN wget -O - https://github.com/pengutronix/genimage/releases/download/v14/genimage-14.tar.xz | tar -C /tmp -xJ && \ |
| 247 | cd /tmp/genimage-14 && \ |
| 248 | ./configure && \ |
| 249 | make -j$(nproc) && \ |
| 250 | make install && \ |
| 251 | rm -rf /tmp/genimage-14 |
| 252 | |
Heinrich Schuchardt | 4e20267 | 2021-11-09 19:51:20 +0100 | [diff] [blame] | 253 | # Build libtpms |
| 254 | RUN git clone https://github.com/stefanberger/libtpms /tmp/libtpms && \ |
| 255 | cd /tmp/libtpms && \ |
| 256 | ./autogen.sh && \ |
| 257 | ./configure && \ |
| 258 | make -j$(nproc) && \ |
| 259 | make install && \ |
| 260 | ldconfig && \ |
| 261 | rm -rf /tmp/libtpms |
| 262 | |
| 263 | # Build swtpm |
| 264 | RUN git clone https://github.com/stefanberger/swtpm /tmp/swtpm && \ |
| 265 | cd /tmp/swtpm && \ |
| 266 | ./autogen.sh && \ |
| 267 | ./configure && \ |
| 268 | make -j$(nproc) && \ |
| 269 | make install && \ |
| 270 | rm -rf /tmp/swtpm |
| 271 | |
Simon Glass | 523cb6d | 2023-01-15 14:15:59 -0700 | [diff] [blame] | 272 | # Build trace-cmd |
| 273 | RUN mkdir /tmp/trace && \ |
| 274 | git clone https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git /tmp/trace/libtraceevent && \ |
| 275 | cd /tmp/trace/libtraceevent && \ |
| 276 | make -j$(nproc) && \ |
| 277 | sudo make install && \ |
| 278 | git clone https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git /tmp/trace/libtracefs && \ |
| 279 | cd /tmp/trace/libtracefs && \ |
| 280 | make -j$(nproc) && \ |
| 281 | sudo make install && \ |
| 282 | git clone https://github.com/rostedt/trace-cmd.git /tmp/trace/trace-cmd && \ |
| 283 | cd /tmp/trace/trace-cmd && \ |
| 284 | make -j$(nproc) && \ |
| 285 | sudo make install && \ |
| 286 | rm -rf /tmp/trace |
| 287 | |
Tom Rini | 9e2b09e | 2024-02-13 09:39:26 -0500 | [diff] [blame] | 288 | # Build coreboot |
Simon Glass | 78b9c8a | 2024-10-14 16:32:05 -0600 | [diff] [blame] | 289 | RUN wget -O - https://coreboot.org/releases/coreboot-24.08.tar.xz | tar -C /tmp -xJ && \ |
| 290 | cd /tmp/coreboot-24.08 && \ |
Tom Rini | 9e2b09e | 2024-02-13 09:39:26 -0500 | [diff] [blame] | 291 | make crossgcc-i386 CPUS=$(nproc) && \ |
| 292 | make -C payloads/coreinfo olddefconfig && \ |
| 293 | make -C payloads/coreinfo && \ |
| 294 | make olddefconfig && \ |
Simon Glass | 78b9c8a | 2024-10-14 16:32:05 -0600 | [diff] [blame] | 295 | echo CONFIG_GENERIC_LINEAR_FRAMEBUFFER=y | tee -a .config && \ |
| 296 | echo CONFIG_USE_OPTION_TABLE=y | tee -a .config && \ |
| 297 | make olddefconfig && \ |
Tom Rini | 9e2b09e | 2024-02-13 09:39:26 -0500 | [diff] [blame] | 298 | make -j $(nproc) && \ |
| 299 | sudo mkdir /opt/coreboot && \ |
Tom Rini | 1994e54 | 2025-02-12 16:24:15 -0600 | [diff] [blame] | 300 | sudo cp build/coreboot.rom build/cbfstool /opt/coreboot/ && \ |
| 301 | rm -rf /tmp/coreboot-24.08 |
Tom Rini | 9e2b09e | 2024-02-13 09:39:26 -0500 | [diff] [blame] | 302 | |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 303 | # Create our user/group |
| 304 | RUN echo uboot ALL=NOPASSWD: ALL > /etc/sudoers.d/uboot |
| 305 | RUN useradd -m -U uboot |
| 306 | USER uboot:uboot |
| 307 | |
Tom Rini | 54573e0 | 2023-03-23 14:57:58 -0400 | [diff] [blame] | 308 | # Populate the cache for pip to use. Get these via wget as the |
| 309 | # COPY / ADD directives don't work as we need them to. |
| 310 | RUN wget -O /tmp/pytest-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/test/py/requirements.txt |
| 311 | RUN wget -O /tmp/sphinx-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/doc/sphinx/requirements.txt |
Tom Rini | 9a4b111 | 2025-02-04 17:12:09 -0600 | [diff] [blame] | 312 | RUN wget -O /tmp/binman-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/tools/binman/requirements.txt |
Tom Rini | 763160f | 2024-01-18 12:10:07 -0500 | [diff] [blame] | 313 | RUN wget -O /tmp/buildman-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/tools/buildman/requirements.txt |
Tom Rini | 9a4b111 | 2025-02-04 17:12:09 -0600 | [diff] [blame] | 314 | RUN wget -O /tmp/patman-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/tools/patman/requirements.txt |
| 315 | RUN wget -O /tmp/u_boot_pylib-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/tools/u_boot_pylib/requirements.txt |
Tom Rini | 54573e0 | 2023-03-23 14:57:58 -0400 | [diff] [blame] | 316 | RUN virtualenv -p /usr/bin/python3 /tmp/venv && \ |
| 317 | . /tmp/venv/bin/activate && \ |
| 318 | pip install -r /tmp/pytest-requirements.txt \ |
Tom Rini | 763160f | 2024-01-18 12:10:07 -0500 | [diff] [blame] | 319 | -r /tmp/sphinx-requirements.txt \ |
Tom Rini | 9a4b111 | 2025-02-04 17:12:09 -0600 | [diff] [blame] | 320 | -r /tmp/binman-requirements.txt \ |
| 321 | -r /tmp/buildman-requirements.txt \ |
| 322 | -r /tmp/patman-requirements.txt \ |
| 323 | -r /tmp/u_boot_pylib-requirements.txt && \ |
Tom Rini | 54573e0 | 2023-03-23 14:57:58 -0400 | [diff] [blame] | 324 | deactivate && \ |
Tom Rini | 763160f | 2024-01-18 12:10:07 -0500 | [diff] [blame] | 325 | rm -rf /tmp/venv /tmp/*-requirements.txt |
Tom Rini | 54573e0 | 2023-03-23 14:57:58 -0400 | [diff] [blame] | 326 | |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 327 | # Create the buildman config file |
Tom Rini | f1b9e2a | 2024-12-08 11:07:30 -0600 | [diff] [blame] | 328 | RUN /bin/echo -e "[toolchain]\nkernelorg = /opt/gcc-${TCVER}-nolibc/*" > ~/.buildman |
| 329 | RUN /bin/echo -e "root = /usr" >> ~/.buildman |
Tom Rini | 5d18a67 | 2024-12-08 11:07:24 -0600 | [diff] [blame] | 330 | RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ |
| 331 | /bin/echo -e "\n[toolchain-prefix]\nxtensa = /opt/2020.07/xtensa-dc233c-elf/bin/xtensa-dc233c-elf-" >> ~/.buildman; \ |
| 332 | fi |
Tom Rini | 64d3267 | 2024-12-08 11:07:29 -0600 | [diff] [blame] | 333 | RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ |
| 334 | /bin/echo -e "\n[toolchain-prefix]\naarch64 = /opt/gcc-${TCVER}-nolibc/aarch64-linux/bin/aarch64-linux-" >> ~/.buildman; \ |
| 335 | fi |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 336 | RUN /bin/echo -e "\n[toolchain-alias]\nsh = sh2" >> ~/.buildman |
Tom Rini | 04549e9 | 2021-03-15 13:19:01 -0400 | [diff] [blame] | 337 | RUN /bin/echo -e "\nx86 = i386" >> ~/.buildman; |
Safae Ouajih | aaa366f | 2023-02-06 00:50:21 +0100 | [diff] [blame] | 338 | |
| 339 | # Add mkbootimg tool |
| 340 | RUN git clone https://android.googlesource.com/platform/system/tools/mkbootimg /home/uboot/mkbootimg |
Simon Glass | f8e2012 | 2024-11-27 11:17:28 -0600 | [diff] [blame] | 341 | ENV PYTHONPATH="${PYTHONPATH}:/home/uboot/mkbootimg" |