Home assistant core installation on risc-v

Hi,
I am trying to use risc-v sbc (visionfive2) to run home assistant core (no supervisor).
Iit clearly has enough cpu power to do it well. So far I have successfully run zigbee2mqtt with mqtt broker on it.

Python works well on risc-v therefore it shouldn’t be a problem to run home assistant core.
The only problem I have faced during installation is orjson dependency. This json library is written in rust and there is no rust for risc-v yet and it doesn’t look like it will appear soon.

Is possible to run home assistant with other json library?

Thanks

3 Likes

Actually I was wrong. There is a build of the rust compiler available for risc-v. It comes with 1GB of dependencies, but I have tried it and it works. I have now successfully built and run home assistant core on risc-v. Core runs but I am having some runtime errors related with cryptography package.

2023-01-15 22:49:09.057 ERROR (MainThread) [homeassistant.setup] Setup failed for cloud: Unable to import component: /srv/homeassistant/lib/python3.10/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so: undefined symbol: EVP_PKEY_id

did you install openssl-dev?

you can also try to install HA with
export CRYPTOGRAPHY_DONT_BUILD_RUST=1

I have tried your suggestion. Didn’t help, I believe rust is now mandatory and there is no such package openssl-dev, only openssl in debian. This package includes everything.

mine arrived today so starting to play did you ever get this sorted?

The addition of riscv64 architecture into official Debian passed a milestone yesterday that all imported (manually or cross-compiled) packages are replaced by native build packages. Follow along the progress at:
https://buildd.debian.org/status/architecture.php?a=riscv64&suite=sid
Installed | 15377 | Too many results, cannot display
Needs-Build | 456

Most patches to support StarFive VisionFive 2 are accepted or likely for inclusion with Linux Kernel 6.6:
https://rvspace.org/en/project/JH7110_Upstream_Plan

What else needs to happen for Home Assistant to run?

1 Like

Anyone manage to get HA Running yet?

I think a challenge with debian is that there is a bug on usb support, usb devices not showing in /dev/tty*. which may rule out using a zigbee dongle.

Debian has official debian-installer images posted now. I was able to install such on Home Assistant Yellow PoE with Milk-V Mars CM Lite 4GB RAM module, into some 250GB NVMe storage module, and using the vendor-supplied Milk-V Mars SDK kernel. There’s a bit more waiting to do until the PCIe patch lands upstream (for NVMe storage) PCIe host support has landed in Linux 6.11rc1 and newer. You’ll be better off with the SDK kernel for NVMe storage like the Home Assistant Yellow until that happens, and it’s plenty quick enough for kernel compiles (7.5-hour Debian Kconfig with disabled debug) so I don’t foresee any CPU-bound issue with Home Assistant.

$ uptime
 12:16:26 up 10 days,  5:50,  1 user,  load average: 0.09, 0.05, 0.01
es@hay:~$ uname -a
Linux hay 5.15.0 #1 SMP Sun Jan 7 06:07:27 UTC 2024 riscv64 GNU/Linux
$ cat /proc/cpuinfo
processor	: 0
hart		: 1
isa		: rv64imafdc
mmu		: sv39
isa-ext		: 
uarch		: sifive,u74-mc

processor	: 1
hart		: 2
isa		: rv64imafdc
mmu		: sv39
isa-ext		: 
uarch		: sifive,u74-mc

processor	: 2
hart		: 3
isa		: rv64imafdc
mmu		: sv39
isa-ext		: 
uarch		: sifive,u74-mc

processor	: 3
hart		: 4
isa		: rv64imafdc
mmu		: sv39
isa-ext		: 
uarch		: sifive,u74-mc

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux trixie/sid
Release:	n/a
Codename:	trixie

What works now from upstream Linux kernel without any patches are at least networking and SDCard, if you have the VisionFive2, Milk-V Mars, or Milk-V Mars CM with such carrier.

Update 2024 end of January:

Stock HA Yellow heatsink works as-is low profile and larger footprint for the CPU on Mars CM but does not have coverage of the DDR memory. There is a Mars CM specific heatsink from Arace Tech sales distributor that includes M2x6 fasteners which do reach up from under the HA Yellow PCB through its M2.5 fastener inserts and a few threads into the M2 inserts on that Mars CM heatsink. What I’ve done instead is to drill out those M2 threaded inserts on the Mars CM heatsink as M2.5 holes and used M2.5 fasteners (8mm would have been correct length but I made do with longer fasteners and nuts what I had around) in the usual fashion to the inserts on the HA Yellow. HA Yellow ships with M2.5x3 so the longer fasteners are needed there. No issues with case clearances on either heatsink installation method. You will need to obtain a 1.5mm silicone thermal pad for the DDR memory, HA Yellow kit provides 2mm and 0.5mm while the Mars CM heatsink kit only includes a single 0.8mm CPU pad.

IMG_20240128_100635
IMG_20240128_181840

1 Like

Thanks for your sharing your detailed experience with us! I’m also very curious how you already managed to use the Debian installer images.
How did you fire up the installer on the Mars CM Lite? Or did you fetch a root filesystem somehow, and placed the vendor-supplied SDK kernel next to it?

I’ve been abusing the edit function in a comment at Milk-V Mars CM · Issue #22 · geerlingguy/sbc-reviews · GitHub as the guide for upstream firmware flashing, recovery process, and official Debian Linux installation notes.

Applying some patches this week of 20th April 2024 you can use the “firmware” itself (a recent build of upstream U-Boot development) as a recovery tool to flash firmware, which is neat because previously the only options for un-bricking have been posted without source code.

Upstream patches enabling JH7110 PCIe are now in version 16 proposed to Linux Kernel Mailing List ongoing since August of the previous year. The devicetree source in upstream Linux still only has the VisionFive2 and no other JH7110 variants accepted; I think if/when the proposed Milk-V Mars devicetree patchset to Linux gets a round or two more of code reviews it will be some more weeks (months…? could be months). NVMe storage works for me with that PCIe patchset and some customized devicetree but that’s not for the average user:

$ uname -a ; uptime
Linux hay 6.9.0-rc1-vf2pcie-00022-g467fa770ff67 #1 SMP Fri Mar 29 06:59:03 UTC 2024 riscv64 GNU/Linux
 13:00:25 up 22 days,  5:48,  2 users,  load average: 0.67, 0.68, 0.65

Home Assistant Yellow PoE itself is a lovely product with excellent documentation. Eventually will try Home Assistant software on it :upside_down_face: but for now it is a reliable and silent riscv64 compile host.

What is involved to run Home Assistant on top of official Debian Linux OS?

In the feature request forum I have added some information about a container I have built to make the installation easier on riscv64. Since it’s container based it should work on any distribution with OCI support, and this should include the mars and vf2.

Please up-vote in the feature request forum if you feel this is a feature that you desire from HA, and of course test it and let me know if it’s useful so far or if you need any help getting it to work.

https://hub.docker.com/repository/docker/fede2/riscv64-homeassistant/general

2 Likes

Today I was able to get HA running on my VisionFive2 running Gentoo. The only problem I had was with webrtc-noise-gain for risc64.

But a genius Gentoo expert wrote a patch for the ebuild:

HA looks now promising on the VF2.