make: add cross-compilation support
There might be a need for user to cross-compile SPDK for other platforms than native. Since DPDK supports cross-compilation already, only enablement of cross-compilation for SPDK is missing. This patch aims to provide the user with additional option to configure script that works similar to what DPDK already provides. To enable cross-compilation run ./configure.sh with additional --cross-prefix parameter. The parameter should work in similar manner to DPDK CROSS parameter and specifies prefix of cross-compiler defined in PATH variable. Note: To cross-compile, toolchain must have SPDK dependencies such as e.g. Libaio. Signed-off-by: Amelia Blachuciak <amelia.blachuciak@intel.com> Change-Id: Ia7cb879d39d624552cad1af98a563070ea7676b2 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460977 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
1a56982da3
commit
3def834c65
3
CONFIG
3
CONFIG
@ -37,6 +37,9 @@ CONFIG_PREFIX="/usr/local"
|
|||||||
# Target architecture
|
# Target architecture
|
||||||
CONFIG_ARCH=native
|
CONFIG_ARCH=native
|
||||||
|
|
||||||
|
# Prefix for cross compilation
|
||||||
|
CONFIG_CROSS_PREFIX=
|
||||||
|
|
||||||
# Build with debug logging. Turn off for performance testing and normal usage
|
# Build with debug logging. Turn off for performance testing and normal usage
|
||||||
CONFIG_DEBUG=n
|
CONFIG_DEBUG=n
|
||||||
|
|
||||||
|
8
configure
vendored
8
configure
vendored
@ -18,6 +18,9 @@ function usage()
|
|||||||
echo " --prefix=path Configure installation prefix (default: /usr/local)"
|
echo " --prefix=path Configure installation prefix (default: /usr/local)"
|
||||||
echo " --target-arch=arch Target build architecture. Must be a valid GNU arch. Default: native"
|
echo " --target-arch=arch Target build architecture. Must be a valid GNU arch. Default: native"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo " --cross-prefix=prefix Prefix for cross compilation (default: none)"
|
||||||
|
echo " example: aarch64-linux-gnu"
|
||||||
|
echo ""
|
||||||
echo " --enable-debug Configure for debug builds"
|
echo " --enable-debug Configure for debug builds"
|
||||||
echo " --enable-log-bt Enable support of backtrace printing in SPDK logs (requires libunwind)."
|
echo " --enable-log-bt Enable support of backtrace printing in SPDK logs (requires libunwind)."
|
||||||
echo " --enable-werror Treat compiler warnings as errors"
|
echo " --enable-werror Treat compiler warnings as errors"
|
||||||
@ -124,6 +127,9 @@ for i in "$@"; do
|
|||||||
--target-arch=*)
|
--target-arch=*)
|
||||||
CONFIG[ARCH]="${i#*=}"
|
CONFIG[ARCH]="${i#*=}"
|
||||||
;;
|
;;
|
||||||
|
--cross-prefix=*)
|
||||||
|
CONFIG[CROSS_PREFIX]="${i#*=}"
|
||||||
|
;;
|
||||||
--enable-debug)
|
--enable-debug)
|
||||||
CONFIG[DEBUG]=y
|
CONFIG[DEBUG]=y
|
||||||
;;
|
;;
|
||||||
@ -342,7 +348,7 @@ for i in "$@"; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Detect the compiler toolchain
|
# Detect the compiler toolchain
|
||||||
scripts/detect_cc.sh --cc="$CC" --cxx="$CXX" --lto="${CONFIG[LTO]}" --ld="$LD" > mk/cc.mk
|
scripts/detect_cc.sh --cc="$CC" --cxx="$CXX" --lto="${CONFIG[LTO]}" --ld="$LD" --cross-prefix="${CONFIG[CROSS_PREFIX]}" > mk/cc.mk
|
||||||
|
|
||||||
CC=$(cat mk/cc.mk | grep "CC=" | cut -d "=" -f 2)
|
CC=$(cat mk/cc.mk | grep "CC=" | cut -d "=" -f 2)
|
||||||
CC_TYPE=$(cat mk/cc.mk | grep "CC_TYPE=" | cut -d "=" -f 2)
|
CC_TYPE=$(cat mk/cc.mk | grep "CC_TYPE=" | cut -d "=" -f 2)
|
||||||
|
@ -93,6 +93,10 @@ else
|
|||||||
DPDK_CONFIG := $(TARGET_MACHINE)-native
|
DPDK_CONFIG := $(TARGET_MACHINE)-native
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_CROSS_PREFIX),)
|
||||||
|
DPDK_OPTS += CROSS=$(CONFIG_CROSS_PREFIX)-
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(OS),Linux)
|
ifeq ($(OS),Linux)
|
||||||
DPDK_CONFIG := $(DPDK_CONFIG)-linuxapp
|
DPDK_CONFIG := $(DPDK_CONFIG)-linuxapp
|
||||||
NPROC := $(shell nproc)
|
NPROC := $(shell nproc)
|
||||||
|
Loading…
Reference in New Issue
Block a user