SMlight SMHUB OpenWrt support

I have just booted a linux (very near) mainline 6.18-rc1 from https://github.com/sophgo/linux-riscv with just very small DTS-patches to serial console login into the SMHub-OS rootfs.

Will now make a DTS-file for the SMHUB specifically, so that ethernet and wifi can be used, and compile a new image with USB gadget and wifi drivers.

1 Like

So first steps are done.

I can now boot (with my 6.18-rc1) the smhub into a Debian Trixie RiscV-installation (installed into /mnt/user from OEM FW), and have working Ethernet, eMMC, and SD-Card, and all serial ports. Not working for now is Wifi/BT (aic8800-sdio) and USB (OTG driver is detected, but … is don’t get a UDC, or role_switch endpoint). So I could now start using it as remote radios for my homeassistant via ser2net/socat. I’ll write some glue scripts to announce the RGB lights and other sensors via mosquitto_pub.

I’m assuming, that 6.18 will be called as LTS, and that at some point after the 6.12 era, OpenWrt will start porting RiscV to 6.18 (or later). At that point I’ll attempt to get this device supported under OpenWrt.

Does this change effect booting custom images or other OSes?

I don’t think so. If you’ve already installed it, check if you can sudo -i to root, and whether they have updated the kernel.

Meanwhile, I’ve hit a roadblock:
https://lists.debian.org/deity/2024/05/msg00021.html (Near the bottom):

0x8330000f is FENCE.TSO, which some of the T-Head cores notoriously
failed to implement, thereby violating the RISC-V spec. LLVM has
emitted it for a long time, but GCC didn’t until recently (14.1) so
without doing proper architectural testing, just running Linux on top
of it historically wouldn’t have revealed the issue.

OpenSBI 1.1 (released June 2022) emulates the instruction for this
hardware, so update your firmware to a version that includes a
recent-ish version of OpenSBI and pretends your hardware is more
conforming.

The SMHub device ships with OpenSBI 0.9, which is 5 years old. Upstream OpenSBI is at 1.9, and supports Sophgo CV18xx/SG2000 since version 1.5 from June 2024. The OpenSBI is contained (afaict) in the FIP.bin, which (afaiu) are stored in the mmcblk0boot0 and …1.

I’ll now be checking the upstream sources (milkv/sophgo) to see, whether any of those have/use a newer OpenSBI/FIP/U-Boot in their boad support images. It looks like I might be able to use SD-Card boot to ā€œtest outā€ other FIPs. (If the default stage1 bootloader defaults to reading SD first, then eMMC, which I think it does, but can’t find in writing just now).
If I find a build recipe for the fip.bin, and how to test safely, I plan to build a full-featured U-boot (with EFI-features etc.) with a mainline up2date OpenSBI 1.9+.

1 Like

If you put the fip.bin on a FAT sd-card, the bootloader ROM loads it and flashes it to the 2 hardware boot partitions.