]>
Commit | Line | Data |
---|---|---|
a6432254 TR |
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 | ||
85fd4898 | 5 | FROM ubuntu:jammy-20221130 |
a6432254 TR |
6 | MAINTAINER Tom Rini <[email protected]> |
7 | LABEL Description=" This image is for building U-Boot inside a container" | |
8 | ||
9 | # Make sure apt is happy | |
10 | ENV DEBIAN_FRONTEND=noninteractive | |
11 | ||
12 | # Add LLVM repository | |
13 | RUN apt-get update && apt-get install -y gnupg2 wget xz-utils && rm -rf /var/lib/apt/lists/* | |
14 | RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - | |
09ed7e62 | 15 | RUN echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main | tee /etc/apt/sources.list.d/llvm.list |
a6432254 | 16 | |
09ed7e62 TR |
17 | # Manually install the kernel.org "Crosstool" based toolchains for gcc-12.2.0 |
18 | RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-aarch64-linux.tar.xz | tar -C /opt -xJ | |
19 | RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-arm-linux-gnueabi.tar.xz | tar -C /opt -xJ | |
20 | RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-i386-linux.tar.xz | tar -C /opt -xJ | |
21 | RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-m68k-linux.tar.xz | tar -C /opt -xJ | |
22 | RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-mips-linux.tar.xz | tar -C /opt -xJ | |
23 | RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-microblaze-linux.tar.xz | tar -C /opt -xJ | |
24 | RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-nios2-linux.tar.xz | tar -C /opt -xJ | |
25 | RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-powerpc-linux.tar.xz | tar -C /opt -xJ | |
26 | RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-riscv64-linux.tar.xz | tar -C /opt -xJ | |
27 | RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-riscv32-linux.tar.xz | tar -C /opt -xJ | |
28 | RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/12.2.0/x86_64-gcc-12.2.0-nolibc-sh2-linux.tar.xz | tar -C /opt -xJ | |
a6432254 TR |
29 | |
30 | # Manually install other toolchains | |
7bb1cc3b TR |
31 | 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 |
32 | RUN wget -O - https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2021.03-release/arc_gnu_2021.03_prebuilt_uclibc_le_archs_linux_install.tar.gz | tar --no-same-owner -C /opt -xz | |
a6432254 TR |
33 | |
34 | # Update and install things from apt now | |
35 | RUN apt-get update && apt-get install -y \ | |
36 | automake \ | |
37 | autopoint \ | |
38 | bc \ | |
39 | binutils-dev \ | |
40 | bison \ | |
41 | build-essential \ | |
09ed7e62 | 42 | clang-14 \ |
a6432254 TR |
43 | coreutils \ |
44 | cpio \ | |
45 | cppcheck \ | |
46 | curl \ | |
47 | device-tree-compiler \ | |
48 | dosfstools \ | |
49 | e2fsprogs \ | |
50 | efitools \ | |
2c30aa3d | 51 | erofs-utils \ |
8a87d1ae | 52 | expect \ |
a6432254 TR |
53 | fakeroot \ |
54 | flex \ | |
8a87d1ae | 55 | gawk \ |
a6432254 TR |
56 | gdisk \ |
57 | git \ | |
58 | gnu-efi \ | |
8a87d1ae | 59 | gnutls-dev \ |
a6432254 TR |
60 | graphviz \ |
61 | grub-efi-amd64-bin \ | |
62 | grub-efi-ia32-bin \ | |
63 | help2man \ | |
64 | iasl \ | |
65 | imagemagick \ | |
66 | iputils-ping \ | |
85fd4898 | 67 | libc6-i386 \ |
3283a052 | 68 | libconfuse-dev \ |
b1c2102d | 69 | libgit2-dev \ |
8a87d1ae | 70 | libjson-glib-dev \ |
a6432254 | 71 | libguestfs-tools \ |
ad3616ed AT |
72 | libgnutls28-dev \ |
73 | libgnutls30 \ | |
a6432254 TR |
74 | liblz4-tool \ |
75 | libpixman-1-dev \ | |
b1c2102d | 76 | libpython3-dev \ |
a6432254 TR |
77 | libsdl1.2-dev \ |
78 | libsdl2-dev \ | |
8a87d1ae | 79 | libseccomp-dev \ |
a6432254 | 80 | libssl-dev \ |
8a87d1ae | 81 | libtool \ |
a6432254 TR |
82 | libudev-dev \ |
83 | libusb-1.0-0-dev \ | |
f9abaa53 | 84 | linux-image-kvm \ |
a6432254 TR |
85 | lzma-alone \ |
86 | lzop \ | |
87 | mount \ | |
88 | mtd-utils \ | |
89 | mtools \ | |
8a87d1ae | 90 | net-tools \ |
a30e53cc | 91 | ninja-build \ |
a6432254 TR |
92 | openssl \ |
93 | picocom \ | |
94 | parted \ | |
95 | pkg-config \ | |
b1c2102d TR |
96 | python-is-python3 \ |
97 | python2.7 \ | |
98 | python3 \ | |
99 | python3-dev \ | |
a6432254 | 100 | python3-pip \ |
33799266 | 101 | python3-pyelftools \ |
a6432254 | 102 | python3-sphinx \ |
b1c2102d | 103 | python3-virtualenv \ |
a6432254 TR |
104 | rpm2cpio \ |
105 | sbsigntool \ | |
106 | sloccount \ | |
8a87d1ae HS |
107 | socat \ |
108 | softhsm2 \ | |
a6432254 TR |
109 | sparse \ |
110 | srecord \ | |
111 | sudo \ | |
112 | swig \ | |
5f7a507e | 113 | texinfo \ |
a6432254 TR |
114 | util-linux \ |
115 | uuid-dev \ | |
116 | virtualenv \ | |
7bb1cc3b | 117 | xxd \ |
a6432254 TR |
118 | zip \ |
119 | && rm -rf /var/lib/apt/lists/* | |
120 | ||
f9abaa53 ANY |
121 | # Make kernels readable for libguestfs tools to work correctly |
122 | RUN chmod +r /boot/vmlinu* | |
123 | ||
a6432254 TR |
124 | # Build GRUB UEFI targets for ARM & RISC-V, 32-bit and 64-bit |
125 | RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \ | |
126 | cd /tmp/grub && \ | |
7bb1cc3b | 127 | git checkout grub-2.06 && \ |
09ed7e62 TR |
128 | git config --global user.name "GitLab CI Runner" && \ |
129 | git config --global user.email [email protected] && \ | |
130 | git cherry-pick 049efdd72eb7baa7b2bf8884391ee7fe650da5a0 && \ | |
a6432254 TR |
131 | ./bootstrap && \ |
132 | mkdir -p /opt/grub && \ | |
133 | ./configure --target=aarch64 --with-platform=efi \ | |
134 | CC=gcc \ | |
09ed7e62 TR |
135 | TARGET_CC=/opt/gcc-12.2.0-nolibc/aarch64-linux/bin/aarch64-linux-gcc \ |
136 | TARGET_OBJCOPY=/opt/gcc-12.2.0-nolibc/aarch64-linux/bin/aarch64-linux-objcopy \ | |
137 | TARGET_STRIP=/opt/gcc-12.2.0-nolibc/aarch64-linux/bin/aarch64-linux-strip \ | |
138 | TARGET_NM=/opt/gcc-12.2.0-nolibc/aarch64-linux/bin/aarch64-linux-nm \ | |
139 | TARGET_RANLIB=/opt/gcc-12.2.0-nolibc/aarch64-linux/bin/aarch64-linux-ranlib && \ | |
a6432254 TR |
140 | make && \ |
141 | ./grub-mkimage -O arm64-efi -o /opt/grub/grubaa64.efi --prefix= -d \ | |
142 | grub-core cat chain configfile echo efinet ext2 fat halt help linux \ | |
143 | lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \ | |
144 | search search_fs_file search_fs_uuid search_label serial sleep test \ | |
145 | true && \ | |
146 | make clean && \ | |
147 | ./configure --target=arm --with-platform=efi \ | |
148 | CC=gcc \ | |
09ed7e62 TR |
149 | TARGET_CC=/opt/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc \ |
150 | TARGET_OBJCOPY=/opt/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-objcopy \ | |
151 | TARGET_STRIP=/opt/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-strip \ | |
152 | TARGET_NM=/opt/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-nm \ | |
153 | TARGET_RANLIB=/opt/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ranlib && \ | |
a6432254 TR |
154 | make && \ |
155 | ./grub-mkimage -O arm-efi -o /opt/grub/grubarm.efi --prefix= -d \ | |
156 | grub-core cat chain configfile echo efinet ext2 fat halt help linux \ | |
157 | lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \ | |
158 | search search_fs_file search_fs_uuid search_label serial sleep test \ | |
159 | true && \ | |
160 | make clean && \ | |
161 | ./configure --target=riscv64 --with-platform=efi \ | |
162 | CC=gcc \ | |
09ed7e62 TR |
163 | TARGET_CC=/opt/gcc-12.2.0-nolibc/riscv64-linux/bin/riscv64-linux-gcc \ |
164 | TARGET_OBJCOPY=/opt/gcc-12.2.0-nolibc/riscv64-linux/bin/riscv64-linux-objcopy \ | |
165 | TARGET_STRIP=/opt/gcc-12.2.0-nolibc/riscv64-linux/bin/riscv64-linux-strip \ | |
166 | TARGET_NM=/opt/gcc-12.2.0-nolibc/riscv64-linux/bin/riscv64-linux-nm \ | |
167 | TARGET_RANLIB=/opt/gcc-12.2.0-nolibc/riscv64-linux/bin/riscv64-linux-ranlib && \ | |
a6432254 TR |
168 | make && \ |
169 | ./grub-mkimage -O riscv64-efi -o /opt/grub/grubriscv64.efi --prefix= -d \ | |
170 | grub-core cat chain configfile echo efinet ext2 fat halt help linux \ | |
171 | lsefisystab loadenv lvm minicmd normal part_msdos part_gpt reboot \ | |
172 | search search_fs_file search_fs_uuid search_label serial sleep test \ | |
173 | true && \ | |
a6432254 TR |
174 | rm -rf /tmp/grub |
175 | ||
176 | RUN git clone git://git.qemu.org/qemu.git /tmp/qemu && \ | |
177 | cd /tmp/qemu && \ | |
178 | git submodule update --init dtc && \ | |
a30e53cc BM |
179 | git checkout v6.1.0 && \ |
180 | # config user.name and user.email to make 'git am' happy | |
181 | git config user.name u-boot && \ | |
182 | git config user.email [email protected] && \ | |
183 | # manually apply the bug fix for QEMU 6.1.0 Xilinx Zynq UART emulation codes | |
184 | wget -O - http://patchwork.ozlabs.org/project/qemu-devel/patch/[email protected]/mbox/ | git am && \ | |
a6432254 TR |
185 | ./configure --prefix=/opt/qemu --target-list="aarch64-softmmu,arm-softmmu,i386-softmmu,mips-softmmu,mips64-softmmu,mips64el-softmmu,mipsel-softmmu,ppc-softmmu,riscv32-softmmu,riscv64-softmmu,sh4-softmmu,x86_64-softmmu,xtensa-softmmu" && \ |
186 | make -j$(nproc) all install && \ | |
187 | rm -rf /tmp/qemu | |
188 | ||
3283a052 BM |
189 | # Build genimage (required by some targets to generate disk images) |
190 | RUN wget -O - https://github.com/pengutronix/genimage/releases/download/v14/genimage-14.tar.xz | tar -C /tmp -xJ && \ | |
191 | cd /tmp/genimage-14 && \ | |
192 | ./configure && \ | |
193 | make -j$(nproc) && \ | |
194 | make install && \ | |
195 | rm -rf /tmp/genimage-14 | |
196 | ||
8a87d1ae HS |
197 | # Build libtpms |
198 | RUN git clone https://github.com/stefanberger/libtpms /tmp/libtpms && \ | |
199 | cd /tmp/libtpms && \ | |
200 | ./autogen.sh && \ | |
201 | ./configure && \ | |
202 | make -j$(nproc) && \ | |
203 | make install && \ | |
204 | ldconfig && \ | |
205 | rm -rf /tmp/libtpms | |
206 | ||
207 | # Build swtpm | |
208 | RUN git clone https://github.com/stefanberger/swtpm /tmp/swtpm && \ | |
209 | cd /tmp/swtpm && \ | |
210 | ./autogen.sh && \ | |
211 | ./configure && \ | |
212 | make -j$(nproc) && \ | |
213 | make install && \ | |
214 | rm -rf /tmp/swtpm | |
215 | ||
a6432254 TR |
216 | # Create our user/group |
217 | RUN echo uboot ALL=NOPASSWD: ALL > /etc/sudoers.d/uboot | |
218 | RUN useradd -m -U uboot | |
219 | USER uboot:uboot | |
220 | ||
221 | # Create the buildman config file | |
222 | RUN /bin/echo -e "[toolchain]\nroot = /usr" > ~/.buildman | |
09ed7e62 | 223 | RUN /bin/echo -e "kernelorg = /opt/gcc-12.2.0-nolibc/*" >> ~/.buildman |
7bb1cc3b TR |
224 | RUN /bin/echo -e "arc = /opt/arc_gnu_2021.03_prebuilt_uclibc_le_archs_linux_install" >> ~/.buildman |
225 | RUN /bin/echo -e "\n[toolchain-prefix]\nxtensa = /opt/2020.07/xtensa-dc233c-elf/bin/xtensa-dc233c-elf-" >> ~/.buildman; | |
a6432254 | 226 | RUN /bin/echo -e "\n[toolchain-alias]\nsh = sh2" >> ~/.buildman |
a6432254 TR |
227 | RUN /bin/echo -e "\nsandbox = x86_64" >> ~/.buildman |
228 | RUN /bin/echo -e "\nx86 = i386" >> ~/.buildman; |