09-13-2016, 09:42 PM
This is a fun rabbit hole.
1) Installed Gradle
- sudo apt install gradle
2) installed Git
- sudo apt install git
3) downloaded project to /home/openhab as described on GIT repo
- git clone https://github.com/NeuronRobotics/nrjavaserial.git
4) Thought I'd look up how to activate UART2, found this post
- http://forum.pine64.org/archive/index.ph...d-648.html
5) Realized I needed the dtc command, tried "device-tree-compiler" and it seemed to work
- sudo apt install device-tree-compiler
6) re-tried enabling UART2
- sudo mv /boot/pine64/sun50i-a64-pine64-plus.dtb /boot/pine64/sun50i-a64-pine64-plus.dtb-ORIG
- sudo dtc -I dtb -O dts -o sun50i-a64-pine64-plus.dts /boot/pine64/sun50i-a64-pine64-plus.dtb-ORIG
- sudo vi sun50i-a64-pine64-plus.dts
7) realized the status was already "okay"
8) tried to build project (took a few minutes)
- cd nrjavaserial
- gradle build
9) needed Make
- sudo apt install build-essential
10) attempt make again
- make arm
11) Backup openhab
- cd /opt
- sudo cp -R openhab openhab_bak
12) stop openhab
- sudo service openhab
13) Realize that 'make arm' failed,
- In file included from src/fuserImp.c:4:0:
./include/target/gnu_io_CommPortIdentifier.h:2:17: fatal error: jni.h: No such file or directory
- Tried to install jni packages through apt (didn't work)
- Noticed the messages were saying "-I/usr/lib/jvm/java-6-openjdk-armhf/include/", I didn't have openjdk 6 installd (its not avaible via apt)
14) modified src/main/c/Makefile on line 20
- add "-I/usr/lib/jvm/java-8-oracle/include/ -I/usr/lib/jvm/java-8-oracle/include/linux/"
15) Had more build problems... ran across this conversation
- https://community.openhab.org/t/64-bit-a...al/8493/15
16) Downloaded and installed liblockdev1 and liblockdev1-dev
- wget https://launchpad.net/ubuntu/+source/loc..._arm64.deb
- wget http://launchpadlibrarian.net/230433667/..._arm64.deb
- sudo dpkg -i liblockdev1-dev_1.0.3-1.6build2_arm64.deb liblockdev1_1.0.3-1.6build2_arm64.deb
17) Backed up jar from openhab & copied in new jar. (sure hope the version mismatch doesn't cause a problem.
- cp openhab/userdata/cache/org.eclipse.osgi/204/0/.cp/lib/nrjavaserial-3.9.3.jar openhab/
- cp ~/nrjavaserial/build/libs/nrjavaserial-3.12.0.jar openhab/userdata/cache/org.eclipse.osgi/204/0/.cp/lib/nrjavaserial-3.9.3.jar
18) Grr, had to copy an .so into userdata/tmp/libNRJavaSerial_openhab_0
- unzip /home/openhab/nrjavaserial/build/libs/nrjavaserial-3.12.0.jar native/linux/ARM/libNRJavaSerial.so -f /opt/openhab/userdata/tmp/libNRJavaSerial_openhab_0
19) restart service
20) test....
21) garbage --- error message says "ELFCLASS32" !!! that means I need to use a 32-bit JVM instead of 64-bit.
- Ran across this info in a post by xpomul - https://community.openhab.org/t/64-bit-a...al/8493/40
- Looks like these are 64-bit JVM compatible https://github.com/xsnrg/ARM64
So, after all that it seems changing to a 32-bit JVM (I downloaded the 1.8.0_101 build from oracle) and adding -Dgnu.io.rxtx.SerialPorts=/dev/ttyS2 to runtime/karafe/bin/setenv does the trick.
Or, you can muscle in the 64-bit jar & *.so file...
Note: This is my initial impression. The 32-bit JVM starts OpenHAB a lot faster than the 64-bit JVM. I have noticed this at my day job and have found lots of references to apps running 10% slower on 64-bit JVM's because of 64-bit pointers. With the Pine64 having less than 4GB of ram, there's no reason to use a 64-bit JVM.
WARNING: I'm a Java Developer by day, but this hacking new hardware at night is just my hobby. This might not be the right way to get this to work
1) Installed Gradle
- sudo apt install gradle
2) installed Git
- sudo apt install git
3) downloaded project to /home/openhab as described on GIT repo
- git clone https://github.com/NeuronRobotics/nrjavaserial.git
4) Thought I'd look up how to activate UART2, found this post
- http://forum.pine64.org/archive/index.ph...d-648.html
5) Realized I needed the dtc command, tried "device-tree-compiler" and it seemed to work
- sudo apt install device-tree-compiler
6) re-tried enabling UART2
- sudo mv /boot/pine64/sun50i-a64-pine64-plus.dtb /boot/pine64/sun50i-a64-pine64-plus.dtb-ORIG
- sudo dtc -I dtb -O dts -o sun50i-a64-pine64-plus.dts /boot/pine64/sun50i-a64-pine64-plus.dtb-ORIG
- sudo vi sun50i-a64-pine64-plus.dts
7) realized the status was already "okay"
8) tried to build project (took a few minutes)
- cd nrjavaserial
- gradle build
9) needed Make
- sudo apt install build-essential
10) attempt make again
- make arm
11) Backup openhab
- cd /opt
- sudo cp -R openhab openhab_bak
12) stop openhab
- sudo service openhab
13) Realize that 'make arm' failed,
- In file included from src/fuserImp.c:4:0:
./include/target/gnu_io_CommPortIdentifier.h:2:17: fatal error: jni.h: No such file or directory
- Tried to install jni packages through apt (didn't work)
- Noticed the messages were saying "-I/usr/lib/jvm/java-6-openjdk-armhf/include/", I didn't have openjdk 6 installd (its not avaible via apt)
14) modified src/main/c/Makefile on line 20
- add "-I/usr/lib/jvm/java-8-oracle/include/ -I/usr/lib/jvm/java-8-oracle/include/linux/"
15) Had more build problems... ran across this conversation
- https://community.openhab.org/t/64-bit-a...al/8493/15
16) Downloaded and installed liblockdev1 and liblockdev1-dev
- wget https://launchpad.net/ubuntu/+source/loc..._arm64.deb
- wget http://launchpadlibrarian.net/230433667/..._arm64.deb
- sudo dpkg -i liblockdev1-dev_1.0.3-1.6build2_arm64.deb liblockdev1_1.0.3-1.6build2_arm64.deb
17) Backed up jar from openhab & copied in new jar. (sure hope the version mismatch doesn't cause a problem.
- cp openhab/userdata/cache/org.eclipse.osgi/204/0/.cp/lib/nrjavaserial-3.9.3.jar openhab/
- cp ~/nrjavaserial/build/libs/nrjavaserial-3.12.0.jar openhab/userdata/cache/org.eclipse.osgi/204/0/.cp/lib/nrjavaserial-3.9.3.jar
18) Grr, had to copy an .so into userdata/tmp/libNRJavaSerial_openhab_0
- unzip /home/openhab/nrjavaserial/build/libs/nrjavaserial-3.12.0.jar native/linux/ARM/libNRJavaSerial.so -f /opt/openhab/userdata/tmp/libNRJavaSerial_openhab_0
19) restart service
20) test....
21) garbage --- error message says "ELFCLASS32" !!! that means I need to use a 32-bit JVM instead of 64-bit.
- Ran across this info in a post by xpomul - https://community.openhab.org/t/64-bit-a...al/8493/40
- Looks like these are 64-bit JVM compatible https://github.com/xsnrg/ARM64
So, after all that it seems changing to a 32-bit JVM (I downloaded the 1.8.0_101 build from oracle) and adding -Dgnu.io.rxtx.SerialPorts=/dev/ttyS2 to runtime/karafe/bin/setenv does the trick.
Or, you can muscle in the 64-bit jar & *.so file...
Note: This is my initial impression. The 32-bit JVM starts OpenHAB a lot faster than the 64-bit JVM. I have noticed this at my day job and have found lots of references to apps running 10% slower on 64-bit JVM's because of 64-bit pointers. With the Pine64 having less than 4GB of ram, there's no reason to use a 64-bit JVM.
WARNING: I'm a Java Developer by day, but this hacking new hardware at night is just my hobby. This might not be the right way to get this to work