From 2dbd2e2d9d93e79c52112e29970995606780b991 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Thu, 13 Nov 2025 21:56:59 +0200 Subject: [PATCH] Initial commit --- .gitignore | 2 + check-version.sh | 12 ++ pkg.info | 44 +++++++ source-files/50-edk2-ovmf-i386-secure-4m.json | 35 ++++++ source-files/50-edk2-ovmf-i386-secure.json | 35 ++++++ .../50-edk2-ovmf-x86_64-secure-4m.json | 36 ++++++ source-files/50-edk2-ovmf-x86_64-secure.json | 36 ++++++ source-files/60-edk2-ovmf-i386-4m.json | 34 +++++ source-files/60-edk2-ovmf-i386.json | 34 +++++ source-files/60-edk2-ovmf-microvm-4m.json | 22 ++++ source-files/60-edk2-ovmf-microvm.json | 22 ++++ source-files/60-edk2-ovmf-x86_64-4m.json | 35 ++++++ source-files/60-edk2-ovmf-x86_64.json | 35 ++++++ ...80-edk2-ovmf-ia32-on-x86_64-secure-4m.json | 35 ++++++ .../80-edk2-ovmf-ia32-on-x86_64-secure.json | 35 ++++++ .../81-edk2-ovmf-ia32-on-x86_64-4m.json | 34 +++++ source-files/81-edk2-ovmf-ia32-on-x86_64.json | 34 +++++ source-files/nasm3.patch | 22 ++++ source.sh | 116 ++++++++++++++++++ 19 files changed, 658 insertions(+) create mode 100644 .gitignore create mode 100644 check-version.sh create mode 100644 pkg.info create mode 100644 source-files/50-edk2-ovmf-i386-secure-4m.json create mode 100644 source-files/50-edk2-ovmf-i386-secure.json create mode 100644 source-files/50-edk2-ovmf-x86_64-secure-4m.json create mode 100644 source-files/50-edk2-ovmf-x86_64-secure.json create mode 100644 source-files/60-edk2-ovmf-i386-4m.json create mode 100644 source-files/60-edk2-ovmf-i386.json create mode 100644 source-files/60-edk2-ovmf-microvm-4m.json create mode 100644 source-files/60-edk2-ovmf-microvm.json create mode 100644 source-files/60-edk2-ovmf-x86_64-4m.json create mode 100644 source-files/60-edk2-ovmf-x86_64.json create mode 100644 source-files/80-edk2-ovmf-ia32-on-x86_64-secure-4m.json create mode 100644 source-files/80-edk2-ovmf-ia32-on-x86_64-secure.json create mode 100644 source-files/81-edk2-ovmf-ia32-on-x86_64-4m.json create mode 100644 source-files/81-edk2-ovmf-ia32-on-x86_64.json create mode 100644 source-files/nasm3.patch create mode 100644 source.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3e58e5f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Exclude bpm archives +*.bpm \ No newline at end of file diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..6017e2f --- /dev/null +++ b/check-version.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Github repository +REPO="tianocore/edk2" + +# Get tag name using Github Rest API +TAG_NAME=$(curl -s -L -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/"$REPO"/tags | jq -r '.[].name' | grep 'edk2-stable' | head -n1) + +# Trim prefix +VERSION=${TAG_NAME//edk2-stable/} + +echo "$VERSION" diff --git a/pkg.info b/pkg.info new file mode 100644 index 0000000..d0cdd87 --- /dev/null +++ b/pkg.info @@ -0,0 +1,44 @@ +name: edk2-ovmf +description: EFI Development Kit 2 - Open Virtual Machine Firmware +version: "202508.01" +revision: 1 +url: https://github.com/tianocore/tianocore.github.io/wiki/EDK-II +license: BSD-2-Clause-Patent,MIT +architecture: any +type: source +make_depends: + - acpica + - dos2unix + - nasm + - python3 + - util-linux +downloads: + - url: https://github.com/tianocore/edk2/archive/refs/tags/edk2-stable${BPM_PKG_VERSION}.tar.gz + extract_to: ${BPM_SOURCE} + extract_strip_components: 1 + checksum: 749b2833ba15bab60ce68f25882c7b9961bbefdfed0903c4d26dba0555763013 + - url: https://github.com/MIPI-Alliance/public-mipi-sys-t/archive/v1.1+edk2.tar.gz + extract_to: ${BPM_SOURCE}/MdePkg/Library/MipiSysTLib/mipisyst + extract_strip_components: 1 + checksum: 473dcd46ed32b098091a2353f0ed13e69cbe773811c5551e6e766c16ac9ba464 + - url: https://www.openssl.org/source/openssl-3.5.1.tar.gz + extract_to: ${BPM_SOURCE}/CryptoPkg/Library/OpensslLib/openssl + extract_strip_components: 1 + checksum: 529043b15cffa5f36077a4d0af83f3de399807181d607441d734196d889b641f + - url: https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/mbedtls-3.3.0.tar.gz + extract_to: ${BPM_SOURCE}/CryptoPkg/Library/MbedTlsLib/mbedtls + extract_strip_components: 1 + checksum: a22ff38512697b9cd8472faa2ea2d35e320657f6d268def3a64765548b81c3ec + - url: https://github.com/DMTF/libspdm/archive/refs/tags/3.6.0.tar.gz + extract_to: ${BPM_SOURCE}/SecurityPkg/DeviceSecurity/SpdmLib/libspdm + extract_strip_components: 1 + checksum: dfadf501d23c26041c921974971953a1d4a250ed6cd2679facb781471a5f944c + - url: https://github.com/devicetree-org/pylibfdt/archive/refs/tags/v1.7.2.tar.gz + extract_to: ${BPM_SOURCE}/MdePkg/Library/BaseFdtLib/libfdt + extract_strip_components: 1 + checksum: a69d41e13bedd43d991ffcd26b914912229b6c7d2022e5f0349a2acf6d65575e + - url: https://github.com/google/brotli/archive/refs/tags/v1.1.0.tar.gz + filepath: brotli.tar.gz + extract_to: ${BPM_SOURCE}/BaseTools/Source/C/BrotliCompress/brotli + extract_strip_components: 1 + checksum: e720a6ca29428b803f4ad165371771f5398faba397edf6778837a18599ea13ff diff --git a/source-files/50-edk2-ovmf-i386-secure-4m.json b/source-files/50-edk2-ovmf-i386-secure-4m.json new file mode 100644 index 0000000..f556449 --- /dev/null +++ b/source-files/50-edk2-ovmf-i386-secure-4m.json @@ -0,0 +1,35 @@ +{ + "description": "IA32 UEFI for i386, with Secure Boot and SMM, 4MB FD", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "executable": { + "filename": "/usr/share/edk2/ia32/OVMF_CODE.secure.4m.fd", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/ia32/OVMF_VARS.4m.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "i386", + "machines": [ + "pc-q35-*" + ] + } + ], + "features": [ + "acpi-s3", + "acpi-s4", + "requires-smm", + "secure-boot", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/source-files/50-edk2-ovmf-i386-secure.json b/source-files/50-edk2-ovmf-i386-secure.json new file mode 100644 index 0000000..fd244f0 --- /dev/null +++ b/source-files/50-edk2-ovmf-i386-secure.json @@ -0,0 +1,35 @@ +{ + "description": "IA32 UEFI for i386, with Secure Boot and SMM", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "executable": { + "filename": "/usr/share/edk2/ia32/OVMF_CODE.secure.fd", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/ia32/OVMF_VARS.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "i386", + "machines": [ + "pc-q35-*" + ] + } + ], + "features": [ + "acpi-s3", + "acpi-s4", + "requires-smm", + "secure-boot", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/source-files/50-edk2-ovmf-x86_64-secure-4m.json b/source-files/50-edk2-ovmf-x86_64-secure-4m.json new file mode 100644 index 0000000..d1678cb --- /dev/null +++ b/source-files/50-edk2-ovmf-x86_64-secure-4m.json @@ -0,0 +1,36 @@ +{ + "description": "x64 UEFI for x86_64, with Secure Boot and SMM, 4MB FD", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "executable": { + "filename": "/usr/share/edk2/x64/OVMF_CODE.secure.4m.fd", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/x64/OVMF_VARS.4m.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "x86_64", + "machines": [ + "pc-q35-*" + ] + } + ], + "features": [ + "acpi-s3", + "acpi-s4", + "amd-sev", + "requires-smm", + "secure-boot", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/source-files/50-edk2-ovmf-x86_64-secure.json b/source-files/50-edk2-ovmf-x86_64-secure.json new file mode 100644 index 0000000..5adc4db --- /dev/null +++ b/source-files/50-edk2-ovmf-x86_64-secure.json @@ -0,0 +1,36 @@ +{ + "description": "x64 UEFI for x86_64, with Secure Boot and SMM", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "executable": { + "filename": "/usr/share/edk2/x64/OVMF_CODE.secure.fd", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/x64/OVMF_VARS.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "x86_64", + "machines": [ + "pc-q35-*" + ] + } + ], + "features": [ + "acpi-s3", + "acpi-s4", + "amd-sev", + "requires-smm", + "secure-boot", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/source-files/60-edk2-ovmf-i386-4m.json b/source-files/60-edk2-ovmf-i386-4m.json new file mode 100644 index 0000000..2a07076 --- /dev/null +++ b/source-files/60-edk2-ovmf-i386-4m.json @@ -0,0 +1,34 @@ +{ + "description": "IA32 UEFI for i386, 4MB FD", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "executable": { + "filename": "/usr/share/edk2/ia32/OVMF_CODE.4m.fd", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/ia32/OVMF_VARS.4m.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "i386", + "machines": [ + "pc-i440fx-*", + "pc-q35-*" + ] + } + ], + "features": [ + "acpi-s3", + "acpi-s4", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/source-files/60-edk2-ovmf-i386.json b/source-files/60-edk2-ovmf-i386.json new file mode 100644 index 0000000..18cb255 --- /dev/null +++ b/source-files/60-edk2-ovmf-i386.json @@ -0,0 +1,34 @@ +{ + "description": "IA32 UEFI for i386", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "executable": { + "filename": "/usr/share/edk2/ia32/OVMF_CODE.fd", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/ia32/OVMF_VARS.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "i386", + "machines": [ + "pc-i440fx-*", + "pc-q35-*" + ] + } + ], + "features": [ + "acpi-s3", + "acpi-s4", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/source-files/60-edk2-ovmf-microvm-4m.json b/source-files/60-edk2-ovmf-microvm-4m.json new file mode 100644 index 0000000..1639f33 --- /dev/null +++ b/source-files/60-edk2-ovmf-microvm-4m.json @@ -0,0 +1,22 @@ +{ + "description": "OVMF for microvm, 4MB FD", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "memory", + "filename": "/usr/share/edk2/x64/MICROVM.4m.fd" + }, + "targets": [ + { + "architecture": "x86_64", + "machines": [ + "microvm" + ] + } + ], + "features": [ + ], + "tags": [ + ] +} diff --git a/source-files/60-edk2-ovmf-microvm.json b/source-files/60-edk2-ovmf-microvm.json new file mode 100644 index 0000000..78b900e --- /dev/null +++ b/source-files/60-edk2-ovmf-microvm.json @@ -0,0 +1,22 @@ +{ + "description": "OVMF for microvm", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "memory", + "filename": "/usr/share/edk2/x64/MICROVM.fd" + }, + "targets": [ + { + "architecture": "x86_64", + "machines": [ + "microvm" + ] + } + ], + "features": [ + ], + "tags": [ + ] +} diff --git a/source-files/60-edk2-ovmf-x86_64-4m.json b/source-files/60-edk2-ovmf-x86_64-4m.json new file mode 100644 index 0000000..fe8e263 --- /dev/null +++ b/source-files/60-edk2-ovmf-x86_64-4m.json @@ -0,0 +1,35 @@ +{ + "description": "x64 UEFI for x86_64, 4MB FD", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "executable": { + "filename": "/usr/share/edk2/x64/OVMF_CODE.4m.fd", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/x64/OVMF_VARS.4m.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "x86_64", + "machines": [ + "pc-i440fx-*", + "pc-q35-*" + ] + } + ], + "features": [ + "acpi-s3", + "acpi-s4", + "amd-sev", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/source-files/60-edk2-ovmf-x86_64.json b/source-files/60-edk2-ovmf-x86_64.json new file mode 100644 index 0000000..ca02ef0 --- /dev/null +++ b/source-files/60-edk2-ovmf-x86_64.json @@ -0,0 +1,35 @@ +{ + "description": "x64 UEFI for x86_64", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "executable": { + "filename": "/usr/share/edk2/x64/OVMF_CODE.fd", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/x64/OVMF_VARS.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "x86_64", + "machines": [ + "pc-i440fx-*", + "pc-q35-*" + ] + } + ], + "features": [ + "acpi-s3", + "acpi-s4", + "amd-sev", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/source-files/80-edk2-ovmf-ia32-on-x86_64-secure-4m.json b/source-files/80-edk2-ovmf-ia32-on-x86_64-secure-4m.json new file mode 100644 index 0000000..63a8276 --- /dev/null +++ b/source-files/80-edk2-ovmf-ia32-on-x86_64-secure-4m.json @@ -0,0 +1,35 @@ +{ + "description": "IA32 UEFI for x86_64, with Secure Boot and SMM, 4MB FD", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "executable": { + "filename": "/usr/share/edk2/ia32/OVMF_CODE.secure.4m.fd", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/ia32/OVMF_VARS.4m.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "x86_64", + "machines": [ + "pc-q35-*" + ] + } + ], + "features": [ + "acpi-s3", + "acpi-s4", + "requires-smm", + "secure-boot", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/source-files/80-edk2-ovmf-ia32-on-x86_64-secure.json b/source-files/80-edk2-ovmf-ia32-on-x86_64-secure.json new file mode 100644 index 0000000..6d28f39 --- /dev/null +++ b/source-files/80-edk2-ovmf-ia32-on-x86_64-secure.json @@ -0,0 +1,35 @@ +{ + "description": "IA32 UEFI for x86_64, with Secure Boot and SMM", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "executable": { + "filename": "/usr/share/edk2/ia32/OVMF_CODE.secure.fd", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/ia32/OVMF_VARS.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "x86_64", + "machines": [ + "pc-q35-*" + ] + } + ], + "features": [ + "acpi-s3", + "acpi-s4", + "requires-smm", + "secure-boot", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/source-files/81-edk2-ovmf-ia32-on-x86_64-4m.json b/source-files/81-edk2-ovmf-ia32-on-x86_64-4m.json new file mode 100644 index 0000000..d871ed1 --- /dev/null +++ b/source-files/81-edk2-ovmf-ia32-on-x86_64-4m.json @@ -0,0 +1,34 @@ +{ + "description": "IA32 UEFI for x86_64, 4MB FD", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "executable": { + "filename": "/usr/share/edk2/ia32/OVMF_CODE.4m.fd", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/ia32/OVMF_VARS.4m.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "x86_64", + "machines": [ + "pc-i440fx-*", + "pc-q35-*" + ] + } + ], + "features": [ + "acpi-s3", + "acpi-s4", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/source-files/81-edk2-ovmf-ia32-on-x86_64.json b/source-files/81-edk2-ovmf-ia32-on-x86_64.json new file mode 100644 index 0000000..3d7532e --- /dev/null +++ b/source-files/81-edk2-ovmf-ia32-on-x86_64.json @@ -0,0 +1,34 @@ +{ + "description": "IA32 UEFI for x86_64", + "interface-types": [ + "uefi" + ], + "mapping": { + "device": "flash", + "executable": { + "filename": "/usr/share/edk2/ia32/OVMF_CODE.fd", + "format": "raw" + }, + "nvram-template": { + "filename": "/usr/share/edk2/ia32/OVMF_VARS.fd", + "format": "raw" + } + }, + "targets": [ + { + "architecture": "x86_64", + "machines": [ + "pc-i440fx-*", + "pc-q35-*" + ] + } + ], + "features": [ + "acpi-s3", + "acpi-s4", + "verbose-dynamic" + ], + "tags": [ + + ] +} diff --git a/source-files/nasm3.patch b/source-files/nasm3.patch new file mode 100644 index 0000000..711c867 --- /dev/null +++ b/source-files/nasm3.patch @@ -0,0 +1,22 @@ +diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm +index 3d64ac9..9c3f01a 100644 +--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm ++++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm +@@ -57,7 +57,7 @@ ALIGN 8 + AsmIdtVectorBegin: + %assign Vector 0 + %rep 256 +- push strict dword %[Vector] ; This instruction pushes sign-extended 8-byte value on stack ++ push strict qword %[Vector] ; This instruction pushes sign-extended 8-byte value on stack + push rax + %ifdef NO_ABSOLUTE_RELOCS_IN_TEXT + mov rax, strict qword 0 ; mov rax, ASM_PFX(CommonInterruptEntry) +@@ -70,7 +70,7 @@ AsmIdtVectorBegin: + AsmIdtVectorEnd: + + HookAfterStubHeaderBegin: +- push strict dword 0 ; 0 will be fixed ++ push strict qword 0 ; 0 will be fixed + VectorNum: + push rax + %ifdef NO_ABSOLUTE_RELOCS_IN_TEXT diff --git a/source.sh b/source.sh new file mode 100644 index 0000000..26ce796 --- /dev/null +++ b/source.sh @@ -0,0 +1,116 @@ +# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +prepare() { + # Re-extract brotli for ShellPkg + tar -xvf "$BPM_WORKDIR"/brotli.tar.gz --strip-components=1 -C "$BPM_SOURCE"/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/ + + cd "$BPM_SOURCE" + # fix 32-bit instruction errors + dos2unix "$BPM_SOURCE"/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm + patch -Np1 -i "$BPM_WORKDIR"/nasm3.patch +} + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + local _common_args=(-b RELEASE -n $(nproc) -t GCC) + local _efi_args=(-D NETWORK_IP6_ENABLE -D TPM_CONFIG_ENABLE -D TPM1_ENABLE -D TPM2_ENABLE) + local _x86_args=(-D FD_SIZE_2MB -D HTTP_BOOT_ENABLE -D TLS_ENABLE) + local _4mb_args=(-D FD_SIZE_4MB -D FD_SIZE_IN_KB=4096 -D HTTP_BOOT_ENABLE -D TLS_ENABLE) + + make -C BaseTools + source edksetup.sh + + for arch in X64 IA32; do + BaseTools/BinWrappers/PosixLike/build -p ShellPkg/ShellPkg.dsc -a "$arch" "${_common_args[@]}" + done + + # X64 OVMF + BaseTools/BinWrappers/PosixLike/build -p "OvmfPkg/OvmfPkgIa32X64.dsc" -a IA32 -a X64 \ + "${_common_args[@]}" "${_efi_args[@]}" "${_4mb_args[@]}" \ + -D SECURE_BOOT_ENABLE -D SMM_REQUIRE -D EXCLUDE_SHELL_FROM_FD + mv -v Build/Ovmf3264{,-secure-4mb} + + BaseTools/BinWrappers/PosixLike/build -p "OvmfPkg/OvmfPkgIa32X64.dsc" -a IA32 -a X64 \ + "${_common_args[@]}" "${_efi_args[@]}" "${_x86_args[@]}" \ + -D SECURE_BOOT_ENABLE -D SMM_REQUIRE -D EXCLUDE_SHELL_FROM_FD + mv -v Build/Ovmf3264{,-secure} + + BaseTools/BinWrappers/PosixLike/build -p "OvmfPkg/OvmfPkgX64.dsc" -a X64 "${_common_args[@]}" "${_efi_args[@]}" "${_4mb_args[@]}" + mv -v Build/OvmfX64{,-4mb} + + BaseTools/BinWrappers/PosixLike/build -p "OvmfPkg/OvmfPkgX64.dsc" -a X64 "${_common_args[@]}" "${_efi_args[@]}" "${_x86_args[@]}" + + BaseTools/BinWrappers/PosixLike/build -p "OvmfPkg/Microvm/MicrovmX64.dsc" -a X64 "${_common_args[@]}" "${_efi_args[@]}" "${_4mb_args[@]}" + mv -v Build/MicrovmX64{,-4mb} + + BaseTools/BinWrappers/PosixLike/build -p "OvmfPkg/Microvm/MicrovmX64.dsc" -a X64 "${_common_args[@]}" "${_efi_args[@]}" "${_x86_args[@]}" + + # IA32 OVMF + BaseTools/BinWrappers/PosixLike/build -p "OvmfPkg/OvmfPkgIa32.dsc" -a IA32 \ + "${_common_args[@]}" "${_efi_args[@]}" "${_4mb_args[@]}" \ + -D SECURE_BOOT_ENABLE -D SMM_REQUIRE -D EXCLUDE_SHELL_FROM_FD -D LOAD_X64_ON_IA32_ENABLE + mv -v Build/Ovmf{Ia32,IA32-secure-4mb} + + BaseTools/BinWrappers/PosixLike/build -p "OvmfPkg/OvmfPkgIa32.dsc" -a IA32 \ + "${_common_args[@]}" "${_efi_args[@]}" "${_x86_args[@]}" \ + -D SECURE_BOOT_ENABLE -D SMM_REQUIRE -D EXCLUDE_SHELL_FROM_FD -D LOAD_X64_ON_IA32_ENABLE + mv -v Build/Ovmf{Ia32,IA32-secure} + + BaseTools/BinWrappers/PosixLike/build -p "OvmfPkg/OvmfPkgIa32.dsc" -a IA32 \ + "${_common_args[@]}" "${_efi_args[@]}" "${_4mb_args[@]}" \ + -D LOAD_X64_ON_IA32_ENABLE + mv -v Build/Ovmf{Ia32,IA32-4mb} + + BaseTools/BinWrappers/PosixLike/build -p "OvmfPkg/OvmfPkgIa32.dsc" -a IA32 \ + "${_common_args[@]}" "${_efi_args[@]}" "${_x86_args[@]}" \ + -D LOAD_X64_ON_IA32_ENABLE + mv -v Build/Ovmf{Ia32,IA32} +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + install -d "$BPM_OUTPUT"/usr/share/qemu/firmware + install -d "$BPM_OUTPUT"/usr/share/AAVMF + + for arch in X64 IA32; do + install -d "$BPM_OUTPUT"/usr/share/edk2/${arch,,} + + install -Dm644 Build/Shell/RELEASE_GCC/${arch}/Shell_7C04A583-9E3E-4f1c-AD65-E05268D0B4D1.efi usr/share/edk2/${arch,,}/Shell.efi + install -Dm644 Build/Shell/RELEASE_GCC/${arch}/Shell_EA4BB293-2D7F-4456-A681-1F22F42CD0BC.efi usr/share/edk2/${arch,,}/Shell_Full.efi + done + + # X64 OVMF + install -Dm644 Build/OvmfX64/RELEASE_GCC/FV/OVMF.fd "$BPM_OUTPUT"/usr/share/edk2/x64 + install -Dm644 Build/OvmfX64/RELEASE_GCC/FV/OVMF_CODE.fd "$BPM_OUTPUT"/usr/share/edk2/x64 + install -Dm644 Build/OvmfX64/RELEASE_GCC/FV/OVMF_VARS.fd "$BPM_OUTPUT"/usr/share/edk2/x64 + install -Dm644 Build/OvmfX64-4mb/RELEASE_GCC/FV/OVMF.fd "$BPM_OUTPUT"/usr/share/edk2/x64/OVMF.4m.fd + install -Dm644 Build/OvmfX64-4mb/RELEASE_GCC/FV/OVMF_CODE.fd "$BPM_OUTPUT"/usr/share/edk2/x64/OVMF_CODE.4m.fd + install -Dm644 Build/OvmfX64-4mb/RELEASE_GCC/FV/OVMF_VARS.fd "$BPM_OUTPUT"/usr/share/edk2/x64/OVMF_VARS.4m.fd + install -Dm644 Build/Ovmf3264-secure/RELEASE_GCC/FV/OVMF_CODE.fd "$BPM_OUTPUT"/usr/share/edk2/x64/OVMF_CODE.secure.fd + install -Dm644 Build/Ovmf3264-secure-4mb/RELEASE_GCC/FV/OVMF_CODE.fd "$BPM_OUTPUT"/usr/share/edk2/x64/OVMF_CODE.secure.4m.fd + install -Dm644 Build/MicrovmX64/RELEASE_GCC/FV/MICROVM.fd "$BPM_OUTPUT"/usr/share/edk2/x64/MICROVM.fd + install -Dm644 Build/MicrovmX64-4mb/RELEASE_GCC/FV/MICROVM.fd "$BPM_OUTPUT"/usr/share/edk2/x64/MICROVM.4m.fd + install -Dm644 "$BPM_WORKDIR"/*x86_64*.json -t "$BPM_OUTPUT"/usr/share/qemu/firmware + install -Dm644 "$BPM_WORKDIR"/*microvm*.json -t "$BPM_OUTPUT"/usr/share/qemu/firmware + + # IA32 OVMF + install -Dm644 Build/OvmfIA32/RELEASE_GCC/FV/OVMF.fd "$BPM_OUTPUT"/usr/share/edk2/ia32 + install -Dm644 Build/OvmfIA32/RELEASE_GCC/FV/OVMF_CODE.fd "$BPM_OUTPUT"/usr/share/edk2/ia32 + install -Dm644 Build/OvmfIA32/RELEASE_GCC/FV/OVMF_VARS.fd "$BPM_OUTPUT"/usr/share/edk2/ia32 + install -Dm644 Build/OvmfIA32-4mb/RELEASE_GCC/FV/OVMF.fd "$BPM_OUTPUT"/usr/share/edk2/ia32/OVMF.4m.fd + install -Dm644 Build/OvmfIA32-4mb/RELEASE_GCC/FV/OVMF_CODE.fd "$BPM_OUTPUT"/usr/share/edk2/ia32/OVMF_CODE.4m.fd + install -Dm644 Build/OvmfIA32-4mb/RELEASE_GCC/FV/OVMF_VARS.fd "$BPM_OUTPUT"/usr/share/edk2/ia32/OVMF_VARS.4m.fd + install -Dm644 Build/OvmfIA32-secure/RELEASE_GCC/FV/OVMF_CODE.fd "$BPM_OUTPUT"/usr/share/edk2/ia32/OVMF_CODE.secure.fd + install -Dm644 Build/OvmfIA32-secure-4mb/RELEASE_GCC/FV/OVMF_CODE.fd "$BPM_OUTPUT"/usr/share/edk2/ia32/OVMF_CODE.secure.4m.fd + install -Dm644 "$BPM_WORKDIR"/*i386*.json -t "$BPM_OUTPUT"/usr/share/qemu/firmware + + ln -s ./edk2 "$BPM_OUTPUT"/usr/share/OVMF + + # Install package licenses + install -Dm644 "$BPM_SOURCE"/License.txt "$BPM_OUTPUT"/usr/share/licenses/edk2-ovmf/License.txt + install -Dm644 "$BPM_SOURCE"/OvmfPkg/License.txt "$BPM_OUTPUT"/usr/share/licenses/edk2-ovmf/OvmfPkg-License.txt +}