How brennoo/rtl51 works
rtl51 is a pure-Go emulator for Realtek RTL837x switch SoCs. The principal workflow is to load a vendor firmware image, construct and run the emulated CPU, flash and switching hardware, then expose serial and network access to the running firmware. Separate CLI commands inspect and patch images and generate OTP data. The README also documents board mapping, UDP port tunnels, and pcapng capture. Some internal wiring is supported only by the README and source index; unverified links are omitted or dashed.
Main entry points: soc.go RTL837x SoC · boot.go Boot orchestration · main.go CLI commands · cpu.go DW8051 CPU
Components 16
CLI and firmware
- CLI commands
cmd/rtl51/main.go - Boot orchestration
cmd/rtl51/boot.go - Image and OTP
pkg/firmware/image.go
SoC emulation
- RTL837x SoC
pkg/rtl837x/soc.go - DW8051 CPU
pkg/mcs51/cpu.go - SPI flash and OTP
pkg/rtl837x/flash.go - ASIC registers
pkg/rtl837x/asic.go - CPU NIC DMA
pkg/rtl837x/nic.go
Switch fabric
- Board profiles
pkg/rtl837x/boards.go - L2 forwarding
pkg/rtl837x/switch.go - Port capture
pkg/rtl837x/pcap.go
Host connectivity
- Host netstack
pkg/netbridge/netbridge.go - UDP port tunnels
pkg/netbridge/portlink.go
Other components
- Operator
- Firmware image
- Host clients
Connections 26
- Operator → CLI commands: invokes
README.md - Firmware image → CLI commands: supplies
README.md - CLI commands → Image and OTP: inspects or patches
cmd/rtl51/main.go - CLI commands → Boot orchestration: dispatches boot
- CLI commands → RTL837x SoC: initializes emulator
cmd/rtl51/main.go - Boot orchestration → RTL837x SoC: runs and configures
cmd/rtl51/boot.go - Boot orchestration → Board profiles: sets port map
cmd/rtl51/boot.go - Boot orchestration → Host netstack: starts management bridge
cmd/rtl51/boot.go - Boot orchestration → UDP port tunnels: starts UDP links
cmd/rtl51/boot.go - Boot orchestration → Port capture: opens capture
cmd/rtl51/boot.go - RTL837x SoC → Image and OTP: expands update image
pkg/rtl837x/soc.go - RTL837x SoC → DW8051 CPU: steps CPU
pkg/rtl837x/soc.go - RTL837x SoC → ASIC registers: coordinates hardware
- RTL837x SoC → L2 forwarding: routes frames
README.md - RTL837x SoC → SPI flash and OTP: emulates SPI storage
- ASIC registers → DW8051 CPU: hooks CPU registers
pkg/rtl837x/asic.go - SPI flash and OTP → DW8051 CPU: hooks flash commands
pkg/rtl837x/flash.go - CPU NIC DMA → ASIC registers: uses register file
pkg/rtl837x/nic.go - CPU NIC DMA → DW8051 CPU: hooks DMA registers
pkg/rtl837x/nic.go - Board profiles → RTL837x SoC: maps front ports
- Host netstack → RTL837x SoC: attaches management port
pkg/netbridge/netbridge.go - UDP port tunnels → RTL837x SoC: attaches switch ports
pkg/netbridge/portlink.go - Host clients → Host netstack: accesses Web UI
README.md - Host clients → UDP port tunnels: sends Ethernet datagrams
README.md - L2 forwarding → Port capture: exports port frames
- RTL837x SoC → Host clients: streams serial console
README.md