Default rpiboot mass-storage payload fails on CM4 eMMC writes; explicit -d mass-storage-gadget64 works

Open
#391 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
raspberry-pi, shell

Research direction

Start with the default payload used by ./rpiboot -v and compare it with mass-storage-gadget64/boot.img, config.txt, and bootfiles.bin, especially the listed boot_ramdisk=1 and uart_2ndstage=1 settings. Reproduce the CM4 eMMC write test, then verify that the default payload behaves like the explicit mass-storage-gadget64 payload without causing the USB device to disconnect.

Written by the indexing model from the issue text.

Description

Describe the bug

Hardware:

  • Raspberry Pi Compute Module 4 with 16 GB eMMC
  • Raspberry Pi Compute Module 4 IO Board
  • Host: Linux Mint
  • Also reproduced on a Windows 11 PC
  • Different USB cables and USB ports tested

usbboot:

  • local build
  • build-date: 2026/08/12
  • pkg-version: local 87d6e032

Problem:
When starting rpiboot without specifying a directory:

sudo ./rpiboot -v

the CM4 eMMC appears as:

/dev/sdb
30535680 512-byte logical blocks
Write Protect is off

Reading works, but writing causes the USB mass-storage device
to disappear. For example:

sudo dd if=/dev/zero of=/dev/sdb bs=1M count=100 conv=fsync

results in USB errors such as:

device descriptor read/64, error -110
Device not responding to setup address
device not accepting address ..., error -71
USB disconnect
device offline error, dev sdb

A read test worked:

sudo dd if=/dev/sdb of=/dev/null bs=4M count=100

419430400 bytes ... 10.3 MB/s

However, explicitly using the current mass-storage-gadget64
directory fixes the problem:

sudo ./rpiboot -d ./mass-storage-gadget64 -v

With this payload:

sudo dd if=/dev/zero of=/dev/sdb bs=4096 count=1 oflag=direct

works.

A larger test also succeeds:

sudo dd if=/dev/zero of=/dev/sdb bs=1M count=1024 oflag=direct

1073741824 bytes ... 24.9 MB/s

The RPi Imager then also works normally.

The explicit payload contains:

mass-storage-gadget64/boot.img
mass-storage-gadget64/config.txt
mass-storage-gadget64/bootfiles.bin

The config contains:

boot_ramdisk=1
uart_2ndstage=1

It looks like the default/embedded mass-storage-gadget payload
may differ from the current mass-storage-gadget64 payload, and
the former has a write-path problem on CM4 eMMC.

Steps to reproduce the behaviour

./rpiboot
→ eMMC reads OK
→ eMMC writes cause USB disconnect

./rpiboot -d ./mass-storage-gadget64
→ eMMC reads OK
→ eMMC writes work normally (~25 MB/s)

Device(s)

Raspberry Pi CM4

Compute Module IO board.
  • Raspberry Pi Compute Module 4 with 16 GB eMMC
  • Raspberry Pi Compute Module 4 IO Board
RPIBOOT logs

No response

Kernel logs

No response

Device UART logs

No response

Dominant language
Shell
Stars
1.3k
Forks
313
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/usbboot

All issues in raspberrypi/usbboot

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.