Milk-V Duo Debian/Ubuntu Image builder

If you want to use Ubuntu on your Duo, you can use my docker builder. It will make you an SD Card, and expand the partition.

image
image

5 Likes

Ubuntu works well. It installs ssh for you, which you can log into with Ethernet attached.
The Debian build needs a bit more work.

1 Like

If i add more packages to bootstrap.sh for install it fails as the duo-buildroot-sdk root size is fixed at “-size-in-blocks=786432” regardless of changes to build.sh or Dockerfile ?

========== EXIT CHROOT ==========
BR_DIR: /duo-buildroot-sdk/buildroot-2021.05
BR_BOARD: milkv-duo256m-lite_musl_riscv64
/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd
/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd /duo-buildroot-sdk/install
/duo-buildroot-sdk/device/milkv-duo256m-lite/genimage.cfg:34: no sub-section title/index for 'config'
INFO: cmd: "mkdir -p "/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/tmp"" (stderr):
INFO: cmd: "rm -rf "/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/tmp"/*" (stderr):
INFO: cmd: "mkdir -p "/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/tmp"" (stderr):
INFO: cmd: "cp -a "/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/fs/" "/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/tmp/root"" (stderr):
INFO: cmd: "find '/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/tmp/root' -depth -type d -printf '%P\0' | xargs -0 -I {} touch -r '/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/fs//{}' '/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/tmp/root/{}'" (stderr):
INFO: cmd: "mkdir -p "/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd"" (stderr):
INFO: vfat(boot.vfat): cmd: "dd if=/dev/zero of="/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/boot.vfat" seek=134217728 count=0 bs=1 2>/dev/null" (stderr):
INFO: vfat(boot.vfat): cmd: "mkdosfs  -n 'boot' '/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/boot.vfat'" (stderr):
mkfs.fat: Warning: lowercase labels might not work properly on some systems
INFO: vfat(boot.vfat): adding file 'fip.bin' as 'fip.bin' ...
INFO: vfat(boot.vfat): cmd: "MTOOLS_SKIP_CHECK=1 mcopy -sp -i '/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/boot.vfat' '/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/fip.bin' '::'" (stderr):
INFO: vfat(boot.vfat): adding file 'rawimages/boot.sd' as 'rawimages/boot.sd' ...
INFO: vfat(boot.vfat): cmd: "MTOOLS_SKIP_CHECK=1 mcopy -sp -i '/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/boot.vfat' '/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/rawimages/boot.sd' '::'" (stderr):
INFO: ext4(rootfs.ext4): cmd: "genext2fs -d '/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/tmp/root' --size-in-blocks=786432 -i 16384 '/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/rootfs.ext4' " (stderr):
copying from directory /duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/tmp/root
genext2fs: couldn't allocate a block (no free space)
INFO: ext4(rootfs.ext4): cmd: "rm -f "/duo-buildroot-sdk/install/soc_cv1812cp_milkv_duo256m_sd/rootfs.ext4"" (stderr):
ERROR: ext4(rootfs.ext4): failed to generate rootfs.ext4
gnimage for milkv-duo256m-lite failed!
/duo-buildroot-sdk/install
No image found.

bootsrap.sh packages to install

apt install --no-install-recommends -y -q util-linux haveged openssh-server systemd kmod \
                                       initramfs-tools conntrack ebtables ethtool iproute2 \
                                       iptables mount socat ifupdown iputils-ping vim dhcpcd5 \
                                       neofetch sudo chrony wget net-tools joe less \
                                       libgpiod-dev libyaml-cpp-dev libbluetooth-dev gpiod \
                                       python3-full virtualenv git libssl-dev libsdl2-dev \
                                       libulfius-dev nano neofetch avahi-daemon wget zram-config

1 Like

This line in the build.sh should be increasing the partition size to 1G. Maybe it’s not working. :thinking:

#Make sure we have room to work with
sed -i '/image rootfs.ext4 {/,/}/s/size = .*/size = 1G/' device/$BOARD/genimage.cfg
1 Like

yes, tried, but no change

1 Like

I have fixed it. You can now edit the ENV file with

export ROOTFS_SIZE=“1G”

Which is the default setting.

2 Likes

Thank you kindly for your time and effort fixing the issue.

2 Likes

Any particular reason to use exactly these compilers?
Also wouldn’t it be more secure to setup ssh keys than to allow root login with password?

1 Like

I made this image creator for my own needs. I shared it.
You can create your own custom build scripts with it. It’s very simple to add ssh keys.

2 Likes

Excellent work. Question, why is docker needed?

1 Like

Keeps all the dependencies locked down, and independent of whats going on with the host.
Therefore you get consistency. If it runs on my computer, it should run on yours.
Also makes it easy to automate builds on GitHub etc.

1 Like

Do you plan to support Duo S?

1 Like

Sorry for necro-thredding: Does anyone here know how to port this builder to DuoS / Duo-Module 01?

I am working with the new Duo-Module 01 development board. The official buildroot DuoS and 3rd party Fedora image for DuoS work out of the box with Duo-Module 01. The Fishwaldo DuoS image kinda work but there seems to be some issues with the onboard wifi (still testing). I would love to build a Debian image for the Duo-Module 01 and/or DuoS.

Kind regards

2 Likes

I tried to compile Ubuntu 22.04 for Duo S, not really great results.

  • RNDIS/UsbNcm doesn’t work, Ethernet/WiFi/Bluetooth doesn’t work.
  • It takes 5 minutes to boot because it waits for the networking, which is broken.
  • I tried running neofetch and everything crashes.
    photo_2024-12-18_20-05-18
    photo_2024-12-18_20-06-02
1 Like