GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - pantacor/uuugo: Native Go (cgo-free, libusb-free) rewrite of NXP uuu/mfgtools for i.MX USB flashing (SDP/SDPS/fastboot)

BranchesTags
Open more actions menu

Latest commit

 

History

1 Commit
1 Commit

Folders and files

NameName
Last commit message
Last commit date
cmd/uuugo
cmd/uuugo
 
 
docs
docs
 
 
internal
internal
 
 
.gitignore
.gitignore
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
go.mod
go.mod
 
 

Repository files navigation

uuugo — a native Go rewrite of NXP uuu (mfgtools)

uuugo is a from-scratch, cgo-free Go reimplementation of NXP's mfgtools Universal Update Utility (uuu) and its core library libuuu. It flashes/boots i.MX SoCs over USB.

Nothing from libuuu is linked or used. Everything is native Go:

  • No libuuu — the SDP/SDPS/fastboot protocol logic is reimplemented.
  • No libusb — USB access goes straight to the Linux kernel usbfs (/dev/bus/usb/* ioctls) from pure Go using only the standard library.
  • No C compression/XML libraries — archive/decompression uses the Go standard library (archive/zip, archive/tar, compress/gzip, compress/bzip2).

The only thing beyond the Go standard library is... nothing. go.mod has zero external dependencies.

What it does

Reproduces the common uuu flows:

Command Behaviour
uuugo flash.bin auto-detect: boot/stream a bootloader (SDPS for i.MX8/8M/93/95, SDP for i.MX6/7/8MM/8MQ, SPL via SDPU/SDPV)
uuugo -b emmc flash.bin [image] run a built-in burn script (emmc/emmc_all/sd/sd_all/spl/fat_write/nand/qspi/spi_nand/nvme_all)
uuugo <script> run a uuu_version-style script
uuugo SDPS: boot -f flash.bin run a single one-shot command
uuugo -lsusb list attached devices known to uuugo
uuugo -ls list built-in scripts
uuugo -dry ... parse and print the command list without touching hardware

Implemented protocols: SDP (i.MX6/7/8M ROM HID serial download), SDPS (i.MX8/8M/8X/93/95 streaming), SDPU/SDPV (SPL serial download), and USB fastboot (including Android sparse-image re-chunking to the device's max-download-size).

Layout

cmd/uuugo/                 CLI front-end (argv, auto-detect, progress)
internal/usb/              native usbfs transport (Device interface, ioctls,
                           sysfs enumeration, descriptor parsing, in-process
                           dummy Device for tests)
internal/proto/hidreport/  HID report framing (report-id chunking, 1024/1020)
internal/proto/sdp/        i.MX SDP + IVT/BootData/AHAB-container parsing + ROM table
internal/proto/sdps/       SDPS streaming (BLTC command-block-wrapper + stream)
internal/proto/fastboot/   fastboot transport + Android sparse split/build
internal/script/           command grammar, dispatch, run loop, built-in -b scripts
internal/config/           VID/PID/bcd -> protocol/chip device-match table
internal/imgfmt/           file loader (archive member + decompress)
internal/dummy/            device-side emulators (SDP ROM, SDPS ROM, fastboot)
internal/notify/           progress event fan-out

The central abstraction is usb.Device — a 5-method interface (ControlTransfer, BulkTransfer, Endpoints, Info, Close). The real implementation drives Linux usbfs; the test implementation (usb.DummyDevice) drives an in-process Emulator. The protocol code is identical for both. On Linux, a single BulkTransfer covers bulk and interrupt endpoints because the kernel's usb_bulk_msg routes a USBDEVFS_BULK request by endpoint type.

Testing — the dummy USB server

The protocols are tested against in-process dummy servers that speak the real USB wire protocol at the transfer level — no hardware, no kernel usbfs, no privileges. They run anywhere go test runs.

  • dummy.SDPRom — an i.MX ROM HID device: validates SDP command reports (cmd LE, addr/count big-endian), the report-id-2 data phase, and the two-stage HAB+status ACK reads; asserts the dcd→write→jump sequence.
  • dummy.SDPSRom — an SDPS streaming ROM: validates the optional BLTC CBW and the streamed image, including 1024 vs 1020 chunking and the EP1/NO_CMD/ROMAPI variants.
  • dummy.FastbootDev — a fastboot device that reassembles (unsparses) flashed images so a sparse round-trip can be verified byte-for-byte.
go test ./...            # all unit + protocol + end-to-end tests
go test -race ./...      # same, with the race detector

The suite covers: SDP command marshaling (golden vectors), IVT search, full SDP boot, AHAB container sizing, SDPS streaming (MX8QXP/MX815/MX95 variants), fastboot transport, the sparse split/reassemble round-trip, the script tokenizer/dispatch, built-in -b argument substitution, CFG: upsert, the device-match table (incl. the SPL bcd-range carve), the hotplug run loop (with injected enumeration), archive/decompress, descriptor parsing, and the usbfs ioctl-number encoding (which also validates the kernel-ABI struct layouts).

Real-USB validation

internal/usb/hw_integration_test.go (build tag hwtest) opens an actually attached i.MX/fastboot device through the real usbfs path and verifies descriptor read + endpoint discovery:

go test -tags hwtest -run TestRealDeviceOpen ./internal/usb -v

For a self-contained real-USB test with no silicon, load the kernel dummy_hcd + raw_gadget modules and present the SDPS/fastboot descriptors from a raw-gadget program; uuugo then enumerates and drives it through usbfs. This needs CAP_SYS_ADMIN and the modules, so it is left as a manual harness.

Build

go build ./cmd/uuugo      # produces ./uuugo

Requires Go 1.22+. Linux only for the real USB path (the protocol, script and test code is platform-independent and builds everywhere).

Status / not yet ported

Core boot/flash flows work. Deliberately deferred (clear errors where invoked): FB: flash -raw2sparse, FFU images, .bmap, FAT .sdcard access, .zst inputs, HTTP sources, _ALL: if/sh/@, daemon mode, and the SDP rdmem/wrmem debug commands. These are additive and isolated to their packages.

Upstream reference: the latest nxp-imx/mfgtools is cloned alongside this module (../mfgtools) purely as a specification reference; it is never built or linked.

About

Native Go (cgo-free, libusb-free) rewrite of NXP uuu/mfgtools for i.MX USB flashing (SDP/SDPS/fastboot)

Resources

Readme
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.