You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+86-2Lines changed: 86 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,8 +26,92 @@ Current (February 2022) there is no JDK17 for armv6.
26
26
## Build the JDK on your own
27
27
28
28
You can build your JDK on your own. Go to releases on the official repository https://github.com/openjdk/jdk/tags and select your desired version. For this repo I've chosen https://github.com/openjdk/jdk/releases/tag/jdk-17-ga
29
-
Download the source code and extract it
29
+
Download the source code and extract it.
30
+
31
+
We use Debian to build the JDK. This tutorial is based on https://github.com/openjdk/jdk17/blob/master/doc/building.md#cross-compiling-with-debian-sysroots
32
+
33
+
### Crosscompiler for Raspberry PI Zero W
34
+
35
+
You need a fitting crosscompiler to compile. There is currently none working so we have to build one ourselves. That is part of another article an Repo. You find the build instructions as well a ready to go download there https://github.com/JsBergbau/GCC-cross-compiler-for-Raspberry-PI-Zero-W
36
+
37
+
The path of the cross compiler matters. It has to be put into `/opt/cross-pi-gcc/`
38
+
39
+
### System requirements for building OpenJDK for armv6
40
+
41
+
You need at least about 7 GB free diskspace. With packing files and stuff like that I recommend at least 10 GB free space, better 15 GB. A fast SSD is very helpful. A VirtualBox Debian is quite useful for compiling.
42
+
43
+
Memory, the more the better. I think it should be at least 4 GB, I've configured the VM with 15 GB, because there is enough RAM in my machine.
44
+
45
+
There are some prequisites required. Please install them via:
46
+
`sudo apt install qemu-user-static debootstrap autoconf unzip zip libz-dev openjdk-17-jdkjava`
47
+
48
+
### Building OpenJDK on Debian x64 bullseye
49
+
50
+
`cd` to your home directory (or any other you like). In the following we use the home directory for the builds.
sh ./configure --openjdk-target=arm-linux-gnueabihf --with-sysroot=/home/pi/sysroot-armhf --with-abi-profile=armv6-vfp-hflt --with-num-cores=12 --with-memory-size=14000 --with-native-debug-symbols=zipped --with-jvm-variants=client
86
+
make images
87
+
```
88
+
89
+
The last step takes a while. I think about 7 to 15 minutes (didn't measure the time) on a Ryzen 5 Pro 5650GE.
90
+
91
+
Lets explain the options
92
+
*`openjdk-target=arm-linux-gnueabihf` for Raspberry PI Zero W which is armv6hf
93
+
*`--with-sysroot=/home/pi/sysroot-armhf` There are the header files for the target system
94
+
*`--with-abi-profile=armv6-vfp-hflt` for Raspberry PI Zero W which is armv6hf
95
+
*`-with-num-cores=12` This is just to speed up build process. The more cores, the more memory you need
96
+
*`--with-memory-size=14000` maximum memory size that should be used for the build process
97
+
*`--with-native-debug-symbols=zipped` in case you need Debug symbols. I've removed them in the download file.
98
+
*`--with-jvm-variants=client` That is very important. Without this you will get ```Error occurred during initialization of VM
99
+
Server VM is only supported on ARMv7+ VFP```
100
+
101
+
Your JDK is now in `~/jdk-jdk-17-ga/build/linux-arm-client-release/images/jdk`
102
+
If you don't need debug information use
103
+
*`find . -iname '*.diz' -delete` to delete all debug information files
104
+
*`find . -exec strip --strip-debug {} +` to remove debugging information in executable files, if there are. Prints a lot of errors. If someone has a better version please open a pullrequest or issue.
105
+
106
+
You can now pack your distribution `tar cfz jdk.tar.gz jdk`. With this method executable bits are preserved.
107
+
108
+
Distribute VM to your target system and have fun.
109
+
110
+
I used this VM to run https://github.com/AsamK/signal-cli on a Raspberry PI Zero W and it works. You have to install rust on Raspberry PI and compile the native signal-client library on the Raspberry PI Zero W. This took about 193 minutes, about 3,25 hours. But after that it works. For more details of how to build, see https://github.com/AsamK/signal-cli/wiki/Provide-native-lib-for-libsignal
111
+
112
+
113
+
114
+
30
115
31
-
You need a fitting crosscompiler to compile. There is currently none working so we have to build one ourselves. That is part of another article an Repo.
0 commit comments