8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation
authorihse
Mon, 12 Mar 2018 17:00:54 +0100
changeset 49204 564802b01ded
parent 49203 3a225d9cabe1
child 49205 d1a19a08389a
child 49232 81cd35f71563
8199451: Create linux-aarch64 cross-compilation devkit, and fix cross-compilation Reviewed-by: aph, erikj
make/autoconf/flags.m4
make/conf/jib-profiles.js
make/devkit/Makefile
make/devkit/Tools.gmk
--- a/make/autoconf/flags.m4	Mon Mar 12 10:04:12 2018 -0400
+++ b/make/autoconf/flags.m4	Mon Mar 12 17:00:54 2018 +0100
@@ -362,8 +362,10 @@
   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)
--- a/make/conf/jib-profiles.js	Mon Mar 12 10:04:12 2018 -0400
+++ b/make/conf/jib-profiles.js	Mon Mar 12 17:00:54 2018 +0100
@@ -232,7 +232,8 @@
     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 @@
             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 @@
         "windows-x86": {
             platform: "windows-x86",
         },
+       "linux-aarch64": {
+            platform: "linux-aarch64",
+        },
        "linux-arm64": {
             platform: "linux-arm64-vfp-hflt",
         },
@@ -781,7 +795,9 @@
         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")
--- a/make/devkit/Makefile	Mon Mar 12 10:04:12 2018 -0400
+++ b/make/devkit/Makefile	Mon Mar 12 17:00:54 2018 +0100
@@ -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 @@
 #
 # 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))
--- a/make/devkit/Tools.gmk	Mon Mar 12 10:04:12 2018 -0400
+++ b/make/devkit/Tools.gmk	Mon Mar 12 17:00:54 2018 +0100
@@ -46,6 +46,16 @@
 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 @@
 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 @@
       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 @@
 	@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 @@
 	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"' >> $@
 
 ##########################################################################################