configure
スクリプトを実行します。
bionic64:~/src/openjdk-jdk11u$ bash configure --openjdk-target=arm-linux-gnueabihf --with-jvm-variants=client,server,minimal \ --disable-warnings-as-errors --enable-headless-only --disable-manpages --with-abi-profile=arm-vfp-hflt configure: Configuration created at Thu Dec 27 09:16:02 JST 2018. checking for basename... /usr/bin/basename checking for bash... /bin/bash checking for cat... /bin/cat checking for chmod... /bin/chmod checking for cmp... /usr/bin/cmp checking for comm... /usr/bin/comm checking for cp... /bin/cp checking for cut... /usr/bin/cut checking for date... /bin/date checking for gdiff... no checking for diff... /usr/bin/diff checking for dirname... /usr/bin/dirname ... 略 ... using configure arguments '--openjdk-target=arm-linux-gnueabihf --with-jvm-variants=client,server,minimal --disable-warnings-as-errors --enable-headless-only --disable-manpages --with-abi-profile=arm-vfp-hflt'. Configuration summary: * Debug level: release * HS debug level: product * JVM variants: client server minimal * JVM features: client: 'cds cmsgc compiler1 epsilongc g1gc jfr jni-check jvmti management nmt parallelgc serialgc services vm-structs' server: 'cds cmsgc compiler1 compiler2 epsilongc g1gc jfr jni-check jvmti management nmt parallelgc serialgc services vm-structs' minimal: 'compiler1 link-time-opt minimal serialgc' * OpenJDK target: OS: linux, CPU architecture: arm, address length: 32 * Version string: 11.0.1+13-centurysys-1-MAE3xx (11.0.1) Tools summary: * Boot JDK: java version "11.0.1" 2018-10-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode) (at /usr/lib/jvm/java-11-oracle) * Toolchain: gcc (GNU Compiler Collection) * C Compiler: Version 7.3.0 (at /usr/bin/arm-linux-gnueabihf-gcc) * C++ Compiler: Version 7.3.0 (at /usr/bin/arm-linux-gnueabihf-g++) Build performance summary: * Cores to use: 16 * Memory limit: 32170 MB NOTE: You have requested to build more than one version of the JVM, which will result in longer build times.
make
でビルドを実行します。
bionic64:~/src/openjdk-jdk11u$ make jdk-image JOBS=8 Building target 'jdk-image' in configuration 'linux-arm-normal-clientANDserverANDminimal-release' Warning: No mercurial configuration present and no .src-rev Parsing 2 properties into enum-like class for jdk.compiler Compiling 7 properties into resource bundles for jdk.jshell Compiling 13 properties into resource bundles for jdk.javadoc Compiling 12 properties into resource bundles for jdk.jdeps Compiling 19 properties into resource bundles for jdk.compiler Compiling 117 files for BUILD_java.compiler.interim Compiling 1 files for BUILD_JFR_TOOLS Compiling 1 files for BUILD_JFR_TOOLS Compiling 1 files for BUILD_JFR_TOOLS Compiling 394 files for BUILD_jdk.compiler.interim ... 略 ... 注意:一部の入力ファイルは推奨されないAPIを使用またはオーバーライドしています。 注意:詳細は、-Xlint:deprecationオプションを指定して再コンパイルしてください。 注意:入力ファイルの操作のうち、未チェックまたは安全ではないものがあります。 注意:詳細は、-Xlint:uncheckedオプションを指定して再コンパイルしてください。 Creating support/demos/image/jfc/SampleTree/SampleTree.jar Creating support/demos/image/jfc/TableExample/TableExample.jar Creating support/demos/image/jfc/TransparentRuler/TransparentRuler.jar Creating support/demos/image/jfc/J2Ddemo/J2Ddemo.jar Creating jdk image Stopping sjavac server Finished building target 'jdk-image' in configuration 'linux-arm-normal-clientANDserverANDminimal-release'
ビルドが完了しました。
build/linux-arm-normal-clientANDserverANDminimal-release/images/jdk/
以下に一式があります。
bionic64:~/src/openjdk-jdk11u$ ls -ln build/linux-arm-normal-clientANDserverANDminimal-release/images/jdk/ 合計 32 drwxrwxr-x 2 1000 1000 4096 12月 27 09:30 bin drwxrwxr-x 4 1000 1000 4096 12月 27 09:30 conf drwxrwxr-x 4 1000 1000 4096 12月 27 09:30 demo drwxrwxr-x 3 1000 1000 4096 12月 27 09:30 include drwxrwxr-x 2 1000 1000 4096 12月 27 09:30 jmods drwxrwxr-x 68 1000 1000 4096 12月 27 09:30 legal drwxrwxr-x 8 1000 1000 4096 12月 27 09:30 lib -rw-rw-r-- 1 1000 1000 1099 12月 27 09:30 release
bionic64:~/src/openjdk-jdk11u$ file build/linux-arm-normal-clientANDserverANDminimal-release/images/jdk/bin/java build/linux-arm-normal-clientANDserverANDminimal-release/images/jdk/bin/java: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=27f16c3edf4d2bd688aafcd4337539e81a806717, not stripped
たしかに armhf 用バイナリができあがっていることが確認できます。
du
コマンドで容量を確認すると 885240iB1)もあるため、実機にはそのまま持ち込むことは難しそうです。
885240 build/linux-arm-normal-clientANDserverANDminimal-release/images/jdk
そこで、jlink により compact3 相当に shrink を行います。