summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkuqin12 <42554914+kuqin12@users.noreply.github.com>2023-03-21 16:27:54 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-12-20 22:57:04 +0000
commit4b2f964749e77ca888176e91ae2cebc76e958b4c (patch)
tree03b4950668f24e53e81f72ce6a2b18b0d8519321
parent79a64e73f70bfe3595b23fbd183507cc57a52b93 (diff)
downloadedk2-4b2f964749e77ca888176e91ae2cebc76e958b4c.tar.gz
BaseTools: Adding support of building BaseTool on Windows ARM/ARM64
This change focuses on the support of building basetool natively for Windows ARM/ARM64 host system, which will enable the ARM based platforms to build UEFI and unit tests. Note that the warnings due to integer conversions are suppressed for this specific target to avoid too much local changes carried in MU. The formal change should drop all these binaries and move to pythonic scripts. The binary output is tested on Windows ARM based hardware systems. Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Kun Qin <kun.qin@microsoft.com>
-rw-r--r--BaseTools/Source/C/GenFfs/GenFfs.c2
-rw-r--r--BaseTools/Source/C/GenFw/Elf32Convert.c2
-rw-r--r--BaseTools/Source/C/GenFw/Elf64Convert.c2
-rw-r--r--BaseTools/Source/C/GenFw/ElfConvert.c2
-rw-r--r--BaseTools/Source/C/GenFw/GenFw.c2
-rw-r--r--BaseTools/Source/C/GenSec/GenSec.c2
-rw-r--r--BaseTools/Source/C/Makefiles/ms.common17
7 files changed, 29 insertions, 0 deletions
diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c
index d78d62ab36..4c2e93e6f4 100644
--- a/BaseTools/Source/C/GenFfs/GenFfs.c
+++ b/BaseTools/Source/C/GenFfs/GenFfs.c
@@ -7,7 +7,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __GNUC__
+#define RUNTIME_FUNCTION _WINNT_DUP_RUNTIME_FUNCTION
#include <windows.h>
+#undef RUNTIME_FUNCTION
#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c
index de198e58db..246497a718 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -10,7 +10,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __GNUC__
+#define RUNTIME_FUNCTION _WINNT_DUP_RUNTIME_FUNCTION
#include <windows.h>
+#undef RUNTIME_FUNCTION
#include <io.h>
#endif
#include <assert.h>
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
index 897045b2be..6919e18809 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -11,7 +11,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __GNUC__
+#define RUNTIME_FUNCTION _WINNT_DUP_RUNTIME_FUNCTION
#include <windows.h>
+#undef RUNTIME_FUNCTION
#include <io.h>
#endif
#include <assert.h>
diff --git a/BaseTools/Source/C/GenFw/ElfConvert.c b/BaseTools/Source/C/GenFw/ElfConvert.c
index 3205f61494..d6d9feb7d8 100644
--- a/BaseTools/Source/C/GenFw/ElfConvert.c
+++ b/BaseTools/Source/C/GenFw/ElfConvert.c
@@ -8,7 +8,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __GNUC__
+#define RUNTIME_FUNCTION _WINNT_DUP_RUNTIME_FUNCTION
#include <windows.h>
+#undef RUNTIME_FUNCTION
#include <io.h>
#endif
#include <stdio.h>
diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c
index bd635b375a..daf840c3cd 100644
--- a/BaseTools/Source/C/GenFw/GenFw.c
+++ b/BaseTools/Source/C/GenFw/GenFw.c
@@ -7,7 +7,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __GNUC__
+#define RUNTIME_FUNCTION _WINNT_DUP_RUNTIME_FUNCTION
#include <windows.h>
+#undef RUNTIME_FUNCTION
#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c
index cf24d821aa..d9d2efeca7 100644
--- a/BaseTools/Source/C/GenSec/GenSec.c
+++ b/BaseTools/Source/C/GenSec/GenSec.c
@@ -6,7 +6,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __GNUC__
+#define RUNTIME_FUNCTION _WINNT_DUP_RUNTIME_FUNCTION
#include <windows.h>
+#undef RUNTIME_FUNCTION
#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/BaseTools/Source/C/Makefiles/ms.common b/BaseTools/Source/C/Makefiles/ms.common
index fe7a59c280..66f0f5ba4c 100644
--- a/BaseTools/Source/C/Makefiles/ms.common
+++ b/BaseTools/Source/C/Makefiles/ms.common
@@ -51,6 +51,23 @@ BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64
+CFLAGS = $(CFLAGS) /wd4267 /wd4244 /wd4334
+
+!ELSEIF "$(HOST_ARCH)"=="ARM"
+ARCH_INCLUDE = $(EDK2_PATH)\MdePkg\Include\Arm
+BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32
+LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32
+SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32
+SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32
+
+!ELSEIF "$(HOST_ARCH)"=="AARCH64"
+ARCH_INCLUDE = $(EDK2_PATH)\MdePkg\Include\AArch64
+BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64
+LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64
+SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
+SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64
+# Note: These are bit-width conversion related warning suppressions.
+CFLAGS = $(CFLAGS) /wd4267 /wd4244 /wd4334
!ELSE
!ERROR "Bad HOST_ARCH"