Skip to content

Commit 236978d

Browse files
committed
Add loongarch support
1 parent 4c1bd2f commit 236978d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

build-edk2/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ RUN wget -q -O gcc-riscv.tar.gz https://github.com/riscv-collab/riscv-gnu-toolch
1717
RUN echo "c3b849d25a43d74e7eb1cf739a8a9fadba5f997c4814732650f36ae250a8ab00 gcc-riscv.tar.gz" | sha256sum --check
1818
RUN tar -C /opt -xzf gcc-riscv.tar.gz
1919

20+
# Use the LoongArch64 cross toolchain for building LoongArch64 code.
21+
RUN wget https://github.com/loongson/build-tools/releases/download/2023.08.08/x86_64-cross-tools-loongarch64-binutils_2.41-gcc_13.2.0.tar.xz
22+
RUN mkdir /opt/loongarch64_cross-toolchain/
23+
RUN tar -vxf x86_64-cross-tools-loongarch64-binutils_2.41-gcc_13.2.0.tar.xz -C /opt/loongarch64_cross-toolchain/
24+
2025
# Use git rather than a release tarball, since the tarball is missing
2126
# submodules.
2227
ARG git_tag
@@ -54,13 +59,20 @@ RUN . venv/bin/activate && stuart_setup ${stuart_opts} && stuart_update ${stuart
5459
ENV stuart_opts="-c OvmfPkg/PlatformCI/PlatformBuild.py -a X64 Target=${build_target} TOOL_CHAIN_TAG=${toolchain} ${common_build_opt} ${tpm_build_opt}"
5560
RUN . venv/bin/activate && stuart_setup ${stuart_opts} && stuart_update ${stuart_opts} && stuart_build ${stuart_opts}
5661

62+
# Build LoongArch64.
63+
ENV GCC5_LOONGARCH64_PREFIX="/opt/loongarch64_cross-toolchain/cross-tools/bin/loongarch64-unknown-linux-gnu-"
64+
ENV build_target=RELEASE
65+
ENV stuart_opts="-c OvmfPkg/PlatformCI/QemuBuild.py -a LOONGARCH64 Target=${build_target} TOOL_CHAIN_TAG=${toolchain} ${common_build_opt}"
66+
RUN . venv/bin/activate && stuart_setup ${stuart_opts} && stuart_update ${stuart_opts} && stuart_build ${stuart_opts}
67+
5768
# Create the output bin dir.
5869
ARG bin_dir
5970
RUN mkdir "${bin_dir}"
6071
RUN mkdir "${bin_dir}"/aarch64
6172
RUN mkdir "${bin_dir}"/riscv64
6273
RUN mkdir "${bin_dir}"/ia32
6374
RUN mkdir "${bin_dir}"/x64
75+
RUN mkdir "${bin_dir}"/loongarch64
6476

6577
# Copy AARCH64 files to bin dir.
6678
ENV aarch64_build="Build/ArmVirtQemu-AARCH64/${build_target}_${toolchain}"
@@ -92,6 +104,12 @@ RUN cp "${x64_build}/FV/OVMF_CODE.fd" "${bin_dir}"/x64/code.fd
92104
RUN cp "${x64_build}/FV/OVMF_VARS.fd" "${bin_dir}"/x64/vars.fd
93105
RUN cp "${x64_build}/X64/Shell.efi" "${bin_dir}"/x64/shell.efi
94106

107+
# Copy LoongArch64 files to bin dir.
108+
ENV loongarch64_build="Build/LoongArchVirtQemu/${build_target}_${toolchain}"
109+
RUN cp "${loongarch64_build}/FV/QEMU_EFI.fd" "${bin_dir}"/loongarch64/code.fd
110+
RUN cp "${loongarch64_build}/FV/QEMU_VARS.fd" "${bin_dir}"/loongarch64/vars.fd
111+
RUN cp "${loongarch64_build}/LOONGARCH64/Shell.efi" "${bin_dir}"/loongarch64/shell.efi
112+
95113
# Create the compressed tarball of the bin dir.
96114
RUN tar cf "${bin_dir}.tar" "${bin_dir}"
97115
RUN xz "${bin_dir}.tar"

0 commit comments

Comments
 (0)