Skip to content

nanopi-m5: mainline U-Boot v2026.04 + UFS (vendor-SPL hybrid)#9788

Merged
SuperKali merged 5 commits into
armbian:mainfrom
OpenSource-YYT:feat/nanopi-m5-mainline-uboot
May 8, 2026
Merged

nanopi-m5: mainline U-Boot v2026.04 + UFS (vendor-SPL hybrid)#9788
SuperKali merged 5 commits into
armbian:mainfrom
OpenSource-YYT:feat/nanopi-m5-mainline-uboot

Conversation

@SuperKali
Copy link
Copy Markdown
Member

@SuperKali SuperKali commented May 8, 2026

Summary

Migrate NanoPi M5 (RK3576) from the u-boot-radxa-rk35xx legacy fork to mainline U-Boot v2026.04 with UFS support, via a new vendor-spl-blobs BOOT_SCENARIO. Promote current (kernel 6.18) to active target. Add UFS install path to armbian-install.

Family — rockchip64

  • New vendor-spl-blobs BOOT_SCENARIO in config/sources/families/include/rockchip64_common.inc. Default VENDOR_SPL_PATH per BOOT_SOC (RK3576 → rk3576_spl_v1.08.bin).
  • Default write_uboot_platform_ufs at family level (4 KiB LBA, idbloader on Boot LUN A @ 32 KiB, u-boot.itb on General LUN @ 8 MiB).
  • lib/functions/compilation/uboot.sh: forward write_uboot_platform_ufs into the BSP platform_install.sh heredoc.

U-Boot v2026.04

Top-level patches:

  • general-spl-Make-UFS-available-for-SPL-builds.patch (Y. Charkov v5 1/4)
  • general-reset-rockchip-make-device-resets-available-in-SPL.patch (v5 2/4)
  • general-ufs-rockchip-Add-device-reset-support.patch (v5 3/4)
  • general-rockchip-spl-Add-support-for-booting-from-UFS.patch (v5 4/4 + bootph-pre-ram hunk)
  • rk3576-arm64-dts-Explicitly-request-UFS-reset-pin.patch (Linux mainline 79a3286e6182 cherry-pick)
  • rk3576-ufs-rockchip-Hard-reset-controller-on-init.patch

Board: board_nanopi-m5/0001-arm64-dts-rockchip-enable-UFS-controller-NanoPi-M5.patch, 0002-rockchip-rk3576-nanopi-m5-Enable-UFS-support.patch.

Board — nanopi-m5.conf

  • BOOT_SCENARIO="vendor-spl-blobs", BOOTSOURCE/BOOTBRANCH/BOOTPATCHDIRv2026.04.
  • KERNEL_TARGET="current,edge,vendor" (was edge,vendor), KERNEL_TEST_TARGET="vendor,current".
  • write_uboot_platform, write_uboot_platform_mtd, write_uboot_platform_ufs helpers.
  • BOOT_TARGETS rewritten to mmc0 scsi nvme pxe dhcp via pre_config_uboot_target.

Kernel DT patches

Branch Patch Lines
6.18 (current) board-nanopi-m5-add-wifi-bt-ufs-and-misc.patch 95
7.0 (edge) board-nanopi-m5-add-wifi-bt-and-misc.patch 74
7.1 (forward-staged) board-nanopi-m5-add-wifi-bt-and-misc.patch 74

Adds: RTL8822CS Wi-Fi (SDIO), Bluetooth (UART5 + flow control), GMAC RGMII delays, ADC back button, UART3/UART8. 6.18 also enables &ufshc + UFS regulators.

armbian-install

  • JEDEC UFS LUN-id detection from sysfs.
  • Case 9 — install to UFS via write_uboot_platform_ufs.
  • UFS_EXCLUDE filter on both lsblk pipelines in check_partitions() so non-UFS install paths never offer UFS partitions as destinations.

Removed

  • patch/u-boot/legacy/u-boot-radxa-rk35xx/add-board-nanopi-m5.patch
  • patch/kernel/archive/rockchip64-{6.18,7.0,7.1}/dt/rk3576-nanopi-m5.dts (replaced by patches)
  • Transitional packages/blobs/nanopi-m5/rk3576_spl_v1.08.bin (now in armbian/rkbin master, rkbin#44)

Hardware validation

Storage vendor current (6.18) edge (7.0)
SPI NOR
SD
NVMe
UFS

Caveats

UFS and NVMe cannot host two coexisting Armbian installations on M5: with the bootloader on SPI, U-Boot proper iterates BOOT_TARGETS mmc0 scsi nvme pxe dhcp and scsi (UFS) always wins over nvme. Use NVMe as data only, or wipe the General LUN's first 8 MiB (dd if=/dev/zero of=<general-lun> bs=4096 count=2048) to fall through.

Summary by CodeRabbit

  • New Features

    • Added UFS storage controller and boot support for NanoPi M5, enabling faster storage options and alternate boot paths.
    • Enabled Wi-Fi, Bluetooth, and UFS hardware support with proper device configuration.
    • Added UFS installation option in the system installer for flexible storage choices.
  • Improvements

    • Extended boot configuration with SD, eMMC, SPI NOR, and UFS boot media support for NanoPi M5.

SuperKali added 4 commits May 8, 2026 11:42
Hybrid scenario pairing the SoC vendor SPL idblock with mainline U-Boot
proper, for boards where mainline SPL cannot yet boot from UFS (RK3576).
VENDOR_SPL_PATH is auto-derived per BOOT_SOC and a default
write_uboot_platform_ufs is provided at family level.
Y. Charkov's UFS v5 series (Kwiboo/u-boot ufs-v5, not yet upstream), a
Linux mainline DT cherry-pick, and a controller hard-reset workaround.
Moved up from board_radxa-rock-4d/ since the SPL gap is SoC-wide.
Switches from the u-boot-radxa-rk35xx legacy fork to mainline v2026.04
with BOOT_SCENARIO=vendor-spl-blobs. Adds SD/SPI/UFS install helpers,
rewrites BOOT_TARGETS to 'mmc0 scsi nvme pxe dhcp', and expands
KERNEL_TARGET to current,edge,vendor.
Replaces checked-in DTS copies with branch-specific patches against
upstream. Enables RTL8822CS Wi-Fi, Bluetooth, GMAC RGMII delays, ADC
back button, UART3/UART8. 6.18 also enables &ufshc + regulators.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b2b7541e-4daf-467b-95a3-994e75746f85

📥 Commits

Reviewing files that changed from the base of the PR and between da075a5 and 9f182b9.

📒 Files selected for processing (1)
  • packages/bsp/common/usr/bin/armbian-install
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bsp/common/usr/bin/armbian-install

📝 Walkthrough

Walkthrough

Adds UFS boot/install support for NanoPi M5: new vendor-spl-blobs path, board config and platform writers, installer UFS option, U‑Boot SPL/UFS boot and reset patches, UFS/UART/SDIO kernel DTS additions, and removal of duplicate DTS files.

Changes

NanoPi M5 UFS boot and peripherals

Layer / File(s) Summary
Boot Scenario + Shared Helper
config/sources/families/include/rockchip64_common.inc, lib/functions/compilation/uboot.sh
Adds vendor-spl-blobs scenario, validates vendor SPL and selects FlashBoot, defines write_uboot_platform_ufs and exports it into platform_install.sh.
Board Wiring
config/boards/nanopi-m5.conf
Sets BOOT_SOC=rk3576, updates kernel/boot scenario, switches to mainline U-Boot, defines SD/eMMC, SPI-NOR, and UFS writers; patches Rockchip BOOT_TARGETS order.
Installer Flow
packages/bsp/common/usr/bin/armbian-install
Detects UFS LUNs, excludes them from generic picks, adds menu option 9 to install rootfs to UFS and invoke write_uboot_platform_ufs, adjusts boot env and /etc/fstab.
U-Boot SPL UFS Enablement (General)
patch/u-boot/v2026.04/general-*.patch, arch/arm/.../spl-boot-order.c
Introduces BOOT_DEVICE_UFS, SPL UFS raw loader and Kconfigs, updates U-Boot bootrom/boot-device mapping and rk3576 SPL boot decoding to support UFS.
Reset in SPL
patch/u-boot/v2026.04/general-reset-rockchip-*.patch
Adds SPL_RESET_ROCKCHIP and phase-qualified Makefile selection so reset controller is available in SPL builds.
RK3576-specific U-Boot
patch/u-boot/v2026.04/board_nanopi-m5/*, patch/u-boot/v2026.04/*ufs-rockchip*.patch
Enables UFS regulators and controller in DTS, updates defconfig Kconfigs for UFS, adds ufs-rstgpio pinctrl, requests reset-gpio and implements device_reset and hard reset pulse on init.
Legacy Board Support
patch/u-boot/legacy/u-boot-radxa-rk35xx/*
Adds NanoPi M5 RK3576 device tree with SPL boot order, PCIe/SDMMC/SPI-NOR nodes and matching defconfig.
Kernel DTS Updates
patch/kernel/archive/rockchip64-6.18/*, .../7.0/*, .../7.1/*
Adds UFS regulator nodes, SDIO power sequencer, ADC keys, GMAC RGMII delays, wireless pinctrl groups, UART enablement, enables &ufshc; removes duplicate rk3576-nanopi-m5.dts files.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Installer as armbian-install
  participant Root as create_armbian
  participant BSP as write_uboot_platform_ufs
  participant SPL as U-Boot SPL
  participant UFS as UFS Controller
  User->>Installer: Select "Boot from UFS"
  Installer->>Installer: Detect LUN0/LUN1/LUN2
  Installer->>Root: Partition and install rootfs
  Root-->>Installer: Complete
  Installer->>BSP: Write idbloader + u-boot to boot LUNs
  BSP->>UFS: Program LUN1 and LUN0
  Note over SPL,UFS: System boot
  SPL->>UFS: Enumerate via SPL UFS loader
  UFS-->>SPL: Return U-Boot image
  SPL-->>SPL: Load and execute U-Boot proper
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • armbian/build#9421: Adds RK3576 UFS boot support with similar mainline U-Boot wiring and installer hooks.

Suggested labels

Ready to merge, 02

Suggested reviewers

  • igorpecovnik
  • rpardini
  • NicoD-SBC
  • Tonymac32
  • amazingfate
  • pyavitz
  • ColorfulRhino

Poem

I thump my paw on eMMC ground,
Then hop to UFS with a humming sound—
idbloader bits and u-boot itb,
Reset pulses clear the sleepy PCB.
Wi‑Fi chirps, BT blinks—M5 boots free. 🥕🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: migration from legacy U-Boot (Radxa fork) to mainline U-Boot v2026.04 with UFS support using vendor-SPL hybrid approach for the NanoPi M5 board.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the 05 Milestone: Second quarter release label May 8, 2026
@SuperKali
Copy link
Copy Markdown
Member Author

SuperKali commented May 8, 2026

Discussion: dedicated UFS image extension

Now that armbian-install (case 9) provisions UFS from any install medium (SD / SPI / NVMe), the dedicated UFS image extension that publishes a separate *-ufs.img artifact per board × release × kernel arguably no longer earns its build-matrix and mirroring footprint. The install path is identical to non-UFS now — boot anything, run armbian-install, pick option 9.

Three points worth weighing:

  1. Maintenance vs. value. The extension multiplies the build matrix (per-board × per-release × per-kernel) for a niche install path that armbian-install already covers in-band.
  2. Mirror / CDN cost. Every published artifact replicates across the mirror network; UFS-flavoured images double the storage footprint for boards with eUFS soldered.
  3. Identical UX to non-UFS. Users boot the standard image from any medium and run armbian-install to provision UFS — no per-medium image variant required.

Not changed in this PR — proposal only. Deferring the call to @igorpecovnik.

@github-actions github-actions Bot added size/large PR with 250 lines or more Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Framework Framework components Patches Patches related to kernel, U-Boot, ... BSP Board Support Packages labels May 8, 2026
@HeyMeco
Copy link
Copy Markdown
Collaborator

HeyMeco commented May 8, 2026

@SuperKali the PR description includes too much AI slop. Can you reduce it to the actual important info and not the discussion why things were chosen as a path

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
config/boards/nanopi-m5.conf (1)

57-63: 💤 Low value

Consider extracting BOOT_TARGETS to a board variable.

The sed approach to patch rockchip-common.h works but is fragile—if upstream changes the format of #define BOOT_TARGETS, the regex may silently fail. Consider whether a board-level UBOOT_BOOT_TARGETS variable could be wired into the u-boot build instead of runtime patching.

That said, this pattern appears elsewhere in the codebase and the regular_git diff output provides visibility into whether the patch applied.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@config/boards/nanopi-m5.conf` around lines 57 - 63, The current
pre_config_uboot_target__nanopi_m5_patch_rockchip_common_boot_order function
mutates include/configs/rockchip-common.h with a fragile sed that may break if
upstream changes the `#define` format; replace this runtime patching by exposing a
board-level variable (e.g., UBOOT_BOOT_TARGETS) set to the
rockchip_uboot_targets array and wire that into the u-boot build configuration
instead of using sed on include/configs/rockchip-common.h—update references in
the build logic that consume BOOT_TARGETS to prefer UBOOT_BOOT_TARGETS and
remove the sed/regex patch from
pre_config_uboot_target__nanopi_m5_patch_rockchip_common_boot_order so diffs are
unnecessary and robust.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/bsp/common/usr/bin/armbian-install`:
- Line 1145: The mount call hardcodes ext4 and will fail for btrfs/f2fs; change
the mount in the post-install fixup to use the filesystem type selected by the
format_disk logic (use the variable that holds the chosen fs type instead of the
literal "ext4"), e.g. replace the "-t ext4" in the mount invocation that
references DISK_ROOT_PART and _ufs_fix_mp with the variable that format_disk
sets (and add a safe default/fallback to ext4 if that variable is empty).

---

Nitpick comments:
In `@config/boards/nanopi-m5.conf`:
- Around line 57-63: The current
pre_config_uboot_target__nanopi_m5_patch_rockchip_common_boot_order function
mutates include/configs/rockchip-common.h with a fragile sed that may break if
upstream changes the `#define` format; replace this runtime patching by exposing a
board-level variable (e.g., UBOOT_BOOT_TARGETS) set to the
rockchip_uboot_targets array and wire that into the u-boot build configuration
instead of using sed on include/configs/rockchip-common.h—update references in
the build logic that consume BOOT_TARGETS to prefer UBOOT_BOOT_TARGETS and
remove the sed/regex patch from
pre_config_uboot_target__nanopi_m5_patch_rockchip_common_boot_order so diffs are
unnecessary and robust.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 68008165-db5b-46b8-8a48-b17cfbbcc0a7

📥 Commits

Reviewing files that changed from the base of the PR and between 1bac6d9 and da075a5.

📒 Files selected for processing (19)
  • config/boards/nanopi-m5.conf
  • config/sources/families/include/rockchip64_common.inc
  • lib/functions/compilation/uboot.sh
  • packages/bsp/common/usr/bin/armbian-install
  • patch/kernel/archive/rockchip64-6.18/board-nanopi-m5-add-wifi-bt-ufs-and-misc.patch
  • patch/kernel/archive/rockchip64-6.18/dt/rk3576-nanopi-m5.dts
  • patch/kernel/archive/rockchip64-7.0/board-nanopi-m5-add-wifi-bt-and-misc.patch
  • patch/kernel/archive/rockchip64-7.0/dt/rk3576-nanopi-m5.dts
  • patch/kernel/archive/rockchip64-7.1/board-nanopi-m5-add-wifi-bt-and-misc.patch
  • patch/kernel/archive/rockchip64-7.1/dt/rk3576-nanopi-m5.dts
  • patch/u-boot/legacy/u-boot-radxa-rk35xx/add-board-nanopi-m5.patch
  • patch/u-boot/v2026.04/board_nanopi-m5/0001-arm64-dts-rockchip-enable-UFS-controller-NanoPi-M5.patch
  • patch/u-boot/v2026.04/board_nanopi-m5/0002-rockchip-rk3576-nanopi-m5-Enable-UFS-support.patch
  • patch/u-boot/v2026.04/general-reset-rockchip-make-device-resets-available-in-SPL.patch
  • patch/u-boot/v2026.04/general-rockchip-spl-Add-support-for-booting-from-UFS.patch
  • patch/u-boot/v2026.04/general-spl-Make-UFS-available-for-SPL-builds.patch
  • patch/u-boot/v2026.04/general-ufs-rockchip-Add-device-reset-support.patch
  • patch/u-boot/v2026.04/rk3576-arm64-dts-Explicitly-request-UFS-reset-pin.patch
  • patch/u-boot/v2026.04/rk3576-ufs-rockchip-Hard-reset-controller-on-init.patch
💤 Files with no reviewable changes (4)
  • patch/u-boot/legacy/u-boot-radxa-rk35xx/add-board-nanopi-m5.patch
  • patch/kernel/archive/rockchip64-6.18/dt/rk3576-nanopi-m5.dts
  • patch/kernel/archive/rockchip64-7.0/dt/rk3576-nanopi-m5.dts
  • patch/kernel/archive/rockchip64-7.1/dt/rk3576-nanopi-m5.dts

Comment thread packages/bsp/common/usr/bin/armbian-install Outdated
JEDEC LUN-id detection from sysfs, new case 9 (install to UFS) via
write_uboot_platform_ufs, and UFS_EXCLUDE filter in check_partitions()
so non-UFS install paths never offer UFS partitions as destinations.
@SuperKali SuperKali force-pushed the feat/nanopi-m5-mainline-uboot branch from da075a5 to 9f182b9 Compare May 8, 2026 10:13
Copy link
Copy Markdown
Member

@igorpecovnik igorpecovnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's tested and works, lets merge. No apparent problems at sigt.

I would only have comment on armbian-install part ... that whole thing has to be written from scratch in order that code becomes read-able. Currently is a big mess. Not a subject of this PR.

@github-actions github-actions Bot added the Ready to merge Reviewed, tested and ready for merge label May 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions Bot removed the Needs review Seeking for review label May 8, 2026
@SuperKali SuperKali merged commit b031583 into armbian:main May 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release BSP Board Support Packages Framework Framework components Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... Ready to merge Reviewed, tested and ready for merge size/large PR with 250 lines or more

Development

Successfully merging this pull request may close these issues.

3 participants