Skip to content

rockusb: add read-flash command to dump entire flash to a file#52

Draft
obbardc wants to merge 1 commit into
collabora:mainfrom
obbardc:wip/obbardc/read-flash
Draft

rockusb: add read-flash command to dump entire flash to a file#52
obbardc wants to merge 1 commit into
collabora:mainfrom
obbardc:wip/obbardc/read-flash

Conversation

@obbardc

@obbardc obbardc commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Read the device's full flash contents to a file, printing the flash size before starting.

Fixes: #26

NOTE: This is a draft as it is currently completely untested as I don't have a rockchip device to hand now. Testing welcome !

@alchark

alchark commented Jul 8, 2026

Copy link
Copy Markdown

@obbardc Rockchip's loader binaries stop returning meaningful data past the first few megabytes, so this option likely requires a huge warning in the console.

Otherwise people might expect it to dutifully dump the whole eMMC with a factory image, which will in fact turn out mostly empty (and the flash already erased - as was the case for me a couple of times using rkdeveloptool)

@sjoerdsimons

Copy link
Copy Markdown
Collaborator

@obbardc Rockchip's loader binaries stop returning meaningful data past the first few megabytes, so this option likely requires a huge warning in the console.

Otherwise people might expect it to dutifully dump the whole eMMC with a factory image, which will in fact turn out mostly empty (and the flash already erased - as was the case for me a couple of times using rkdeveloptool)

This depends on the loader binaries; For iirc RK3399 this worked pretty well and one some RK3328 devices i have it seems to work fine to read from e.g. SD as well. I even have some fun prototypes lying around that expose the devices via NBD and/or UBLK, which can be quite useful.

RK3588 has a buggy loader in this respect and i guess RK3576 is the same here. I can't remember if the upstream u-boot implementation supports these features, but that's something that could get fixed once

@alchark

alchark commented Jul 8, 2026

Copy link
Copy Markdown

Perhaps. I only have RK3588 and RK3576 at hand, and they are definitely quirky, so it sets a dangerous precedent:)

@obbardc

obbardc commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

I wonder if there's any way to detect this bug at runtime and warn the user ? :-)

Read the device's entire flash contents to a file; printing the flash
size before starting.

Fixes: collabora#26
Signed-off-by: Christopher Obbard <obbardc@gmail.com>
@obbardc obbardc force-pushed the wip/obbardc/read-flash branch from b497568 to 010a9ba Compare July 12, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

rockusb: Read whole of the flash

3 participants