From 11fc5a4d7301c7d7c53a4910e0c32105cff72aa3 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Mon, 12 Mar 2018 17:00:54 +0100 Subject: [PATCH] 8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation Reviewed-by: aph, erikj --- make/autoconf/flags.m4 | 6 ++++-- make/conf/jib-profiles.js | 20 ++++++++++++++++++-- make/devkit/Makefile | 11 ++++++++--- make/devkit/Tools.gmk | 29 +++++++++++++++++++++-------- 4 files changed, 51 insertions(+), 15 deletions(-) diff --git a/make/autoconf/flags.m4 b/make/autoconf/flags.m4 index a09d529068f..f16477278d7 100644 --- a/make/autoconf/flags.m4 +++ b/make/autoconf/flags.m4 @@ -362,8 +362,10 @@ AC_DEFUN_ONCE([FLAGS_POST_TOOLCHAIN], if test "x$BUILD_SYSROOT" != x; then FLAGS_SETUP_SYSROOT_FLAGS([BUILD_]) else - BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS" - BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS" + if test "x$COMPILE_TYPE" != "xcross"; then + BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS" + BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS" + fi fi AC_SUBST(BUILD_SYSROOT_CFLAGS) AC_SUBST(BUILD_SYSROOT_LDFLAGS) diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 748d8471ba0..acf4a9e6727 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -232,7 +232,8 @@ var getJibProfilesCommon = function (input, data) { common.main_profile_names = [ "linux-x64", "linux-x86", "macosx-x64", "solaris-x64", "solaris-sparcv9", "windows-x64", "windows-x86", - "linux-arm64", "linux-arm-vfp-hflt", "linux-arm-vfp-hflt-dyn" + "linux-aarch64", "linux-arm64", "linux-arm-vfp-hflt", + "linux-arm-vfp-hflt-dyn" ]; // These are the base setttings for all the main build profiles. @@ -465,6 +466,16 @@ var getJibProfilesProfiles = function (input, common, data) { configure_args: concat(common.configure_args_32bit), }, + "linux-aarch64": { + target_os: "linux", + target_cpu: "aarch64", + build_cpu: "x64", + dependencies: ["devkit", "autoconf", "build_devkit", "cups"], + configure_args: [ + "--openjdk-target=aarch64-linux-gnu" + ], + }, + "linux-arm64": { target_os: "linux", target_cpu: "aarch64", @@ -582,6 +593,9 @@ var getJibProfilesProfiles = function (input, common, data) { "windows-x86": { platform: "windows-x86", }, + "linux-aarch64": { + platform: "linux-aarch64", + }, "linux-arm64": { platform: "linux-arm64-vfp-hflt", }, @@ -781,7 +795,9 @@ var getJibProfilesDependencies = function (input, common) { solaris_x64: "SS12u4-Solaris11u1+1.0", solaris_sparcv9: "SS12u4-Solaris11u1+1.1", windows_x64: "VS2013SP4+1.0", - linux_aarch64: "gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux+1.0", + linux_aarch64: (input.profile != null && input.profile.indexOf("arm64") >= 0 + ? "gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux+1.0" + : "gcc7.3.0-Fedora27+1.0"), linux_arm: (input.profile != null && input.profile.indexOf("hflt") >= 0 ? "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0" : "arm-linaro-4.7+1.0") diff --git a/make/devkit/Makefile b/make/devkit/Makefile index 32fa6f5212e..1bd37951fd3 100644 --- a/make/devkit/Makefile +++ b/make/devkit/Makefile @@ -41,7 +41,7 @@ # To build the full set of crosstools for additional platforms, use a command # line looking like this: # -# make tars platforms="x86_64-unknown-linux-gnu sparc64-unknown-linux-gnu" +# make cross_compile_target="aarch64-linux-gnu" BASE_OS=Fedora27 # # This is the makefile which iterates over all host and target platforms. # @@ -57,8 +57,13 @@ $(info Building on platform $(me)) # # By default just build for the current platform, which is assumed to be Linux # -platforms := $(me) -host_platforms := $(platforms) +ifeq ($(cross_compile_target), ) + platforms := $(me) + host_platforms := $(platforms) +else + platforms := $(cross_compile_target) + host_platforms := $(me) +endif target_platforms := $(platforms) $(info host_platforms $(host_platforms)) $(info target_platforms $(target_platforms)) diff --git a/make/devkit/Tools.gmk b/make/devkit/Tools.gmk index 126b0265fa0..82c5337c267 100644 --- a/make/devkit/Tools.gmk +++ b/make/devkit/Tools.gmk @@ -46,6 +46,16 @@ $(info BUILD=$(BUILD)) ARCH := $(word 1,$(subst -, ,$(TARGET))) $(info ARCH=$(ARCH)) +ifeq ($(BASE_OS), OEL6) + OEL_URL := http://yum.oracle.com/repo/OracleLinux/OL6/4/base/$(ARCH)/ + LINUX_VERSION := OEL6.4 +else ifeq ($(BASE_OS), Fedora27) + OEL_URL := https://dl.fedoraproject.org/pub/fedora-secondary/releases/27/Everything/$(ARCH)/os/Packages/ + LINUX_VERSION := Fedora 27 +else + $(error Unknown base OS $(BASE_OS)) +endif + ########################################################################################## # Define external dependencies @@ -79,10 +89,7 @@ GMP := http://ftp.gnu.org/pub/gnu/gmp/${gmp_ver}.tar.bz2 MPC := http://ftp.gnu.org/pub/gnu/mpc/${mpc_ver}.tar.gz GDB := http://ftp.gnu.org/gnu/gdb/${gdb_ver}.tar.xz -OEL_URL := http://yum.oracle.com/repo/OracleLinux/OL6/4/base/$(ARCH)/ - -# RPMs in OEL6.4 -LINUX_VERSION := OEL6.4 +# RPMs used by all BASE_OS RPM_LIST := \ kernel-headers \ glibc glibc-headers glibc-devel \ @@ -180,10 +187,10 @@ ifeq ($(ARCH),x86_64) RPM_ARCHS += i386 i686 endif endif -else ifeq ($(ARCH),i686)) - RPM_ARCHS := i386 i686 +else ifeq ($(ARCH),i686) + RPM_ARCHS := i386 i686 noarch else - RPM_ARCHS := $(ARCH) + RPM_ARCHS := $(ARCH) noarch endif RPM_FILE_LIST := $(sort $(foreach a, $(RPM_ARCHS), \ @@ -453,6 +460,12 @@ ifeq ($(HOST), $(TARGET)) @echo 'done' $(gdb): $(gcc) +else + $(BUILDDIR)/$(gdb_ver)/Makefile: + $(info Faking $@, not used when cross-compiling) + mkdir -p $(@D) + echo "install:" > $@ + @echo 'done' endif ########################################################################################## @@ -531,7 +544,7 @@ $(PREFIX)/devkit.info: FRC echo '' >> $@ echo 'DEVKIT_NAME="$(gcc_ver) - $(LINUX_VERSION)"' >> $@ echo 'DEVKIT_TOOLCHAIN_PATH="$$DEVKIT_ROOT/bin"' >> $@ - echo 'DEVKIT_SYSROOT="$$DEVKIT_ROOT/$$host/sysroot"' >> $@ + echo 'DEVKIT_SYSROOT="$$DEVKIT_ROOT/$(TARGET)/sysroot"' >> $@ echo 'DEVKIT_EXTRA_PATH="$$DEVKIT_ROOT/bin"' >> $@ ##########################################################################################