Do you like a mystery?

I’m having an issue where my Milk-V Duo S fails to boot from SD cards that were freshly flashed using images generated by the latest SDK builds. However, if I clone a previously working SD card image, the device boots successfully. This suggests the hardware (card reader and SD card) is fine, but something may be wrong with how the current images are being built or flashed.

I have tried everything to narrow this down without success. I build my image (which up to this week worked fine) and flash it to the card as follows:

For a given SD card I clone it using this approach

#!/bin/bash

IMAGE=$1
if [ -z "$IMAGE" ]; then
  echo "No image specified. Usage: $0 <image-filename>"
  exit 1
fi

IMAGE_PATH=/mnt/500GB/MilkVDuoS/duo-buildroot-sdk-v2/out
DEVICE=/dev/sde

set -e

echo "Zeroing first 64MB of $DEVICE..."
sudo dd if=/dev/zero of=$DEVICE bs=1M count=64
sync

echo "Flashing image $IMAGE_PATH/$IMAGE to $DEVICE..."
sudo dd if=$IMAGE_PATH/$IMAGE of=$DEVICE bs=4M status=progress conv=fsync
sync
sleep 3

echo "Verifying write..."
IMG_SIZE=$(stat -c %s "$IMAGE_PATH/$IMAGE")
sudo cmp -n $IMG_SIZE "$IMAGE_PATH/$IMAGE" /dev/sde || echo " Mismatch found within image size!"

echo "Unmounting any mounted partitions..."
sudo umount ${DEVICE}* || true

echo "Powering off device..."
udisksctl power-off -b $DEVICE || echo " Could not power off device cleanly"

echo " Flash complete"

When I boot the board I get:

WD.C.SCS/0/0.WD.URPL.SDI/25000000/6000000.BS/SD.PS.SD/0x0/0x1000/0x1000/0.PE.BS.SD/0x1000/0xc400/0xc400/0.BE.J. 

E:RESET:plat/mars/platform.c:114
WD.C.SCS/0/0.WD.URPL.SDI/25000000/6000000.BS/SD.PS.SD/0x0/0x1000/0x1000/0.PE.BS.SD/0x1000/0xc400/0xc400/0.BE.J. E:RESET:plat/mars/platform.c:114
WD.C.SCS/0/0.WD.URPL.SDI/25000000/6000000.BS/SD.PS.SD/0x0/0x1000/0x1000/0.PE.BS.SD/0x1000/0xc400/0xc400/0.BE.J. E:RESET:plat/mars/platform.c:114

If I then take the a backup copy of the very same image and clone that to the same sdcard with:

sudo dd if=./backup/sdcard-backup.img of=/dev/sde bs=4M status=progress
sync

The system boots fine everytime.

I have spent hours on this with no idea what could be happening. Trying different builds, going back to my earliest builds which all worked previously, but for some reason I seem to be unable to flash an image that will boot now.

I also tried building an emmc image, formating the card on windows and writting the zip file (and expanding the files into the root) , but again the resulting fat formatted card with the install files fails to boot with ths same message.

E:RESET:plat/mars/platform.c:114
WD.C.SCS/0/0.WD.URPL.SDI/25000000/6000000.BS/SD.PS.SD/0x0/0x1000/0x1000/0.PE.BS.SD/0x1000/0xc400/0xc400/0.BE.J.

The only references I can find are:

Its been a frustrating experience with the MilkV board, so before I abandon it forever, can anyone solve the mystery?

1 Like

Yeah, this looks very much interesting.

Proceeds to build her own images of Duo S, RISC-V…

./build.sh milkv-duos-musl-riscv64-sd

Will be back in several hours. (Updating ever more.)

Testing on the board which has no eMMC:

9d2aba44ee2f73b528b82ee81dc131805cb9f97c — Boots up fine.
e232e6b2ff974ab35dea1232e27e972bad7a7206 — Boots up fine, is the latest on develop.

Glad the mystery was solved in the end.

I am building for Arm, maybe I should try RISC-v, although previously ARM was not an issue.

1 Like

Could you please look at the primary core switch: which position is it in?

Damm, it was set to RISC, it just booted.
I cant understand how the cloned image booted if it was set to RISC. Maybe I am inadvertently moving it when connecting the USB.

1 Like

I just checked all my images and they are all arm 64. I will check out the cloned image that was booting tomorrow, but thank you so much for your help hannahkobain. I appreciate it.

1 Like

Glad to be part of this tiny yet passionate community. Good luck with your projects.

1 Like

A brief epilogue

I retraced my steps and it appears the image I was using to clone the cards

was in fact a RISC-V image. I had briefly flirted with building the ‘Arduino’ version and this (to my knowledge) only supported RISC-V, so at that point I moved the switch on the board. I had little success with that version so I then switched back to the main branch and arm64, but forgot about the switch. That was the mystery. Thanks again to HannaKobain for helping solve the mystery.

2 Likes