{"id":32691586,"url":"https://github.com/blark/rk3588-firmware-flake","last_synced_at":"2026-07-08T14:31:00.364Z","repository":{"id":319350089,"uuid":"1078434646","full_name":"blark/rk3588-firmware-flake","owner":"blark","description":"A flake to build Rock5B uboot firmware","archived":false,"fork":false,"pushed_at":"2025-10-30T21:04:50.000Z","size":1507,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-02T07:36:30.449Z","etag":null,"topics":["flake","netboot","nix","radxa","rock5b","uboot"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-17T18:18:22.000Z","updated_at":"2025-12-31T22:59:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"0ec64b44-f6ef-4da3-a0bb-2b5f6a263d97","html_url":"https://github.com/blark/rk3588-firmware-flake","commit_stats":null,"previous_names":["blark/rk3588-firmware-flake"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/blark/rk3588-firmware-flake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blark%2Frk3588-firmware-flake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blark%2Frk3588-firmware-flake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blark%2Frk3588-firmware-flake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blark%2Frk3588-firmware-flake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blark","download_url":"https://codeload.github.com/blark/rk3588-firmware-flake/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blark%2Frk3588-firmware-flake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35268549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-08T02:00:06.796Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flake","netboot","nix","radxa","rock5b","uboot"],"created_at":"2025-11-01T15:01:23.448Z","updated_at":"2026-07-08T14:31:00.352Z","avatar_url":"https://github.com/blark.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RK3588 (Rock 5B) Firmware – Nix Flake\n\nMinimal, reproducible builds for Rock 5B firmware components:\n\n* **tf-a** — ARM Trusted Firmware-A (BL31)\n* **rkbin** — Rockchip DDR/TPL blobs \u0026 tools\n* **uboot** — U-Boot for Rock 5B integrated with TF-A + rkbin\n\n\u003e **Why this exists**: Stock U-Boot couldn't WGET FIT images or auto-detect my NIC on boot. So naturally, I built this Nix flake. 🚀 (Also, figuring out the build process was hella irritating, so now you don't have to.)\n\nBuilds for Linux/ARM64 (tf-a, uboot) and Linux/x86_64 (rkbin); macOS aliases to Linux outputs and offloads to remote builders.\n\n![Rock 5B U-Boot](rock5b-uboot.png)\n\n---\n\n## Features ✨\n\n* **Network Boot**: WGET support for HTTP-based FIT image loading\n* **Netconsole**: Remote serial console access over UDP\n* **Persistent Environment**: SPI flash storage with redundancy for saveenv\n* **Dual Console Access**: Serial and netconsole work simultaneously for redundant access\n\n---\n\n## Requirements\n\n* Nix with Flakes enabled\n* Remote builders: `aarch64-linux` (tf-a, uboot) and `x86_64-linux` (rkbin)\n\nConfiguring Nix remote builders is beyond the scope of this document. See the [Nix manual](https://nixos.org/manual/nix/stable/advanced-topics/distributed-builds.html) for details.\n\n**Note**: This repo includes the latest pre-built binaries in `firmware/`, so you can skip building entirely if you just want to flash the firmware.\n\n📌 **Important**: TF-A must be built with GCC 11 for proper multi-CPU initialization on RK3588. Newer GCC versions break CPU initialization. This is correctly configured in `pkgs/tf-a.nix`.\n\n---\n\n## Quick start\n\n### Build\n\n```bash\n# Build all required components in one command\nnix build .#tf-a .#rkbin .#uboot\n\n# Outputs\nls result*\n```\n\n**Files needed for flashing**: `result-1/rk3588_spl_loader_v1.19.113.bin` (rkbin) and `result-2/u-boot-rockchip-spi.bin` (uboot)\n\n### Flash\n\nPut the Rock 5B into Maskrom mode, then use [rkdeveloptool](https://github.com/rockchip-linux/rkdeveloptool):\n\n```bash\n# List devices (verify Maskrom mode)\nsudo ./rkdeveloptool ld\n# DevNo=1 Vid=0x2207,Pid=0x350b,LocationID=103    Maskrom\n\n# Clear SPI (only needed after failed flash)\nsudo ./rkdeveloptool ef\n\n# Option 1: Using pre-built binaries (no Nix required)\nsudo ./rkdeveloptool db firmware/rk3588_spl_loader_v1.19.113.bin\nsudo ./rkdeveloptool wl 0 firmware/u-boot-rockchip-spi.bin\n\n# Option 2: Using Nix build outputs\nsudo ./rkdeveloptool db result-1/rk3588_spl_loader_v1.19.113.bin\nsudo ./rkdeveloptool wl 0 result-2/u-boot-rockchip-spi.bin\n\n# Reset device (reboot to normal mode)\nsudo ./rkdeveloptool rd\n```\n\n---\n\n## Configuration\n\n### Build-Time Configuration (pkgs/uboot.nix)\n\nThese settings are compiled into the U-Boot binary and require rebuilding to change:\n\n**Network Boot:**\n- `CONFIG_CMD_WGET=y` - HTTP/HTTPS download support\n- `CONFIG_PCI_INIT_R=y` - PCI/NIC initialization\n- `CONFIG_PROT_TCP_SACK=y` - TCP selective acknowledgment\n- `CONFIG_BOOTDELAY=10` - 10 second boot delay\n\n**Netconsole Support:**\n- `CONFIG_NETCONSOLE=y` - UDP-based remote console\n- `CONFIG_CONSOLE_MUX=y` - Multiple console devices simultaneously\n- `CONFIG_SYS_CONSOLE_IS_IN_ENV=y` - Runtime console configuration\n- `CONFIG_ENV_OVERWRITE=y` - Allow overwriting console variables\n\n**Environment Storage:**\n- `CONFIG_ENV_IS_IN_SPI_FLASH=y` - Store environment in SPI flash\n- `CONFIG_SYS_REDUNDAND_ENVIRONMENT=y` - Redundant storage for safety\n- Environment at 0x3f0000, redundant at 0x3f8000 (32KB each)\n\n**Default Boot Sequence:**\n- PREBOOT: `setenv autoload no; setenv serverip \u003cip\u003e; setenv httpdstp 8080; setenv fit /rock5b.fit`\n- BOOTCOMMAND: `dhcp; wget 0x60000000 ${fit}; bootm`\n\nTo add custom build options, append to the config in `pkgs/uboot.nix`:\n\n```nix\ncat \u003e\u003e .config \u003c\u003c'EOF'\nCONFIG_YOUR_OPTION=y\nEOF\n```\n\n### Runtime Configuration (U-Boot Console)\n\nThese settings are configured at runtime and saved to SPI flash with `saveenv`:\n\n**Network Settings:**\n```bash\nsetenv ipaddr 192.168.1.70        # Static IP (or use dhcp)\nsetenv serverip 192.168.1.83      # HTTP server IP\nsetenv netmask 255.255.255.0\nsetenv gatewayip 192.168.1.1\nsetenv httpdstp 8080               # HTTP server port\n```\n\n**Boot Configuration:**\n```bash\nsetenv fit /device-name.fit        # FIT image path\nsetenv bootdelay 5                 # Override default delay\n```\n\n**Netconsole (see Netconsole Setup section):**\n```bash\nsetenv ncip 192.168.1.100:6667    # Netconsole host:port\nsetenv nc 'setenv stdout serial,nc; setenv stderr serial,nc; setenv stdin serial,nc'\n```\n\nSave changes:\n```bash\nsaveenv\n```\n\n---\n\n## Netconsole Setup\n\nAccess U-Boot console remotely over UDP. Useful for headless operation or debugging.\n\n### Host Connection\n\nUsing socat (recommended):\n```bash\nsocat -,raw,echo=0,icrnl,opost=1,onlcr,escape=0x1d UDP:\u003cboard-ip\u003e:6667,bind=:6667\n```\n- Exit with `Ctrl+]`\n- Replace `\u003cboard-ip\u003e` with your Rock 5B's IP address\n- Replace `6667` with the port you configured (if different)\n\n### U-Boot Configuration\n\n⚠️ **WARNING**: Test netconsole BEFORE making it automatic. Incorrect console settings can make the board difficult to access. Keep serial connection available during setup.\n\nAfter first boot with network connectivity:\n\n```bash\n# 1. Set netconsole target (your host IP)\nsetenv ncip 192.168.1.100\n\n# 2. Set netconsole ports (optional, defaults to 6666)\n# Use different ports for multiple boards\nsetenv ncinport 6667   # incoming port (board listens on this)\nsetenv ncoutport 6667  # outgoing port (board sends to this on host)\n\n# Alternatively, specify port directly in ncip\n# setenv ncip 192.168.1.100:6667\n\n# 3. Create netconsole enable command\nsetenv nc 'setenv stdout serial,nc; setenv stderr serial,nc; setenv stdin serial,nc'\n\n# 4. TEST IT FIRST - make sure your socat connection works\nrun nc\n\n# If it works, you should see output in socat\n# If it doesn't work, reboot the board to restore serial-only console\n\n# 5. Once tested and working, make it automatic on boot\nsetenv preboot 'dhcp; run nc'\n\n# 6. Save configuration\nsaveenv\n```\n\n**Note**: Use different ports (6666, 6667, 6668, etc.) for multiple boards to avoid conflicts.\n\n---\n\n## Layout\n\n```\nflake.nix\npkgs/\n  default.nix   # wires packages and toolchains\n  tf-a.nix      # builds BL31 with git hash + date identifier\n  rkbin.nix     # builds rkbin on x86_64-linux\n  uboot.nix     # builds U-Boot with network boot + netconsole\n```\n\n---\n\n## Acknowledgments 🙏\n\n* [yrzr's Rock 5B U-Boot build notes](https://yrzr.github.io/notes-build-uboot-for-rock5b/#fn:6) for guidance on the build process\n* [Collabora](https://www.collabora.com/) for their hardware enablement and U-Boot work on RK3588\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblark%2Frk3588-firmware-flake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblark%2Frk3588-firmware-flake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblark%2Frk3588-firmware-flake/lists"}