Duo mainline setup

I recently acquired a Duo 256M with the intention of at least trying to use a mainline Linux kernel, as I don’t want to rely on an outdated vendor kernel—vendors inevitably drop support sooner or later. However, when I started building my own system image using duo-buildroot-sdk-v2, I realized there’s no apparent way (that I can find) to include a custom kernel.

Is there anyone who could help me with building and running a mainline kernel on the Duo 256M? I’ve done this on several ARM boards and x86 machines, but I have absolutely no idea where to start here, as there are no actually useful resources available online.

Also, as a side note, both of the Buildroot repositories could really use more documentation on how they work and what files they generate. I couldn’t figure out the structure of the system, and better documentation would be very helpful for anyone looking to make modifications.

1 Like

I’d be pretty interested in the answer to this as well. In my experience doing a fair bit of kernel / buildroot work with the Milk-V SDK (both V1 and V2) I’d be pretty surprised if you were able to get a mainline kernel working without extensive patching. AFAICT CVITek / Sophon have not upstreamed the vendor specific mods necessary to get Linux running on their hardware, so the buildroot approach in the SDKs probably won’t work with any other kernel than the 5.10 one that ships with them. At the very least, even if you do get a basic kernel working you won’t be able to access most of the on-chip resources like audio, ethernet, etc because that code simply isn’t in mainline.

1 Like

User wigyori did get this to work on the 64 MB version of the chip. I did get this to work using the SDK’s u-boot, but not mainline. Yes, not all features work.

1 Like

I see a lot of the functionality has patches proposed for mainline but they are not merged. Is there someone who has a recent-ish kernel with at least some of those patches applied?

Also as the other reply says, the board should boot and I don’t even expect all the things to work. I just want to know how to get the SDK to use a different kernel than the default one. Or at least how does the SDK do it so can do it myself. I suppose the kernel is inside the .fip file? How does that file get created?

1 Like

fip.bin is for u-boot, boot.sd (e.g.) is for Linux kernel, and partition is for root filesystem. Hence you can mix and match building these three components to suit your needs.

Not sure if anyone has built a later kernel. I’ll try if/when able.

1 Like

For curiosity I updated from Linux 6.6 to 6.12 on openwrt head. Tried with Duo 64M, but should work with 256M using correct fip.bin (but wrong DTS probably).

root@OpenWrt:~# uname -a
Linux OpenWrt 6.12.27 #0 SMP Sun May 11 10:52:15 2025 riscv64 GNU/Linux
root@OpenWrt:~# cat /proc/partitions
major minor  #blocks  name

 179        0    3932160 mmcblk0
 179        1      32768 mmcblk0p1
 179        2     106496 mmcblk0p2
root@OpenWrt:~# dmesg|head -2
[    0.000000] Linux version 6.12.27 (x@y) (riscv64-openwrt-linux-musl-gcc (OpenWrt GCC 14.2.0 r0+29541-aa4e1c523c) 14.2.0, GNU ld (GNU Binutils) 2.42) #0 SMP Sun May 11 10:52:15 2025
[    0.000000] Machine model: Milk-V Duo
root@OpenWrt:~# free -m
              total        used        free      shared  buff/cache   available
Mem:          44680       14068       18008         100       12604       11976
Swap:             0           0           0

I can push this branch to github if you wish. Next steps would be to add newer patches for Ethernet and SPI NOR, for example.

3 Likes

Sounds very much interesting indeed!

Nice! I like to see it’s still possible. I suppose this was built using OpenWRT’s build system? I would love it see the code for this either way so I can figure out how to use this with the SDK (or some other rootfs).

I’ve pushed to github, see here for branch. and here for all code and commits. Most of the work is not mine, credit to developer wigyori.

Once you have built and written the SD card, a few tweaks are still needed.

  1. Copy an existing, working fip.bin onto the boot partition. OpenSBI hangs using the compiled file.
  2. Rename sd.boot to boot.sd so it matches the name the copied fip expects. This the file you could copy if you just want the new kernel, but note the load address change below.
  3. The copied u-boot in fip will not auto-boot. Run the following at the u-boot prompt.
setenv uImage_addr 0x82000000
mmc dev 0 && fatload mmc 0 ${uImage_addr} boot.sd
bootm ${uImage_addr}
1 Like