Gentoo on the Milkv-Duo

Disclaimer:

  • Yes, I am fully aware that the board was never designed to do this, but it can be done!

Use Case:

  • Haven’t decided yet. Purely just was curious to see if it would work, and it does :stuck_out_tongue_winking_eye:

Status:

  • It boots successfully
  • Serial console with agetty works
  • Networking works
  • USB works
  • Kernel modules load/unload successfully
  • emerge takes a ridiculously long time
  • 12G swap partition was added to the SD card, because 64MB of RAM was nowhere near enough to run emerge
  • distcc took 5 hours to compile on the board
  • The kernel panics occasionally, and am slowly working out why (and patching)

Happy to share an openrc image if anyone else is interested. Would also love for anyone else to contribute :slight_smile:

4 Likes

Welcome!

Yes, please upload a disk image to try out, and I list it on my page: https://xyzdims.com/3d-printers/misc-hardware-notes/iot-milk-v-duo-risc-v-esbc-running-linux/#Distributions_for_Milk-V_Duo

2 Likes

I will upload a disk image as soon as I have worked out a few things.

I have built app-misc/neofetch, sys-process/htop, sys-process/btop, net-misc/chrony, app-misc/cmatrix sys-apps/pciutils and sys-apps/usbutils successfully (and all accompanying libraries) on the board, even though it took weeks

chronyd is able to successfully sync the clock from an NTP server when started as an openrc service on boot

dhcpcd is able to function as expected (mostly…), however because currently only one core is available to the kernel, everything else comes to a complete stop and the entire chip becomes unresponsive until dhcpcd has completed acquiring its lease.

With all this said, this board seems to only really be good for one thing at a time, but I can definitely see good use cases for what I am doing.

Wishlist:

  • gcc needs to be able to compile successfully without a kernel panic
    • At the moment it panics at checking for inflate in -lz... in most builds
      • This is unfortunate because I am yet to build distcc successfully, which I so desperately need…
    • It runs out of memory and/or hangs whenever -pipe or any O optimisations are put into the MAKEOPTS
      • Slowly working through fine-tuning these…
  • I’m looking for a way to force it to use swap over RAM, especially for compiling/linking
  • Still working on U-Boot without a FIT image, similar to other SBCs
    • Would allow for hotswapping kernel, initramfs (although a very tiny one), GRUB, and better kernel debugging

If anyone has already achieved these, please let me know. I’d love to incorporate it into the image for maximum flexibility.


I will also need to figure out how to make the image as small as possible. Gentoo isn’t exactly designed for this type of distributing, and 64GB is ridiculously gigantic for a disk image…

But I promise I will upload something very soon :slight_smile:

1 Like
  • 12G swap partition was added to the SD card, because 64MB of RAM was nowhere near enough to run emerge

I’ve been made aware of the consequences of adding a swap partition to an SD card, but this is wild. Are you able to hear your SD card degrading if you put your ear to it? :slight_smile:

Jokes aside, this is super cool and I thoroughly enjoy making tech do things that it shouldn’t do (refer here).

1 Like

Hahaha. I honestly haven’t tried yet. But I have had to opt for the most durable SD cards :stuck_out_tongue:

Yes, another (probably more viable) option would be to have a swap partition running in RAM on a network server, and share that as a network block device, but I just wanted something quick and dirty.


Another update. libtool needs a bit of work, as ld seems to cause kernel panics (presumably because it runs out of memory very quickly…)

Still working on that…

1 Like

Hey this is cool!
Did you cross compile this? Surely you didn’t compile on the Duo??

2 Likes

Yes, I did compile most of it on the Duo. And you can only imagine how long it ended up taking, hence why the reply is so late…

Compiling it inside a qemu chroot ended up with quite a few illegal instructions, so utilising distcc and ccache really helped a lot.

For the most part, it runs quite well, however you still need a really large swapfile or swap partition.

One of the things I want to try is cluster a bunch of 64MB Duo boards together, just to see what happens.

I still promise I will provide an image as soon as it’s ready. I’m making several.

Model CPU Bootloader Kernel C Library Cool Features Issue(s) Image Status
Milk-V Duo 64MB cv1800b Milkv SDK u-boot 5.10.4-milkv glibc All hardware “works” It’s not necessarily the way a mainline kernel would behave… Ready
Milk-V Duo 64MB cv1800b @kinsa’s meta-milkv Yocto u-boot 6.8-yocto glibc Instead of just a boot.sd file, there’s a uEnv.txt file, so you can swap out kernels much easier Currently no USB (but I think that will change soon) Ready
Milk-V Duo 64MB cv1800b Mainline u-boot and GRUB (yes, GRUB! :smiley:) 6.12.5-gentoo-riscv64 (very stripped down, if it can be a module, it is a module :stuck_out_tongue:) glibc Boots directly to GRUB, which might be more familiar/easier for people to configure Boots to GRUB, but loading kernel runs out of memory Work In Progress

Once I have the 64MB images booting successfully, I will find a way to share them.

Then I will start on the 256MB (SG2002) and Duo S (SG2000) images :slight_smile:

1 Like

Gentoo ~riscv branch running underneath musl on Milk-V Duo 256MB:



More to come

1 Like

Gentoo running on top of glibc on Milk-V Duo-S:



The SoC is shockingly hot at idle, and I have no idea why…

1 Like

which is faster, userland and/or swap on uSD or NFS?

1 Like

Swap on the SD card is faster, but the wear and tear on the card is quite noticeable. NFS depends on your network and whatever is hosting the swap for you.

Either way, bring a sandwich and a good book to read. You’ll be there a while…

1 Like

Gentoo running on top of musl on a Milk-V Duo 64MB (CV1800B):

1 Like