summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source
diff options
context:
space:
mode:
authorkuqin12 <42554914+kuqin12@users.noreply.github.com>2023-04-25 15:48:19 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-12-20 22:57:04 +0000
commit3c8016b302c658d20ebf8eebd5f32daf818a0531 (patch)
treeb444fcbe5fe3051a4a8bdc1449929752eda31867 /BaseTools/Source
parent74bf7f55c1e95574334043fad5cc341afcf4f377 (diff)
downloadedk2-3c8016b302c658d20ebf8eebd5f32daf818a0531.tar.gz
BaseTools: Support custom library build for base tools on Linux ARM
This change added the build script to cross compile the base tool binaries for Linux ARM/AARCH64 systems. The needed libuuid system library is pulled from source file and rebuilt to support the corresponding library dependencies. Individual tools' makefiles are also updated to link the cross compiled library as well. The EDK2 base tool build script was also updated to support such change. This was tested functional on Linux ARM host system. 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>
Diffstat (limited to 'BaseTools/Source')
-rw-r--r--BaseTools/Source/C/DevicePath/GNUmakefile4
-rw-r--r--BaseTools/Source/C/GenFv/GNUmakefile11
-rw-r--r--BaseTools/Source/C/GenFv/GenFvInternalLib.c9
-rw-r--r--BaseTools/Source/C/GenFw/GNUmakefile4
-rw-r--r--BaseTools/Source/C/GenSec/GNUmakefile4
-rw-r--r--BaseTools/Source/C/Makefiles/header.makefile10
6 files changed, 36 insertions, 6 deletions
diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile
index f61b1b2f17..26ae14c468 100644
--- a/BaseTools/Source/C/DevicePath/GNUmakefile
+++ b/BaseTools/Source/C/DevicePath/GNUmakefile
@@ -30,6 +30,10 @@ ifeq ($(CYGWIN), CYGWIN)
endif
ifeq ($(LINUX), Linux)
+ifndef CROSS_LIB_UUID
LIBS += -luuid
+else
+ LIBS += -L$(CROSS_LIB_UUID)
+endif
endif
diff --git a/BaseTools/Source/C/GenFv/GNUmakefile b/BaseTools/Source/C/GenFv/GNUmakefile
index 872b981f6a..843eb1b291 100644
--- a/BaseTools/Source/C/GenFv/GNUmakefile
+++ b/BaseTools/Source/C/GenFv/GNUmakefile
@@ -14,6 +14,15 @@ include $(MAKEROOT)/Makefiles/app.makefile
LIBS = -lCommon
ifeq ($(CYGWIN), CYGWIN)
- LIBS += -L/lib/e2fsprogs
+ LIBS += -L/lib/e2fsprogs -luuid
+endif
+
+ifeq ($(LINUX), Linux)
+ifndef CROSS_LIB_UUID
+ LIBS += -luuid
+else
+ LIBS += -L$(CROSS_LIB_UUID)
+ BUILD_CFLAGS += -D__CROSS_LIB_UUID__ -I $(CROSS_LIB_UUID_INC)
+endif
endif
diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
index 29c3363a50..3f982c529b 100644
--- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c
+++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
@@ -14,6 +14,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// Include files
//
+#if defined(__FreeBSD__)
+#include <uuid.h>
+#elif defined(__GNUC__)
+#if !defined(__CROSS_LIB_UUID__)
+#include <uuid/uuid.h>
+#else
+#include <uuid.h>
+#endif
+#endif
#ifdef __GNUC__
#include <sys/stat.h>
#endif
diff --git a/BaseTools/Source/C/GenFw/GNUmakefile b/BaseTools/Source/C/GenFw/GNUmakefile
index 76cda7e7a3..2079835df7 100644
--- a/BaseTools/Source/C/GenFw/GNUmakefile
+++ b/BaseTools/Source/C/GenFw/GNUmakefile
@@ -18,6 +18,10 @@ ifeq ($(CYGWIN), CYGWIN)
endif
ifeq ($(LINUX), Linux)
+ifndef CROSS_LIB_UUID
LIBS += -luuid
+else
+ LIBS += -L$(CROSS_LIB_UUID)
+endif
endif
diff --git a/BaseTools/Source/C/GenSec/GNUmakefile b/BaseTools/Source/C/GenSec/GNUmakefile
index 9f0844c1b8..db634e40e6 100644
--- a/BaseTools/Source/C/GenSec/GNUmakefile
+++ b/BaseTools/Source/C/GenSec/GNUmakefile
@@ -18,6 +18,10 @@ ifeq ($(CYGWIN), CYGWIN)
endif
ifeq ($(LINUX), Linux)
+ifndef CROSS_LIB_UUID
LIBS += -luuid
+else
+ LIBS += -L$(CROSS_LIB_UUID)
+endif
endif
diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile
index d369908a09..f16b3297fc 100644
--- a/BaseTools/Source/C/Makefiles/header.makefile
+++ b/BaseTools/Source/C/Makefiles/header.makefile
@@ -54,11 +54,11 @@ AS ?= $(CLANG_BIN)clang
AR ?= $(CLANG_BIN)llvm-ar
LD ?= $(CLANG_BIN)llvm-ld
else ifeq ($(origin CC),default)
-CC = gcc
-CXX = g++
-AS = gcc
-AR = ar
-LD = ld
+CC = $(GCC_PREFIX)gcc
+CXX = $(GCC_PREFIX)g++
+AS = $(GCC_PREFIX)gcc
+AR = $(GCC_PREFIX)ar
+LD = $(GCC_PREFIX)ld
endif
LINKER ?= $(CC)
ifeq ($(HOST_ARCH), IA32)