Mainline Linux support question

Hello everyone,

This is what I assume to be a really newbie questions on my side.

(1) Given that there is some content mentioning milk-v and cv1800b here linux/arch/riscv/boot/dts/sophgo at v6.9 · torvalds/linux · GitHub - does it mean that building a mainline kernel is possible for milk-v duo (let’s take 64mb version for simplicity) ?

(2) And if this indeed is possible, there probably be some limitations in driver support of in-SoC’s peripherals (media etc) for this Linux image ? Like just some kind of a basic limited set of devices (SD card, what else ?) available.

Would appreciate any answers, thanks.

1 Like

Right now, mainline support is very basic. UART/Flash/I2C/SPI and clock.

Maybe USB/Ethernet in 6.11 (I saw pinmux sent but no follow in a while)

Still a long way to go for full support. Camera and Display may take even longer.


Jumping on Linux at the bleeding edge, is like trying to jump onto a moving train, while you are still learning how to walk. So most companies grab a single release of the linux kernel typically one of the longterm supported releases, get that working (basically boarding a stationary train) and in parallel submit patches that are added upstream with a lot of back and forth with the kernel maintainers. This upstream process is a much slower process with many many revisions before patches are accepted. And once finally accepted they then need to be maintained.

One thing about selecting a baseline release around a longterm kernel is that if something is not working the cause will never be a change that someone else introduced by adding/removing/modifying code upstream. This speeds up development time by not chasing new problems that were introduced by someone outside your company when trying to get new hardware to work for the first time.

It reduces costs by needing slightly fewer software developers, but there are downsides to doing both at once. The main upside is that SoC (System on Chip) and board features are added now (to a custom kernel with custom drivers) and not in a years plus time after official kernel approval. The delay of going from prepatch(RC) to mainline to stable to longterm kernel could add more than a year in total after a patch is approved.

So yea the latest bleeding edge kernel will probably work, but most new hardware on boards and inside SoC’s will probably be missing for a year, two or longer. Unless another company adds support for some feature that exactly matches faster.

1 Like

The latest mainline info for the Duo can be found here Home · sophgo/linux Wiki · GitHub
Some patches have newer revisions than the ones linked.
I’ve managed to get USB working on the 6.8 Kernel but the patches are likely to get a few more revisions and sadly things like I2S don’t have any patches yet.

1 Like


How to run mainline kernel on milk-v duo? That would be appreciated if you can share the method you’re using. For other parts, do you use official duo-buildroot-sdk?


1 Like

With Yocto, sadly no official support. Check this thread Yocto on milk-v duo
The meta-milkv layer uses the same kernel version as here but you can modify the kas-project.yml file to set the kernel with a line like this near the other machine config.

PREFERRED_PROVIDER_virtual/kernel = "linux-milkv-duo"

Beware though that there’s only basic mainline support in that branch, you’ll need to pull in the various patches from the wiki to get things like USB working.

1 Like

Seems that the image I built according to this could not work on my duo-s, the blue led didn’t blink as expected after type-C connected a while. Also the console output was garbled.

Any further suggestions?


1 Like

It could be that BSP is only compatible with the CV1800B Duo rather than the SG200x ones? You could try spot the differences in the DTS’s between the two in buildroot and port them across

1 Like

I have the mainline kernel run to the console on my duo-s finally.
If someone else want to run mainline kernel on duo-s, maybe you can try this way, prepare:

  1. fip.bin (official u-boot binary)
  2. dtb (compiled from official duo-buildroot-sdk)
  3. busybox (used to compile into kernel Image as initramfs)
  4. Linux kernel Image (compiled from mainline kernel, i.e. arch/riscv/boot/Image)

Prepare an sd card, and copy 1) 2) 4) to sd card, power on board, wait for u-boot print ’ Hit any key to stop autoboot: 0 ', press any key to enter u-boot command, then you can see the content on sd card with the command ‘ls mmc’, the output would be like:

# ls mmc 0
436736 fip.bin
20656 cv1813h_milkv_duos_sd.dtb
22079488 Image
3 file(s), 0 dir(s)

Then type four commands like below:

# setenv bootargs ${reserved_mem} ${root} ${mtdparts} console=$consoledev,$baudrate $othbootargs
# fatload mmc 0 0x81800000 Image
# fatload mmc 0 0x83000000 cv1813h_milkv_duos_sd.dtb
# booti 0x81800000 - 0x83000000

Then u-boot will tranfer control to kernel.