diff --git a/README.md b/README.md index bc378b8..911f345 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# openjdk-9-ev3 -A custom build of OpenJDK 9 for EV3, a Lego Mindstorms programmable brick featuring a ARM926EJ-S CPU. +# OpenJDK 10 for EV3 +A custom build of OpenJDK 10 for EV3, a Lego Mindstorms programmable brick featuring a ARM926EJ-S CPU. ## Components The output consists of these parts: @@ -7,7 +7,7 @@ The output consists of these parts: * Stripped down version -- a runtime image * JDK built for the EV3 - `jdk-ev3.zip` * Basically the full build -* [Official OpenJDK linux-amd64](http://jdk.java.net/9/) with EV3 jmods +* [Official OpenJDK linux-amd64](http://jdk.java.net/10/) with EV3 jmods * Only a stripped down version -- also a runtime image * It can be used for creating custom JRE images. For this, jlink and the ev3 jmods are included. * It has `javac` (jdk.compiler module). @@ -42,16 +42,16 @@ JShell JDI agent on the remote side, which is handled by SSH as well. 0. Clone/download this repo to your computer. 1. Install [Docker](https://docs.docker.com/engine/installation/) for your operating system. -2. Adjust the JAVA_VERSION variable in `build/config.sh` to match the current OpenJDK tip: [OpenJDK 9 updates](http://hg.openjdk.java.net/jdk-updates/jdk9u/) -3. Build the jdk9 cross-compilation environment: +2. Adjust the JAVA_VERSION variable in `build/config.sh` to match the current OpenJDK tip: [OpenJDK 10 updates](http://hg.openjdk.java.net/jdk-updates/jdk10u/) +3. Build the jdk cross-compilation environment: ```sh -sudo docker build -t ev3dev-lang-java:jdk9-system -f build/Dockerfile.system build -sudo docker build -t ev3dev-lang-java:jdk9-build -f build/Dockerfile.scripts build +sudo docker build -t ev3dev-lang-java:jdk10-stretch -f build/Dockerfile.system build +sudo docker build -t ev3dev-lang-java:jdk10-build -f build/Dockerfile.scripts build ``` 4. Run the newly prepared container. You have to mount a host directory to the the `/build` directory in the container, otherwise the build would get discarded. The final build needs at least 6.5 GB of free space (in the build directory). ``` -sudo docker run --rm -it -v :/build ev3dev-lang-java:jdk9-build +sudo docker run --rm -it -v :/build ev3dev-lang-java:jdk10-build ``` 5. Let's fetch the OpenJDK sources: ``` @@ -65,5 +65,5 @@ sudo docker run --rm -it -v :/ ``` ./zip.sh ``` -8. If the build was successful, JDK9 packages were created in `/build/jre-ev3.zip`, `/build/jdk-ev3.zip` and `/build/jdk-pc.zip`. +8. If the build was successful, JDK packages were created in `/build/jre-ev3.zip`, `/build/jdk-ev3.zip` and `/build/jdk-pc.zip`. If you have mounted `/build`, you can access the files from the host. diff --git a/build/Dockerfile.scripts b/build/Dockerfile.scripts index b5fcb3e..8f15d8a 100644 --- a/build/Dockerfile.scripts +++ b/build/Dockerfile.scripts @@ -1,4 +1,4 @@ -FROM ev3dev-lang-java:jdk9-system +FROM ev3dev-lang-java:jdk10-stretch # copy build patches & scripts COPY *.patch *.sh /opt/jdkcross/ diff --git a/build/Dockerfile.system b/build/Dockerfile.system index 751464c..f2f73bd 100644 --- a/build/Dockerfile.system +++ b/build/Dockerfile.system @@ -1,12 +1,11 @@ -FROM debian:jessie +FROM debian:stretch -# this is a customized version of ev3dev-jessie-cross image +# this is a customized version of ev3dev-stretch-cross image # setup repositories and install required packages COPY apt.sources.list.debian /etc/apt/sources.list +COPY ev3dev-archive-keyring.gpg /etc/apt/trusted.gpg.d/ RUN dpkg --add-architecture armel && \ - apt-key adv --keyserver pgp.mit.edu --recv-keys D57D95AF93178A7C && \ - apt-key adv --keyserver pgp.mit.edu --recv-keys 7DE089671804772E && \ apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends \ bash-completion \ @@ -14,7 +13,7 @@ RUN dpkg --add-architecture armel && \ cmake \ build-essential \ crossbuild-essential-armel \ - gdb \ + gdb-multiarch \ less \ man-db \ nano \ @@ -27,6 +26,7 @@ RUN dpkg --add-architecture armel && \ xz-utils \ libcups2-dev:armel \ libfreetype6-dev:armel \ + libfontconfig1-dev:armel \ libasound2-dev:armel \ libx11-dev:armel \ libxext-dev:armel \ @@ -49,9 +49,9 @@ RUN dpkg --add-architecture armel && \ mercurial \ zlib1g-dev -# download JDK 9 +# download JDK 10 RUN mkdir /opt/jdkcross -RUN curl -SL http://download.java.net/java/GA/jdk9/9.0.1/binaries/openjdk-9.0.1_linux-x64_bin.tar.gz | tar -xzC /opt/jdkcross +RUN curl -SL https://download.java.net/java/GA/jdk10/10/binaries/openjdk-10_linux-x64_bin.tar.gz | tar -xzC /opt/jdkcross # prepare a nonroot user COPY compiler.sudoers /etc/sudoers.d/compiler diff --git a/build/apt.sources.list.debian b/build/apt.sources.list.debian index 86ede93..a9b855c 100644 --- a/build/apt.sources.list.debian +++ b/build/apt.sources.list.debian @@ -1,4 +1,3 @@ -deb http://ftp.debian.org/debian jessie main contrib non-free -deb http://security.debian.org/ jessie/updates main contrib non-free -deb http://archive.ev3dev.org/debian jessie main -deb http://emdebian.org/tools/debian/ jessie main +deb http://deb.debian.org/debian stretch main contrib non-free +deb http://deb.debian.org/debian-security stretch/updates main contrib non-free +deb http://archive.ev3dev.org/debian stretch main diff --git a/build/barrier.patch b/build/barrier.patch new file mode 100644 index 0000000..2cdd255 --- /dev/null +++ b/build/barrier.patch @@ -0,0 +1,21 @@ +diff -r b09e56145e11 src/hotspot/os_cpu/linux_arm/orderAccess_linux_arm.inline.hpp +--- a/src/hotspot/os_cpu/linux_arm/orderAccess_linux_arm.inline.hpp Thu Mar 08 04:23:31 2018 +0000 ++++ b/src/hotspot/os_cpu/linux_arm/orderAccess_linux_arm.inline.hpp Tue Mar 27 22:40:37 2018 +0200 +@@ -71,7 +71,7 @@ + __asm__ volatile ( + ".word 0xF57FF050 | 0xf" : : : "memory"); + #endif +- } else { ++ } else if (VM_Version::arm_arch() == 6) { + intptr_t zero = 0; + __asm__ volatile ( + "mcr p15, 0, %0, c7, c10, 5" +@@ -95,7 +95,7 @@ + __asm__ volatile ( + ".word 0xF57FF050 | 0xe" : : : "memory"); + #endif +- } else { ++ } else if (VM_Version::arm_arch() == 6) { + intptr_t zero = 0; + __asm__ volatile ( + "mcr p15, 0, %0, c7, c10, 5" diff --git a/build/build.sh b/build/build.sh index 63dcc8b..e040717 100644 --- a/build/build.sh +++ b/build/build.sh @@ -7,7 +7,7 @@ source config.sh cd "$JDKDIR" # refresh patched build system -bash ./common/autoconf/autogen.sh +bash ./make/autoconf/autogen.sh ## Description ## # Use the downloaded JDK: --with-boot-jdk=/opt/jdkcross/jdk-9.0.1 @@ -27,14 +27,15 @@ bash ./common/autoconf/autogen.sh # BUILD_NM="gcc-nm" # configure the build -bash ./configure --with-boot-jdk="$SCRIPTDIR/jdk-9.0.1" \ +bash ./configure --with-boot-jdk="$SCRIPTDIR/jdk-10" \ --openjdk-target=arm-linux-gnueabi \ --with-abi-profile=arm-ev3 \ --enable-headless-only \ --with-freetype-lib=/usr/lib/arm-linux-gnueabi \ --with-freetype-include=/usr/include \ --with-jvm-variants=client \ - --with-extra-cflags="-Wno-maybe-uninitialized -D__SOFTFP__" \ + --with-extra-cflags="-w -Wno-error -D__SOFTFP__" \ + --with-extra-cxxflags="-w -Wno-error -D__SOFTFP__" \ --with-version-string="$JAVA_VERSION" \ AR="arm-linux-gnueabi-gcc-ar" \ NM="arm-linux-gnueabi-gcc-nm" \ diff --git a/build/config.sh b/build/config.sh index 6890053..2bc6930 100644 --- a/build/config.sh +++ b/build/config.sh @@ -1,7 +1,7 @@ #!/bin/bash -JAVA_VERSION="10+23" -JAVA_REPO="http://hg.openjdk.java.net/jdk10/jdk10/" +JAVA_VERSION="10+46" +JAVA_REPO="http://hg.openjdk.java.net/jdk-updates/jdk10u/" SCRIPTDIR="/opt/jdkcross" BUILDDIR="/build" diff --git a/build/ev3.patch b/build/ev3.patch index 22117d2..bc046e6 100644 --- a/build/ev3.patch +++ b/build/ev3.patch @@ -1,6 +1,6 @@ -diff -r a08cbfc0e4ec common/autoconf/flags.m4 ---- a/common/autoconf/flags.m4 Thu Aug 03 18:56:56 2017 +0000 -+++ b/common/autoconf/flags.m4 Wed Dec 27 00:52:44 2017 +0100 +diff -r b09e56145e11 make/autoconf/flags.m4 +--- a/make/autoconf/flags.m4 Thu Mar 08 04:23:31 2018 +0000 ++++ b/make/autoconf/flags.m4 Tue Mar 27 22:42:02 2018 +0200 @@ -30,7 +30,7 @@ AC_DEFUN([FLAGS_SETUP_ABI_PROFILE], [ @@ -20,7 +20,7 @@ diff -r a08cbfc0e4ec common/autoconf/flags.m4 elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv5-vfp-sflt; then ARM_FLOAT_TYPE=vfp-sflt ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm' -@@ -1305,6 +1308,8 @@ +@@ -1378,6 +1381,8 @@ if test "x$OPENJDK_$1_OS" = xlinux; then if test "x$OPENJDK_$1_CPU" = xx86; then $2JVM_ASFLAGS="[$]$2JVM_ASFLAGS -march=i586" diff --git a/build/ev3dev-archive-keyring.gpg b/build/ev3dev-archive-keyring.gpg new file mode 100644 index 0000000..b095dfb Binary files /dev/null and b/build/ev3dev-archive-keyring.gpg differ diff --git a/build/fetch.sh b/build/fetch.sh index b652fac..8fe1fc6 100644 --- a/build/fetch.sh +++ b/build/fetch.sh @@ -9,11 +9,10 @@ hg clone "$JAVA_REPO" "$JDKDIR" # clone the rest of the tree cd "$JDKDIR" -bash ./get_source.sh # apply the EV3-specific patches # - build flags for arm926ej-s -patch -p1 < "$SCRIPTDIR/ev3.patch" +patch -p1 < "$SCRIPTDIR/ev3.patch" # - use the system-provided floating point implementation -patch -p1 -d hotspot < "$SCRIPTDIR/float.patch" +patch -p1 < "$SCRIPTDIR/float.patch" diff --git a/build/float.patch b/build/float.patch index 6fc107f..9dee69a 100644 --- a/build/float.patch +++ b/build/float.patch @@ -1,7 +1,7 @@ -diff -r b756e7a2ec33 src/cpu/arm/vm/assembler_arm_32.hpp ---- a/src/cpu/arm/vm/assembler_arm_32.hpp Thu Aug 03 18:56:57 2017 +0000 -+++ b/src/cpu/arm/vm/assembler_arm_32.hpp Wed Dec 27 01:08:37 2017 +0100 -@@ -1234,10 +1234,17 @@ +diff -r b09e56145e11 src/hotspot/cpu/arm/assembler_arm_32.hpp +--- a/src/hotspot/cpu/arm/assembler_arm_32.hpp Thu Mar 08 04:23:31 2018 +0000 ++++ b/src/hotspot/cpu/arm/assembler_arm_32.hpp Tue Mar 27 22:41:24 2018 +0200 +@@ -1239,10 +1239,17 @@ // Imported code from glibc soft-fp bundle for // calculation accuracy improvement. See CR 6757269. @@ -22,3 +22,4 @@ diff -r b756e7a2ec33 src/cpu/arm/vm/assembler_arm_32.hpp +#define __aeabi_dsub_glibc __aeabi_dsub }; #endif // __SOFTFP__ + diff --git a/build/zip.sh b/build/zip.sh index 282ce0a..ab250fd 100644 --- a/build/zip.sh +++ b/build/zip.sh @@ -14,7 +14,7 @@ rm -rf ./jshell-support rm -f ./jdk-ev3 # build ev3 runtime image -"$SCRIPTDIR/jdk-9.0.1/bin/jlink" \ +"$SCRIPTDIR/jdk-10/bin/jlink" \ --module-path ./jmods/ \ --endian little \ --compress 0 \ @@ -25,8 +25,8 @@ rm -f ./jdk-ev3 --output ./jre-ev3 # build microjdk -"$SCRIPTDIR/jdk-9.0.1/bin/jlink" \ - --module-path "$SCRIPTDIR/jdk-9.0.1/jmods" \ +"$SCRIPTDIR/jdk-10/bin/jlink" \ + --module-path "$SCRIPTDIR/jdk-10/jmods" \ --compress 2 \ --strip-debug \ --no-header-files \ @@ -41,8 +41,8 @@ ln -s ./jdk ./jdk-ev3 # JShell hack mkdir jshell-support -"$SCRIPTDIR/jdk-9.0.1/bin/javac" -d ./jshell-support "$SCRIPTDIR/jshellhack/DumpPort.java" -"$SCRIPTDIR/jdk-9.0.1/bin/jar" cf ./jshellhack.jar -C ./jshell-support jshellhack/DumpPort.class +"$SCRIPTDIR/jdk-10/bin/javac" -d ./jshell-support "$SCRIPTDIR/jshellhack/DumpPort.java" +"$SCRIPTDIR/jdk-10/bin/jar" cf ./jshellhack.jar -C ./jshell-support jshellhack/DumpPort.class cp ./jshellhack.jar ./jdk-pc/bin cp "$SCRIPTDIR/jshell-launch.sh" ./jdk-pc/bin