diff --git a/CONFIG b/CONFIG index e2bb8a358..1a1515e73 100644 --- a/CONFIG +++ b/CONFIG @@ -37,6 +37,9 @@ CONFIG_PREFIX="/usr/local" # Target architecture CONFIG_ARCH=native +# Prefix for cross compilation +CONFIG_CROSS_PREFIX= + # Build with debug logging. Turn off for performance testing and normal usage CONFIG_DEBUG=n diff --git a/configure b/configure index 2669cbbef..7c7d7f583 100755 --- a/configure +++ b/configure @@ -18,6 +18,9 @@ function usage() 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 "" + 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-log-bt Enable support of backtrace printing in SPDK logs (requires libunwind)." echo " --enable-werror Treat compiler warnings as errors" @@ -124,6 +127,9 @@ for i in "$@"; do --target-arch=*) CONFIG[ARCH]="${i#*=}" ;; + --cross-prefix=*) + CONFIG[CROSS_PREFIX]="${i#*=}" + ;; --enable-debug) CONFIG[DEBUG]=y ;; @@ -342,7 +348,7 @@ for i in "$@"; do done # 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_TYPE=$(cat mk/cc.mk | grep "CC_TYPE=" | cut -d "=" -f 2) diff --git a/dpdkbuild/Makefile b/dpdkbuild/Makefile index e086998ed..e458af28a 100644 --- a/dpdkbuild/Makefile +++ b/dpdkbuild/Makefile @@ -93,6 +93,10 @@ else DPDK_CONFIG := $(TARGET_MACHINE)-native endif +ifneq ($(CONFIG_CROSS_PREFIX),) +DPDK_OPTS += CROSS=$(CONFIG_CROSS_PREFIX)- +endif + ifeq ($(OS),Linux) DPDK_CONFIG := $(DPDK_CONFIG)-linuxapp NPROC := $(shell nproc)