|
| 1 | +# OpenJDK for EV3 |
| 2 | +A custom build of OpenJDK 9 & 10 for EV3, a Lego Mindstorms programmable brick featuring a ARM926EJ-S CPU. |
| 3 | + |
| 4 | +## Components |
| 5 | +The output consists of these parts: |
| 6 | +* JRE running on the EV3 - `jre-ev3.zip` |
| 7 | + * Stripped down version -- a runtime image |
| 8 | +* JDK built for the EV3 - `jdk-ev3.zip` |
| 9 | + * Basically the full build |
| 10 | +* EV3 jmods |
| 11 | + * It can be used for creating custom JRE images. |
| 12 | + |
| 13 | +## Building |
| 14 | + |
| 15 | +0. Clone/download this repo to your computer. |
| 16 | +1. Install [Docker](https://docs.docker.com/engine/installation/) for your operating system. |
| 17 | +2. Adjust the JAVA_VERSION variable in `jdkX/config.sh` to match the current OpenJDK tip: |
| 18 | + * [OpenJDK 9 updates](http://hg.openjdk.java.net/jdk-updates/jdk9u/) repo |
| 19 | + * [OpenJDK 10 updates](http://hg.openjdk.java.net/jdk-updates/jdk10u/) repo |
| 20 | +3. Build the jdk cross-compilation environment: |
| 21 | + * For JDK9: |
| 22 | +```sh |
| 23 | +sudo docker build -t ev3dev-lang-java:jdk9-stretch -f jdk9/Dockerfile.system build |
| 24 | +sudo docker build -t ev3dev-lang-java:jdk9-build -f jdk9/Dockerfile.scripts build |
| 25 | +``` |
| 26 | + * For JDK10: |
| 27 | +```sh |
| 28 | +sudo docker build -t ev3dev-lang-java:jdk10-stretch -f jdk10/Dockerfile.system build |
| 29 | +sudo docker build -t ev3dev-lang-java:jdk10-build -f jdk10/Dockerfile.scripts build |
| 30 | +``` |
| 31 | +4. Run the newly prepared container. You have to mount a host directory to the the `/build` directory in the container, |
| 32 | +otherwise the build would get discarded. The final build needs at least 6.5 GB of free space (in the build directory). |
| 33 | + * For JDK9: |
| 34 | +``` |
| 35 | +sudo docker run --rm -it -v <path on host, where the sources should be stored>:/build ev3dev-lang-java:jdk9-build |
| 36 | +``` |
| 37 | + * For JDK10: |
| 38 | +``` |
| 39 | +sudo docker run --rm -it -v <path on host, where the sources should be stored>:/build ev3dev-lang-java:jdk10-build |
| 40 | +``` |
| 41 | +5. Let's fetch the OpenJDK sources: |
| 42 | +``` |
| 43 | +./fetch.sh |
| 44 | +``` |
| 45 | +6. The OpenJDK source tree should be ready. Now you can start the cross-build itself: |
| 46 | +``` |
| 47 | +./build.sh |
| 48 | +``` |
| 49 | +7. Create the zipped images: |
| 50 | +``` |
| 51 | +./zip.sh |
| 52 | +``` |
| 53 | +8. If the build was successful, JDK packages were created in `/build/jre-ev3.tar.gz`, `/build/jdk-ev3.tar.gz` and `/build/jmods.tar.gz`. |
| 54 | +If you have mounted `/build`, you can access the files from the host. |
| 55 | + |
| 56 | +## ~~JShell on the EV3~~ |
| 57 | + |
| 58 | +No longer supported. JShell backend on the EV3 is a huge overkill. |
0 commit comments