Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# 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:
* JRE running on the EV3 - `jre-ev3.zip`
* 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).
Expand Down Expand Up @@ -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 <path on host, where the sources should be stored>:/build ev3dev-lang-java:jdk9-build
sudo docker run --rm -it -v <path on host, where the sources should be stored>:/build ev3dev-lang-java:jdk10-build
```
5. Let's fetch the OpenJDK sources:
```
Expand All @@ -65,5 +65,5 @@ sudo docker run --rm -it -v <path on host, where the sources should be stored>:/
```
./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.
2 changes: 1 addition & 1 deletion build/Dockerfile.scripts
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
14 changes: 7 additions & 7 deletions build/Dockerfile.system
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
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 \
ca-certificates \
cmake \
build-essential \
crossbuild-essential-armel \
gdb \
gdb-multiarch \
less \
man-db \
nano \
Expand All @@ -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 \
Expand All @@ -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
Expand Down
7 changes: 3 additions & 4 deletions build/apt.sources.list.debian
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions build/barrier.patch
Original file line number Diff line number Diff line change
@@ -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"
7 changes: 4 additions & 3 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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" \
Expand Down
4 changes: 2 additions & 2 deletions build/config.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 4 additions & 4 deletions build/ev3.patch
Original file line number Diff line number Diff line change
@@ -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],
[
Expand All @@ -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"
Expand Down
Binary file added build/ev3dev-archive-keyring.gpg
Binary file not shown.
5 changes: 2 additions & 3 deletions build/fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

9 changes: 5 additions & 4 deletions build/float.patch
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -22,3 +22,4 @@ diff -r b756e7a2ec33 src/cpu/arm/vm/assembler_arm_32.hpp
+#define __aeabi_dsub_glibc __aeabi_dsub
};
#endif // __SOFTFP__

10 changes: 5 additions & 5 deletions build/zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
Expand All @@ -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

Expand Down