How mkschreder/rockutil works
rockutil is a C command-line utility for discovering and managing Rockchip devices over USB, including MaskROM recovery, loader operations, firmware flashing, partition imaging, GPT creation, and offline image inspection. The principal recovery workflow is to parse/extract loader and firmware data, upload MaskROM stages, wait for the Loader transition, then write firmware partitions over Rockusb. The CLI also handles direct sector operations and parameter-driven partition tasks. Paths and relationships for major commands are based on the README; the sampled excerpts do not expose every command handler, so uncertain internal wiring is omitted.
Main entry points: rockutil.c Command dispatcher · rkusb.c Rockusb transport · rkparam.c Parameter parser · rkimage.c RKFW RKAF RKBOOT
Components 17
Command workflows
- Command dispatcher
rockutil.c - MaskROM upload
rkusb.c - Firmware workflows
rockutil.c - Sector operations
rockutil.c
USB device access
- Device discovery
rkusb.c - Rockusb transport
rkusb.c
Firmware and images
- RKFW RKAF RKBOOT
rkimage.c - Sparse expansion
rksparse.c
Partition handling
- Parameter parser
rkparam.c - GPT builder
rkparam.c
Protocol utilities
- CRC routines
rkcrc.c
Other components
- Operator
- libusb
- Rockchip device
- Firmware files
- parameter.txt
- Device flash
Connections 26
- Operator → Command dispatcher: runs commands
- Command dispatcher → Device discovery: lists devices
- Device discovery → libusb: enumerates
- libusb → Rockchip device: enumerates USB
- Command dispatcher → Rockusb transport: issues commands
- Rockusb transport → libusb: transfers data
- Rockusb transport → Rockchip device: sends Rockusb
- Command dispatcher → MaskROM upload: uploads boot stages
- MaskROM upload → Rockusb transport: sends control transfers
- Command dispatcher → Firmware workflows: runs upgrades
- Firmware workflows → RKFW RKAF RKBOOT: loads containers
- RKFW RKAF RKBOOT → Firmware files: reads image data
- Firmware workflows → MaskROM upload: starts handoff
- Firmware workflows → Rockusb transport: writes loader and partitions
- Command dispatcher → RKFW RKAF RKBOOT: inspects images
- Command dispatcher → Parameter parser: loads partition table
- Parameter parser → parameter.txt: reads syntax
- Command dispatcher → GPT builder: builds GPT
- GPT builder → Parameter parser: uses partitions
- GPT builder → CRC routines: checksums entries
- Command dispatcher → Sparse expansion: expands partition image
- Sparse expansion → Rockusb transport: writes chunks
- Command dispatcher → Sector operations: runs LBA operations
- Sector operations → Rockusb transport: reads writes erases
- Rockusb transport → Device flash: accesses sectors
- Firmware workflows → Parameter parser: uses partition metadata