Rock-4D: Add Edge + RK3576 Mainline U-Boot (with UFS support)#9421
Rock-4D: Add Edge + RK3576 Mainline U-Boot (with UFS support)#9421HeyMeco merged 6 commits intoarmbian:mainfrom
Conversation
📝 WalkthroughWalkthroughAdds a mainline U-Boot path and boot-target reordering for the Radxa Rock 4D, enables UFS boot and SPI/UFS environment storage, introduces SPL UFS loader and Rockchip device-reset support, and updates device tree nodes and build/config wiring to support these features. Changes
Sequence DiagramsequenceDiagram
participant ROM as Boot ROM
participant SPL as SPL Loader
participant DevTree as Device Tree
participant Reset as Rockchip Reset
participant UFS as UFS Controller
participant Storage as UFS Storage
ROM->>SPL: Start, provide bootsource hint
SPL->>DevTree: Query boot-order (mmc0, mmc1, scsi, nvme, ufs, ...)
alt UFS present in boot-order
SPL->>Reset: Initialize/reset controller
Reset->>UFS: Provide device_reset GPIO
SPL->>UFS: Initialize controller (SPL UFS loader)
UFS->>Storage: Read raw U-Boot image
Storage-->>UFS: U-Boot bytes
UFS-->>SPL: Deliver image
SPL->>SPL: Jump to U-Boot
else fallback to other devices
SPL->>...: Try next boot source
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
config/boards/radxa-rock-4d.conf (1)
70-73: Use--enable/--disablefor boolean Kconfig options instead of--set-valwith "y"/"n".Lines 70–73 use
--set-val CONFIG_ENV_IS_NOWHERE "n"and similar, but the same file already uses--enablefor boolean options on lines 64–67. The codebase conventions consistently use--enableand--disablefor boolean configuration options, not--set-valwith string values. Apply this pattern for consistency.Proposed fix
- run_host_command_logged scripts/config --set-val CONFIG_ENV_IS_NOWHERE "n" - run_host_command_logged scripts/config --set-val CONFIG_ENV_IS_IN_SPI_FLASH "y" - run_host_command_logged scripts/config --set-val CONFIG_ENV_SECT_SIZE_AUTO "y" - run_host_command_logged scripts/config --set-val CONFIG_ENV_OVERWRITE "y" + run_host_command_logged scripts/config --disable CONFIG_ENV_IS_NOWHERE + run_host_command_logged scripts/config --enable CONFIG_ENV_IS_IN_SPI_FLASH + run_host_command_logged scripts/config --enable CONFIG_ENV_SECT_SIZE_AUTO + run_host_command_logged scripts/config --enable CONFIG_ENV_OVERWRITENote: This same pattern appears in 6 board configs (nanopct6.conf, odroidm1.conf, rock-5b.conf, rock-5b-plus.conf, rock-5t.conf); consider applying the fix consistently across all of them.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@config/boards/radxa-rock-4d.conf` around lines 70 - 73, Replace the use of scripts/config --set-val with the boolean flag form (--enable/--disable) for the four Kconfig symbols to match project conventions: change CONFIG_ENV_IS_NOWHERE, CONFIG_ENV_IS_IN_SPI_FLASH, CONFIG_ENV_SECT_SIZE_AUTO and CONFIG_ENV_OVERWRITE to use --disable/--enable respectively (i.e., --disable CONFIG_ENV_IS_NOWHERE, --enable CONFIG_ENV_IS_IN_SPI_FLASH, --enable CONFIG_ENV_SECT_SIZE_AUTO, --enable CONFIG_ENV_OVERWRITE) and apply the same pattern to the other affected board config files (nanopct6.conf, odroidm1.conf, rock-5b.conf, rock-5b-plus.conf, rock-5t.conf).patch/u-boot/v2026.01/4-4-rockchip-spl-Add-support-for-booting-from-UFS.patch (1)
117-125: Missing trailing period and Kconfighelpindentation convention.Line 124: The help text ends with "such as when using UFS storage" without a trailing period. This is a very minor cosmetic inconsistency with typical Kconfig help text conventions.
Proposed fix
- such as when using UFS storage + such as when using UFS storage.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@patch/u-boot/v2026.01/4-4-rockchip-spl-Add-support-for-booting-from-UFS.patch` around lines 117 - 125, The Kconfig entry for config SPL_RESET_ROCKCHIP has a help paragraph missing a trailing period and its lines are not using the Kconfig help indentation convention; update the help block for SPL_RESET_ROCKCHIP (the "help" under config SPL_RESET_ROCKCHIP) so each help line is indented with a single tab and append a period to the final sentence ("such as when using UFS storage.").patch/u-boot/v2026.01/2-4-spl-Make-UFS-available-for-SPL-builds.patch (1)
131-141: Duplicate object compilation is theoretical; no configurations enable both SPL_SATA and SPL_UFS_SUPPORT simultaneously.The code duplication does exist: both
ifdef CONFIG_SPL_SATAandifdef CONFIG_SPL_UFS_SUPPORTblocks add identicalscsi.oandscsi-uclass.oobjects. However, no current defconfigs enable both options together. The patch itself introducesCONFIG_SPL_UFS_SUPPORTand it appears independently in four defconfigs (all RK3576 variants), whileCONFIG_SPL_SATAis not enabled in any of the reviewed configurations. Make's standard behavior deduplicates identical objects during linking, so this is a minor code hygiene concern rather than a functional issue.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@patch/u-boot/v2026.01/2-4-spl-Make-UFS-available-for-SPL-builds.patch` around lines 131 - 141, Duplicate obj lines for scsi (obj-$(CONFIG_SCSI) += scsi.o scsi-uclass.o) appear in two separate conditionals (ifdef CONFIG_SPL_SATA and ifdef CONFIG_SPL_UFS_SUPPORT) in drivers/scsi/Makefile; consolidate them to avoid duplicated entries by moving the common obj line into a single conditional that covers either SPL_SATA or SPL_UFS_SUPPORT (e.g., replace the two blocks with one conditional that checks for SPL_SATA or SPL_UFS_SUPPORT via a Make-compatible OR pattern such as ifneq/$(filter ...) or by nesting ifdefs to ensure the single obj-$(CONFIG_SCSI) += scsi.o scsi-uclass.o is emitted only once).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@patch/u-boot/v2026.01/2-4-spl-Make-UFS-available-for-SPL-builds.patch`:
- Around line 46-47: The Kconfig help text contains a full-width comma (U+FF0C)
in the string "Address on the block device to load U-Boot from," — replace that
character with a standard ASCII comma so the line reads "Address on the block
device to load U-Boot from,"; update the same help block that also mentions
"Units: UFS sectors (1 sector = 4096 bytes)." to ensure consistency and run a
quick grep for any other occurrences of U+FF0C in this Kconfig/help block to fix
them as well.
---
Nitpick comments:
In `@config/boards/radxa-rock-4d.conf`:
- Around line 70-73: Replace the use of scripts/config --set-val with the
boolean flag form (--enable/--disable) for the four Kconfig symbols to match
project conventions: change CONFIG_ENV_IS_NOWHERE, CONFIG_ENV_IS_IN_SPI_FLASH,
CONFIG_ENV_SECT_SIZE_AUTO and CONFIG_ENV_OVERWRITE to use --disable/--enable
respectively (i.e., --disable CONFIG_ENV_IS_NOWHERE, --enable
CONFIG_ENV_IS_IN_SPI_FLASH, --enable CONFIG_ENV_SECT_SIZE_AUTO, --enable
CONFIG_ENV_OVERWRITE) and apply the same pattern to the other affected board
config files (nanopct6.conf, odroidm1.conf, rock-5b.conf, rock-5b-plus.conf,
rock-5t.conf).
In `@patch/u-boot/v2026.01/2-4-spl-Make-UFS-available-for-SPL-builds.patch`:
- Around line 131-141: Duplicate obj lines for scsi (obj-$(CONFIG_SCSI) +=
scsi.o scsi-uclass.o) appear in two separate conditionals (ifdef CONFIG_SPL_SATA
and ifdef CONFIG_SPL_UFS_SUPPORT) in drivers/scsi/Makefile; consolidate them to
avoid duplicated entries by moving the common obj line into a single conditional
that covers either SPL_SATA or SPL_UFS_SUPPORT (e.g., replace the two blocks
with one conditional that checks for SPL_SATA or SPL_UFS_SUPPORT via a
Make-compatible OR pattern such as ifneq/$(filter ...) or by nesting ifdefs to
ensure the single obj-$(CONFIG_SCSI) += scsi.o scsi-uclass.o is emitted only
once).
In
`@patch/u-boot/v2026.01/4-4-rockchip-spl-Add-support-for-booting-from-UFS.patch`:
- Around line 117-125: The Kconfig entry for config SPL_RESET_ROCKCHIP has a
help paragraph missing a trailing period and its lines are not using the Kconfig
help indentation convention; update the help block for SPL_RESET_ROCKCHIP (the
"help" under config SPL_RESET_ROCKCHIP) so each help line is indented with a
single tab and append a period to the final sentence ("such as when using UFS
storage.").
patch/u-boot/v2026.01/2-4-spl-Make-UFS-available-for-SPL-builds.patch
Outdated
Show resolved
Hide resolved
|
While it works I just realised I used an older series. This one should be the latest: |
a001abf to
28d7195
Compare
|
Now ready to merge @SuperKali @igorpecovnik |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
config/boards/radxa-rock-4d.conf (1)
74-80: Consider--enable/--disablefor boolean Kconfig options.Lines 75–78 use
--set-val ... "y"/"n"for boolean configs (ENV_IS_NOWHERE,ENV_IS_IN_SPI_FLASH,ENV_SECT_SIZE_AUTO,ENV_OVERWRITE), while Lines 62–72 correctly use--enablefor the same type. For consistency and clarity:Suggested diff
- run_host_command_logged scripts/config --set-val CONFIG_ENV_IS_NOWHERE "n" - run_host_command_logged scripts/config --set-val CONFIG_ENV_IS_IN_SPI_FLASH "y" - run_host_command_logged scripts/config --set-val CONFIG_ENV_SECT_SIZE_AUTO "y" - run_host_command_logged scripts/config --set-val CONFIG_ENV_OVERWRITE "y" + run_host_command_logged scripts/config --disable CONFIG_ENV_IS_NOWHERE + run_host_command_logged scripts/config --enable CONFIG_ENV_IS_IN_SPI_FLASH + run_host_command_logged scripts/config --enable CONFIG_ENV_SECT_SIZE_AUTO + run_host_command_logged scripts/config --enable CONFIG_ENV_OVERWRITE🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@config/boards/radxa-rock-4d.conf` around lines 74 - 80, The boolean Kconfig flags set using run_host_command_logged scripts/config --set-val (CONFIG_ENV_IS_NOWHERE, CONFIG_ENV_IS_IN_SPI_FLASH, CONFIG_ENV_SECT_SIZE_AUTO, CONFIG_ENV_OVERWRITE) should use the boolean switches --enable / --disable instead of --set-val "y"/"n" for consistency with other entries; update the calls that reference these symbols to use scripts/config --enable CONFIG_ENV_IN_SPI_FLASH (and --disable CONFIG_ENV_IS_NOWHERE) and likewise convert CONFIG_ENV_SECT_SIZE_AUTO and CONFIG_ENV_OVERWRITE to --enable/--disable so all boolean options follow the same pattern.patch/u-boot/v2026.04/v5-1-4-spl-Make-UFS-available-for-SPL-builds.patch (1)
145-156: Duplicatescsi.o scsi-uclass.oentries when both SATA and UFS are enabled.If both
CONFIG_SPL_SATAandCONFIG_SPL_UFS_SUPPORTare set,scsi.oandscsi-uclass.oappear inobj-ytwice. Kbuild deduplicates these, so it won't cause a build error, but a unified guard (e.g.,ifdef CONFIG_SCSIwith appropriate SPL gating) would be cleaner. Given this is upstream-aligned code, no action needed now.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@patch/u-boot/v2026.04/v5-1-4-spl-Make-UFS-available-for-SPL-builds.patch` around lines 145 - 156, The Makefile adds scsi.o and scsi-uclass.o twice via separate blocks for CONFIG_SPL_SATA and CONFIG_SPL_UFS_SUPPORT; consolidate to a single guarded block to avoid duplicate entries by checking CONFIG_SCSI once and then gating SPL support—e.g., under the existing CONFIG_XPL_BUILD/CONFIG_SCSI guard, add a nested check that enables scsi.o scsi-uclass.o when either CONFIG_SPL_SATA or CONFIG_SPL_UFS_SUPPORT is set (use nested ifdef/elif/endif with CONFIG_SPL_SATA and CONFIG_SPL_UFS_SUPPORT around the obj-$(CONFIG_SCSI) += scsi.o scsi-uclass.o line so the objects are added only once).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@config/boards/radxa-rock-4d.conf`:
- Around line 19-53: post_family_config__rock4d_use_mainline_uboot()
unconditionally switches to mainline U-Boot which breaks vendor-branch builds;
add the same branch guard used in the companion functions so vendor builds keep
vendor U-Boot: at the start of post_family_config__rock4d_use_mainline_uboot()
check [[ "${BRANCH}" == "vendor" ]] && return 0 (or equivalent early return)
before any BOOT*/UBOOT_* assignments so BOOTSOURCE, BOOTBRANCH, BOOTCONFIG,
UBOOT_TARGET_MAP, and the write_uboot_platform* functions are only changed for
non-vendor branches.
---
Nitpick comments:
In `@config/boards/radxa-rock-4d.conf`:
- Around line 74-80: The boolean Kconfig flags set using run_host_command_logged
scripts/config --set-val (CONFIG_ENV_IS_NOWHERE, CONFIG_ENV_IS_IN_SPI_FLASH,
CONFIG_ENV_SECT_SIZE_AUTO, CONFIG_ENV_OVERWRITE) should use the boolean switches
--enable / --disable instead of --set-val "y"/"n" for consistency with other
entries; update the calls that reference these symbols to use scripts/config
--enable CONFIG_ENV_IN_SPI_FLASH (and --disable CONFIG_ENV_IS_NOWHERE) and
likewise convert CONFIG_ENV_SECT_SIZE_AUTO and CONFIG_ENV_OVERWRITE to
--enable/--disable so all boolean options follow the same pattern.
In `@patch/u-boot/v2026.04/v5-1-4-spl-Make-UFS-available-for-SPL-builds.patch`:
- Around line 145-156: The Makefile adds scsi.o and scsi-uclass.o twice via
separate blocks for CONFIG_SPL_SATA and CONFIG_SPL_UFS_SUPPORT; consolidate to a
single guarded block to avoid duplicate entries by checking CONFIG_SCSI once and
then gating SPL support—e.g., under the existing CONFIG_XPL_BUILD/CONFIG_SCSI
guard, add a nested check that enables scsi.o scsi-uclass.o when either
CONFIG_SPL_SATA or CONFIG_SPL_UFS_SUPPORT is set (use nested ifdef/elif/endif
with CONFIG_SPL_SATA and CONFIG_SPL_UFS_SUPPORT around the obj-$(CONFIG_SCSI) +=
scsi.o scsi-uclass.o line so the objects are added only once).
|
@HeyMeco i will test if this similar configuration work on my side, i need some times, tomorrow afternoon surely |
|
✅ This PR has been reviewed and approved — all set for merge! |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
config/boards/radxa-rock-4d.conf (2)
74-79: Mix of--set-valand--enable/--disablefor boolean Kconfig options.Lines 74–77 use
--set-val ... "n"/--set-val ... "y"for boolean options where--disable/--enablewould be the idiomatic form. Lines 78–79 correctly use--set-valfor numeric values.♻️ Suggested cleanup for boolean options
- run_host_command_logged scripts/config --set-val CONFIG_ENV_IS_NOWHERE "n" - run_host_command_logged scripts/config --set-val CONFIG_ENV_IS_IN_SPI_FLASH "y" - run_host_command_logged scripts/config --set-val CONFIG_ENV_SECT_SIZE_AUTO "y" - run_host_command_logged scripts/config --set-val CONFIG_ENV_OVERWRITE "y" + run_host_command_logged scripts/config --disable CONFIG_ENV_IS_NOWHERE + run_host_command_logged scripts/config --enable CONFIG_ENV_IS_IN_SPI_FLASH + run_host_command_logged scripts/config --enable CONFIG_ENV_SECT_SIZE_AUTO + run_host_command_logged scripts/config --enable CONFIG_ENV_OVERWRITE🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@config/boards/radxa-rock-4d.conf` around lines 74 - 79, Replace the non-idiomatic uses of scripts/config --set-val for boolean Kconfig keys with the proper --enable/--disable flags: for CONFIG_ENV_IS_NOWHERE, CONFIG_ENV_IS_IN_SPI_FLASH, CONFIG_ENV_SECT_SIZE_AUTO and CONFIG_ENV_OVERWRITE use --disable or --enable as appropriate instead of --set-val "n"/"y"; keep CONFIG_ENV_SIZE and CONFIG_ENV_OFFSET as --set-val since they are numeric. Locate the lines calling run_host_command_logged scripts/config for those CONFIG_ENV_* symbols and switch them to the corresponding --enable/--disable invocation to follow the Kconfig boolean convention.
35-36:BOOTBRANCHpins to RC tag — plan to promote to final release once available.
tag:v2026.04-rc2exists in u-boot upstream and is appropriate for edge now. TheBOOTPATCHDIR="v2026.04"already anticipates the stable release name. Once the finalv2026.04tag is released, updateBOOTBRANCHtotag:v2026.04to track the stable release.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@config/boards/radxa-rock-4d.conf` around lines 35 - 36, BOOTBRANCH is currently pinned to the release-candidate tag while BOOTPATCHDIR targets the stable name; update BOOTBRANCH from "tag:v2026.04-rc2" to "tag:v2026.04" once the final v2026.04 u-boot tag is published so both BOOTBRANCH and BOOTPATCHDIR consistently reference the stable release. Locate the declarations for BOOTBRANCH and BOOTPATCHDIR and change only the BOOTBRANCH value to "tag:v2026.04" when the official tag exists, leaving BOOTPATCHDIR="v2026.04" as-is. Ensure no other references still point to the -rc2 tag.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@config/boards/radxa-rock-4d.conf`:
- Around line 26-30: The comment next to BOOT_SCENARIO incorrectly states RK3576
was added in TF‑A v2.14; update that comment to reference TF‑A v2.13 while
leaving BOOT_SCENARIO, ATFBRANCH="tag:v2.14.0", and ATFPATCHDIR unchanged (i.e.,
only edit the comment text above BOOT_SCENARIO to say RK3576 support was added
in v2.13).
---
Nitpick comments:
In `@config/boards/radxa-rock-4d.conf`:
- Around line 74-79: Replace the non-idiomatic uses of scripts/config --set-val
for boolean Kconfig keys with the proper --enable/--disable flags: for
CONFIG_ENV_IS_NOWHERE, CONFIG_ENV_IS_IN_SPI_FLASH, CONFIG_ENV_SECT_SIZE_AUTO and
CONFIG_ENV_OVERWRITE use --disable or --enable as appropriate instead of
--set-val "n"/"y"; keep CONFIG_ENV_SIZE and CONFIG_ENV_OFFSET as --set-val since
they are numeric. Locate the lines calling run_host_command_logged
scripts/config for those CONFIG_ENV_* symbols and switch them to the
corresponding --enable/--disable invocation to follow the Kconfig boolean
convention.
- Around line 35-36: BOOTBRANCH is currently pinned to the release-candidate tag
while BOOTPATCHDIR targets the stable name; update BOOTBRANCH from
"tag:v2026.04-rc2" to "tag:v2026.04" once the final v2026.04 u-boot tag is
published so both BOOTBRANCH and BOOTPATCHDIR consistently reference the stable
release. Locate the declarations for BOOTBRANCH and BOOTPATCHDIR and change only
the BOOTBRANCH value to "tag:v2026.04" when the official tag exists, leaving
BOOTPATCHDIR="v2026.04" as-is. Ensure no other references still point to the
-rc2 tag.
|
I only just realized that there’s an error — everything was merged in a bit of a rush. @HeyMeco, unfortunately I’m still having issues with U-Boot mainline, and I believe there’s still quite a bit of work to be done on the NanoPi M5. If you could please send a PR to move the DTSI file to the correct folder and verify that everything works as expected, that would be great. In the meantime, I’ll continue running my tests on the NanoPi M5. |
Description
This PR adds the edge branch to Rock-4D and enables mainline u-boot for this board.
Also patches mainline u-boot to support RK3576 UFS based boot from this series: https://patchwork.ozlabs.org/project/uboot/patch/20251210-rk3576-ufs-v1-1-a3f9e76eb66e@gmail.com
How Has This Been Tested?
./compile.sh uboot BOARD=radxa-rock-4d BRANCH=edgeand flash to spiedgeimage from./compile.sh BOARD=radxa-rock-4d BRANCH=edge EXT=ufs DOCKER_ARMBIAN_BASE_IMAGE="debian:trixie"vendorimage from./compile.sh BOARD=radxa-rock-4d BRANCH=vendor EXT=ufs DOCKER_ARMBIAN_BASE_IMAGE="debian:trixie"Checklist:
Please delete options that are not relevant.
Summary by CodeRabbit
New Features
Improvements