mass-storage-gadget64: eMMC is exported as removable media, so Windows cannot write a GPT image
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 70/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- linux, raspberry-pi, shell
- 领域
- embedded-iot
调研方向
LUN 属性在 mass-storage-gadget64 rootfs 覆盖层中的 configure-gadgets shell 脚本里设置,大约在第 69-73 行。该 issue 在 buildroot 分支上链接了这个文件,因此应检查那个仓库,而不是这个仓库。将那里 lun.0 的设置与内核对 removable 的默认值进行比较,找出缺少的属性。完成的标志是 Windows 将 eMMC 识别为固定介质,并且 Raspberry Pi Imager 能够写入 GPT 镜像;这需要重新构建 boot.img,并在硬件上确认。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
configure-gadgets in the mass-storage-gadget64 initramfs sets cdrom, ro and nofua for the LUN, but not removable:
removable therefore stays at the kernel default 1. Windows does not read a GPT on removable media: it mounts the whole eMMC as one "superfloppy" volume and rejects every raw write with ERROR_INVALID_FUNCTION. Raspberry Pi Imager, balenaEtcher, Win32DiskImager and diskpart all fail the same way, without any progress. Writing the same image from Linux works.
Adding one line next to the others fixes it:
echo 0 > functions/mass_storage.usb${id}/lun.0/removable
With that line, Windows shows the GPT with all partitions and Imager writes the image (13.5 GiB in about 14 minutes). We have been shipping a repacked boot.img with exactly this change; kernel, firmware and device trees are untouched.
Steps to reproduce the behaviour
- CM4 with eMMC, nRPIBOOT and USB_OTG jumpers fitted, USB connected to a Windows PC.
rpiboot -d mass-storage-gadget64(current boot.img from this repository).- Write any image with a GPT partition table to the exported disk with Raspberry Pi Imager.
- The write fails immediately; Disk Management shows one volume spanning the whole disk instead of the GPT partitions.
Workaround without rebuilding: on the gadget's serial console (USB COM port), detach the gadget, clear the bit and attach it again (re-attaching drops the console too, hence nohup):
G=/sys/kernel/config/usb_gadget/rpimsg
nohup sh -c "sleep 4; echo > $G/UDC; sleep 2; \
echo 0 > $G/functions/mass_storage.usb0/lun.0/removable; sleep 1; \
echo fe980000.usb > $G/UDC" > /tmp/fix.log 2>&1 &
Afterwards Get-CimInstance Win32_DiskDrive | Where-Object { $_.Model -match 'mmcblk' } | Select-Object Model, MediaType reports External hard disk media instead of Removable Media, and Imager writes.
Device(s)
Raspberry Pi CM4
Compute Module IO board.
Custom carrier board
RPIBOOT logs
No response
Kernel logs
No response
Device UART logs
No response
- 主要语言
- C
- 星标
- 1.4k
- 派生
- 318
- 平均合并
- 15 小时 55 分钟
- 30 天内合并 PR
- 6
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
raspberrypi/usbboot 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 38/100
raspberrypi/usbboot#397 ·
-
难度 4/5 3-5 天 新手友好度 45/100
raspberrypi/usbboot#391 · 4 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
raspberrypi/usbboot#387 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 55/100
raspberrypi/usbboot#383 · 1 条评论 · 2 个 reaction ·
-
enhancement
难度 3/5 1-2 天 新手友好度 35/100
raspberrypi/usbboot#295 · 6 条评论 · 1 个 reaction ·
查看 raspberrypi/usbboot 的全部 Issue
相似的 Issue
-
difficulty: easy docs good first issue help wanted
难度 2/5 1-3 小时 新手友好度 74/100
Ryan-Millard/Img2Num#842 ·
维护者通常 12 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
SanderMertens/flecs#2461 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100