Presenting: Linux 7.0.6 for Duo S/256M RISC-V

I’ve spent the last few months working on custom Ubuntu images using the Linux 7.0 mainline kernel. I’ve taken the base mainline kernel, applied all of the under-review/staging drivers from the Sophgo Linux Wiki, and written my own device trees for the Duo S and Duo 256M. I’ve also got the Duo S wireless drivers working on 7.x, and I’ve provided scripts for managing USB modes, wireless hardware, device tree overlays, and Arduino. Then I packaged all this up as DEBs and uploaded it to Launchpad PPA for easy updates.

There are pre-built images provided there, or you can follow the instructions on the Wiki to build the docker container used for compiling packages and generating SD images. The scripts are designed to be easy to customize. All of the kernel and DTS changes are there as separate patches, so very easy to apply to a different kernel if you want to use a different system.

The Highlights:

- GPIO, I2C, SPI, PWM, and UART all work correctly

- I2S and built-in analog audio are supported, with a ready-made ALSA sound card config for the analog input+output on Duo S

- USB fully supported, both Host and Gadget, switchable with a script

- Ethernet fully supported

- Duo S wireless (WiFi + BT) fully supported

- remoteproc/RPMSG supported, Arduino partially supported

- CPU overclock to 1050MHz

- U-Boot Distroboot with boot menu and easy kernel upgrades

- Device Tree Overlay support

The Lowlights:

- UART and SPI can’t use DMA

- Arduino can use GPIO and PWM, but not other peripherals, so it’s very limited

- Arduino cannot use the mainline Mailbox as the Arduino BSP is written for the Sophgo-specific Mailbox driver

- TPU/MIPI/VIP are unsupported (no mainline driver work has been done for these)

Notes

I am also working on improved device trees for the Duo 64M, but since the 64M can’t run APT, I’m planning to do that work on Alpine. I’ve started but there’s a long way to go. No reason you couldn’t use my kernel patches on the 64M though, and there’s a device tree for it in mainline already.

The pre-built images are fairly “maximalist” with modules for everything under the sun and device trees that enable all of the available hardware. I wanted these images to be super easy to use and I especially wanted USB devices to be plug-and-play, so I included loads of drivers and provide scripts for setting up wireless, switching USB modes, “flashing” Arduino firmware, and managing device tree overlays. My dt-overlays package also includes custom headers so you can use Milk-V “GP15” or “B12” naming conventions in your overlays. There’s a number of examples included as well.

The only thing I might want to do on the Ubuntu side that I haven’t yet is maybe a DKMS package for the wireless drivers. If there’s demand I could probably do that.

Anyway, hope these prove useful to someone; happy hacking!

Thank you for your hard work! :heart: