This commit adds AArch64 Unix host build support for EmulatorPkg.
Signed-off-by: Akira Moroo <retrage01@gmail.com>
---
EmulatorPkg/EmulatorPkg.dsc | 15 ++++++++++++---
EmulatorPkg/Readme.md | 8 ++++++++
EmulatorPkg/Unix/Host/Host.inf | 5 +++++
EmulatorPkg/build.sh | 8 ++++++++
4 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index 554c13ddb5..91d0176fc7 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -19,7 +19,7 @@
DSC_SPECIFICATION = 0x00010005
OUTPUT_DIRECTORY = Build/Emulator$(ARCH)
- SUPPORTED_ARCHITECTURES = X64|IA32
+ SUPPORTED_ARCHITECTURES = X64|IA32|AARCH64
BUILD_TARGETS = DEBUG|RELEASE|NOOPT
SKUID_IDENTIFIER = DEFAULT
FLASH_DEFINITION = EmulatorPkg/EmulatorPkg.fdf
@@ -138,6 +138,13 @@
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
!endif
+[LibraryClasses.AARCH64]
+ ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+ ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+ CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
+ NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+ NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
+
[LibraryClasses.common.SEC]
PeiServicesLib|EmulatorPkg/Library/SecPeiServicesLib/SecPeiServicesLib.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
@@ -209,8 +216,10 @@
TimerLib|EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.inf
[PcdsFeatureFlag]
- gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|FALSE
+
+[PcdsFeatureFlag.IA32,PcdsFeatureFlag.X64]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplBuildPageTables|FALSE
[PcdsFixedAtBuild]
@@ -288,7 +297,7 @@
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|10
[Components]
-!if "IA32" in $(ARCH) || "X64" in $(ARCH)
+!if "IA32" in $(ARCH) || "X64" in $(ARCH) || "AARCH64" in $(ARCH)
!if "MSFT" in $(FAMILY) || $(WIN_HOST_BUILD) == TRUE
##
# Emulator, OS WIN application
diff --git a/EmulatorPkg/Readme.md b/EmulatorPkg/Readme.md
index 0c2eea6a9a..e3d0b58578 100644
--- a/EmulatorPkg/Readme.md
+++ b/EmulatorPkg/Readme.md
@@ -35,6 +35,10 @@ https://github.com/tianocore/tianocore.github.io/wiki/EmulatorPkg
`build -p EmulatorPkg\EmulatorPkg.dsc -t GCC5 -a X64`
+ * AArch64 emulator in Linux:
+
+ `build -p EmulatorPkg\EmulatorPkg.dsc -t GCC5 -a AARCH64`
+
**You can start/run the emulator using the following command:**
* 32bit emulator in Windows:
@@ -52,6 +56,10 @@ https://github.com/tianocore/tianocore.github.io/wiki/EmulatorPkg
`cd Build/EmulatorX64/DEBUG_GCC5/X64/ && ./Host`
+ * AArch64 emulator in Linux:
+
+ `cd Build/EmulatorAARCH64/DEBUG_GCC5/AARCH64/ && ./Host`
+
**On posix-like environment with the bash shell you can use EmulatorPkg/build.sh to simplify building and running
emulator.**
diff --git a/EmulatorPkg/Unix/Host/Host.inf b/EmulatorPkg/Unix/Host/Host.inf
index 43cb55aa21..fe4c6d511c 100644
--- a/EmulatorPkg/Unix/Host/Host.inf
+++ b/EmulatorPkg/Unix/Host/Host.inf
@@ -129,6 +129,11 @@
GCC:*_*_X64_PP_FLAGS == -m64 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
GCC:*_*_X64_ASM_FLAGS == -m64 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h
+ GCC:*_*_AARCH64_DLINK_FLAGS == -fPIC -flto -o $(BIN_DIR)/Host -L/usr/X11R6/lib
+ GCC:*_*_AARCH64_ASM_FLAGS == -g -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h
+ GCC:*_*_AARCH64_PP_FLAGS == -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
+ GCC:*_*_AARCH64_CC_FLAGS == -c -O0 -g -fPIC -fshort-wchar -fno-strict-aliasing -idirafter/usr/include -include $(DEST_DIR_DEBUG)/AutoGen.h -DUSING_LTO -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
+
GCC:*_*_*_DLINK2_FLAGS == -lpthread -ldl -lXext -lX11
#
diff --git a/EmulatorPkg/build.sh b/EmulatorPkg/build.sh
index 76c22dfaf8..e2ce1b8e18 100755
--- a/EmulatorPkg/build.sh
+++ b/EmulatorPkg/build.sh
@@ -83,6 +83,9 @@ case `uname` in
x86_64)
HOST_PROCESSOR=X64
;;
+ aarch64)
+ HOST_PROCESSOR=AARCH64
+ ;;
esac
gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
@@ -174,6 +177,11 @@ case $PROCESSOR in
LIB_NAMES="ld-linux-x86-64.so.2 libdl.so.2 crt1.o crti.o crtn.o"
LIB_SEARCH_PATHS="/usr/lib/x86_64-linux-gnu /usr/lib64 /lib64 /usr/lib /lib"
;;
+ AARCH64)
+ ARCH_SIZE=64
+ LIB_NAMES="ld-linux-aarch64.so.1 libdl.so.2 crt1.o crti.o crtn.o"
+ LIB_SEARCH_PATHS="/usr/lib/aarch64-linux-gnu /usr/lib /lib"
+ ;;
esac
for libname in $LIB_NAMES
--
2.33.0
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81723): https://edk2.groups.io/g/devel/message/81723
Mute This Topic: https://groups.io/mt/86198796/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.