Visionfive 2 risc-v

Hi Folks

Wanted to try something different as a challenge and as I have a visionfire 2 and a few other bits plan to see if RiscV is ready for the smart home

Dose anyone have experience with getting OH working on VF2 reading around seems can be done via diet pi

I don’t know board you mention, but I am pretty sure you can run Java on risc architecture. One of most problematic platforms I recall was MIPS/MIPSEL mainly due to constrained hardware. Yet it got better support with loongson arch which used MIPS as a base, leading to jvm port GitHub - loongson/jdk: LoongArch port based on the OpenJDK source code

Now back to the topic - if you have a board - look first for a working Linux distro. Once you have working operating system, look at JVM, possibly Main - Main - OpenJDK Wiki can help you getting a base for further patchwork. I haven’t found any binary ready for download, hence get ready to build it from sources.

For building from sources you can try setting up yocto project which will have a target architecture and cross compiler (meta-risc could be interesting starting point). This way you can utilize much more powerful desktop/server machine rather than 2-4 core SBC.

1 Like

They also seem to provide Debian images on which the diet pi image is probably based:

https://debian.starfivetech.com/

Debian has an openjdk-17-jdk package for riscv in their repos.

https://packages.debian.org/sid/riscv64/openjdk-17-jdk/download

So it might just work after flashing an image and doing the usual apt installation. :slight_smile:

One thing you’ll probably run into with this new architecture is that some native libraries still need to be recompiled. E.g. the default serial library used by openHAB doesn’t yet support riscv.

As far I know this is the only one place where native libs are used in core, there is a way to swap it with another serial port provider which does not use native libraries: OH3.X & OH4.X Alternative Java serial provider. It works on various flavors of arm-ed linux, it should also fly with riscv.

IIRC Karaf also uses some native libraries to speed up processing when using the Console. It will probably still work but not as smooth.

It could also be that Netty (used for MQTT) depends on some native libs which may not be available for risc-v.

As far I can see, primary use of native libs in Karaf is jline, it is conditional and used for file descriptor allocation. Interestingly, default order is reflective and only then native file descriptor creator: https://github.com/jline/jline3/blob/master/terminal/src/main/java/org/jline/terminal/TerminalBuilder.java#L77L80

Native part in netty is also optional for kernel’s epoll integration. It will help saving some cpu cycles for sure.

@arden Let us know how your experiment goes. I will keep my fingers crossed for your success! :slight_smile:

I’ve created an issue for the serial library to also support RISC-V :slight_smile: :

2 Likes

Thanks for the replies so far
I’ve tested the beta steam of diet pi as OpenHab is listed as working

It installed but web interface said no service found

Downloading latest debian imagine for testing now

Will be slower going than normal as nursing a broken arm will report back is it works later

1 Like

After updating the bootloader

I’ve done a manual installation on Debian

cmd line launches but web saying “No service was found”

picture attached

2 Likes

That’s some nice progress. :slight_smile:

Does it show any warnings/errors in the log files or when you enter the log:tail command in the Karaf Console?

1 Like

from a fresh start today have the following in logs

            Unresolved requirement: Import-Package: com.sun.jna.ptr
              -> Export-Package: com.sun.jna.ptr; bundle-symbolic-name="com.sun.jna"; bundle-version="5.12.1"; version="5.12.1"
     Unresolved requirement: Import-Package: io.methvin.watcher.hashing; version="[0.18.0,1.0.0)"
       -> Export-Package: io.methvin.watcher.hashing; bundle-symbolic-name="io.methvin.directory-watcher"; bundle-version="0.18.0"; version="0.18.0"

Unresolved requirement: Import-Package: org.openhab.core.ui.icon
→ Export-Package: org.openhab.core.ui.icon; bundle-symbolic-name=“org.openhab.core.ui.icon”; bundle-version=“4.0.3”; version=“4.0.3”; uses:=“org.openhab.core.i18n”
org.openhab.core.ui.icon [215]
Unresolved requirement: Import-Package: org.openhab.core; version=“[4.0.0,5.0.0)”
→ Export-Package: org.openhab.core; bundle-symbolic-name=“org.openhab.core”; bundle-version=“4.0.3”; version=“4.0.3”; uses:=“org.osgi.framework”

    at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.18.0.jar:?]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1847) ~[org.eclipse.osgi-3.18.0.jar:?]
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136) ~[org.eclipse.osgi-3.18.0.jar:?]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1840) ~[org.eclipse.osgi-3.18.0.jar:?]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1783) ~[org.eclipse.osgi-3.18.0.jar:?]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1745) ~[org.eclipse.osgi-3.18.0.jar:?]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1667) ~[org.eclipse.osgi-3.18.0.jar:?]
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) ~[org.eclipse.osgi-3.18.0.jar:?]
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) ~[org.eclipse.osgi-3.18.0.jar:?]
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345) ~[org.eclipse.osgi-3.18.0.jar:?]

11:07:49.712 [WARN ] [f.transport.servlet.ServletController] - Can’t find the request for http://192.168.1.84:8080/'s Observer
11:08:04.469 [WARN ] [org.jline ] - Failed to save history
java.nio.file.AccessDeniedException: /nonexistent
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:397) ~[?:?]
at java.nio.file.Files.createDirectory(Files.java:700) ~[?:?]
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:807) ~[?:?]
at java.nio.file.Files.createDirectories(Files.java:793) ~[?:?]
at org.jline.reader.impl.history.DefaultHistory.internalWrite(DefaultHistory.java:227) ~[?:?]
at org.jline.reader.impl.history.DefaultHistory.save(DefaultHistory.java:219) ~[?:?]
at org.jline.reader.impl.history.DefaultHistory.add(DefaultHistory.java:384) ~[?:?]
at org.jline.reader.impl.LineReaderImpl.finish(LineReaderImpl.java:1140) ~[?:?]
at org.jline.reader.impl.LineReaderImpl.finishBuffer(LineReaderImpl.java:1109) ~[?:?]
at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:689) ~[?:?]
at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.readCommand(ConsoleSessionImpl.java:447) ~[?:?]
at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:405) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
[Fatal Error] log4j2.xml:1:1: Premature end of file.
org.ops4j.pax.logging.pax-logging-api [log4j2] ERROR : Error parsing /opt/openhab/userdata/etc/log4j2.xml

Please double check if permissions are properly applied to /etc/openhab and /usr/share/openhab folders. To me premature end of file is fairly strange, as it is very rare for logging configuration to be a problem. Same thing applies to jline error which fails to store command history in a file.

With regard to JNA failures - it looks like partial failure, same for framework. The JNA itself comes in two jars, I’d need to check where the missing package is.
Would you be able to upload complete openhab.log somewhere (gist.github.com, paste.opennms.eu)? Errors you see are hard to read from forum post.

i did a manual install as per openHAB on Linux | openHAB

so files are in /opt

here are the current permissions

user@starfive:~$ ls -al /opt
total 12
drwxr-xr-x 3 root root 4096 Oct 2 19:06 .
drwxr-xr-x 21 root root 4096 Aug 23 04:40 …
drwxr-xr-x 6 openhab openhab 4096 Oct 2 19:06 openhab
user@starfive:~$

will upload more logs shortly

Root permissions might be fine, but then you need to run whole thing as a root as well. The setenv script has several environmental variables which might actually assume /etc/openhab and other locations. Look there, because you might need to revert them to /opt.

tried v3.4 and it comes but really slow

image

1 Like

not sure how to move this forward now

Any suggestions

Try running geekbench to compare board performance with others. For reference - I saw no major troubles running OH 3.0.x with ARM using this URVE Pi - Geekbench or that Rockchip RK3288 / URVE A18-pro + radiator - Geekbench boars.

Edit - you might need to think about heatsink/fan. Some processors throttle a lot without cooling, which makes them very slow. I am not sure how your visionfire board looks a like, do you have cooler on it?

seems its the initial sign-in thats slow can take several minutes,

once logged in is quite responsive to install addons etc