Skip to content

nanopi-m6: add support for mainline uboot#8793

Merged
igorpecovnik merged 2 commits intoarmbian:mainfrom
efectn-forks:nanopi-m6-mainline-uboot
Oct 22, 2025
Merged

nanopi-m6: add support for mainline uboot#8793
igorpecovnik merged 2 commits intoarmbian:mainfrom
efectn-forks:nanopi-m6-mainline-uboot

Conversation

@efectn
Copy link
Member

@efectn efectn commented Oct 22, 2025

Description

This PR adds mainline uboot support to Nanopi M6 for current and edge branches.

GitHub issue reference:
Jira reference number [AR-9999]

How Has This Been Tested?

  • SPI+NVME
  • eMMC+NVME
  • eMMC
  • SD

Checklist:

Please delete options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@github-actions github-actions bot added 11 Milestone: Fourth quarter release size/large PR with 250 lines or more labels Oct 22, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 22, 2025

Walkthrough

Adds vendor-branch guards and multiple U-Boot hook functions to the NanoPi M6 board config. Updates post_family_config__nanopi_m6_support_spi_boot to skip SPI boot mapping for BRANCH values "current" or "edge". Introduces four new hooks that: select/patch BOOTCONFIG for SPI, preserve a .config.spi copy, include that copy in the packaged U-Boot image, and enable mainline U-Boot by defining BOOT-related globals and updating UBOOT_TARGET_MAP. All new hooks no-op when BRANCH is "vendor".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • prahal
  • rpardini
  • ginkage
  • paolosabatino
  • Tonymac32
  • pyavitz

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "nanopi-m6: add support for mainline uboot" is clear, specific, and directly aligned with the main objective of the changeset. The raw summary confirms that the changes introduce four new shell hook functions and modify an existing one to implement mainline U-Boot support for the NanoPi M6 board, with vendor branch guards. The title concisely captures this primary purpose without unnecessary noise or vague terminology.
Description Check ✅ Passed The pull request description is directly related to the changeset. It clearly states the intent to add mainline U-Boot support for NanoPi M6 for current and edge branches, which matches the code modifications that introduce multiple U-Boot customization functions and SPI bootconfig handling. The description also includes relevant testing information and references, providing reasonable context for the changes.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • AR-9999: Request failed with status code 404

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 Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Oct 22, 2025
Copy link
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 (2)
config/boards/nanopi-m6.conf (2)

68-68: Duplicate alert message - consider differentiating.

The alert message "u-boot: hack bootconfig for spi image" is identical to the one at line 52. Consider using distinct messages like "u-boot: saving spi bootconfig" to better reflect this function's purpose.

Apply this diff:

-	display_alert "u-boot for ${BOARD}" "u-boot: hack bootconfig for spi image" "info"
+	display_alert "u-boot for ${BOARD}" "u-boot: saving spi bootconfig" "info"

81-81: Consider verifying the destination directory exists.

While run_host_command_logged will likely fail gracefully if the directory doesn't exist, explicitly checking or creating the directory could make debugging easier.

Consider adding a directory check before the copy:

 	if [[ -f "${uboottempdir}/.config.spi" ]]; then
+		mkdir -p "$uboottempdir/usr/lib/u-boot"
 		run_host_command_logged cp ${uboottempdir}/.config.spi "$uboottempdir/usr/lib/u-boot/nanopi-m6-spi-rk3588s_defconfig"
 		run_host_command_logged rm ${uboottempdir}/.config.spi
 	fi
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7be3ce0 and 34db990.

⛔ Files ignored due to path filters (6)
  • patch/u-boot/v2025.10/defconfig/nanopi-m6-rk3588s_defconfig is excluded by !patch/**
  • patch/u-boot/v2025.10/defconfig/nanopi-m6-spi-rk3588s_defconfig is excluded by !patch/**
  • patch/u-boot/v2025.10/dt_uboot/rk3588s-nanopi-m6-spi-u-boot.dtsi is excluded by !patch/**
  • patch/u-boot/v2025.10/dt_uboot/rk3588s-nanopi-m6-u-boot.dtsi is excluded by !patch/**
  • patch/u-boot/v2025.10/dt_upstream_rockchip/rk3588s-nanopi-m6-spi.dts is excluded by !patch/**
  • patch/u-boot/v2025.10/dt_upstream_rockchip/rk3588s-nanopi-m6.dts is excluded by !patch/**
📒 Files selected for processing (1)
  • config/boards/nanopi-m6.conf (2 hunks)
🔇 Additional comments (5)
config/boards/nanopi-m6.conf (5)

20-23: LGTM! Guard ensures vendor-only SPI boot mapping.

The early return for current and edge branches correctly delegates SPI boot handling to the new mainline U-Boot functions.


94-100: LGTM! Mainline U-Boot configuration looks correct.

The variable declarations properly override the defaults for mainline U-Boot v2025.10, with appropriate settings for bootdelay, source repository, and board-specific directories.


101-102: Fix multi-line string assignment for UBOOT_TARGET_MAP.

The variable assignment spans two lines without proper line continuation. This will cause the second line to be interpreted as a separate command, leading to syntax errors or unexpected behavior.

Apply this diff to properly format the multi-line string:

-	declare -g UBOOT_TARGET_MAP="BL31=${RKBIN_DIR}/${BL31_BLOB} ROCKCHIP_TPL=${RKBIN_DIR}/${DDR_BLOB} $BOOTCONFIG_SPI;;u-boot-rockchip-spi.bin
-	BL31=${RKBIN_DIR}/${BL31_BLOB} ROCKCHIP_TPL=${RKBIN_DIR}/${DDR_BLOB} $BOOTCONFIG;;u-boot-rockchip.bin"
+	declare -g UBOOT_TARGET_MAP="BL31=${RKBIN_DIR}/${BL31_BLOB} ROCKCHIP_TPL=${RKBIN_DIR}/${DDR_BLOB} $BOOTCONFIG_SPI;;u-boot-rockchip-spi.bin \
+BL31=${RKBIN_DIR}/${BL31_BLOB} ROCKCHIP_TPL=${RKBIN_DIR}/${DDR_BLOB} $BOOTCONFIG;;u-boot-rockchip.bin"
⛔ Skipped due to learnings
Learnt from: Grippy98
PR: armbian/build#8622
File: config/sources/families/k3.conf:66-66
Timestamp: 2025-09-12T19:28:38.491Z
Learning: In the Armbian k3 family build system (config/sources/families/k3.conf), builds do not fail when TIBOOT3_BOOTCONFIG is unset, even though tiboot3.bin is still listed in UBOOT_TARGET_MAP. The gating mechanism in pre_config_uboot_target__build_first_stage function works as intended to conditionally build/copy tiboot3.bin only when TIBOOT3_BOOTCONFIG is defined.

54-56: The original review comment is incorrect.

The variable target_make is properly set before the hook is invoked. It is declared as global at line 331 of lib/functions/compilation/uboot.sh (declare -g target_make target_patchdir target_files), and assigned its value at line 332 (target_make=$(cut -d';' -f1 <<< "${target}")) within the processing loop. The pre_config_uboot_target hook is then invoked via call_extension_method at line 85, within the compile_uboot_target function. Since target_make is declared globally before the function is called, it is available to the board config's pre_config_uboot_target implementation in config/boards/nanopi-m6.conf.

Likely an incorrect or invalid review comment.


71-71: The variable uboottempdir is properly available in the post_config_uboot_target hook context.

The variable is declared as global within loop_over_uboot_targets_and_do at line 329, and is initialized in the parent function via prepare_temp_dir_in_workdir_and_schedule_cleanup at lines 428-429. The post_config_uboot_target hook is invoked at line 192 within compile_uboot_target, which is called from within the loop where uboottempdir has been declared global. The hook function at config/boards/nanopi-m6.conf:71 correctly uses the variable with proper Bash syntax ${uboottempdir}/.config.spi.

Copy link
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.

Fix indentation inconsistency

@efectn efectn force-pushed the nanopi-m6-mainline-uboot branch from 34db990 to e550f88 Compare October 22, 2025 10:08
Copy link
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: 0

♻️ Duplicate comments (1)
config/boards/nanopi-m6.conf (1)

54-60: Fix indentation inconsistency.

Lines 55 and 58 use space indentation instead of tabs, which is inconsistent with the rest of the file.

Apply this diff to fix the indentation:

 	if [[ $target_make == *"nanopi-m6-spi-rk3588s_defconfig"* ]]; then
-  		BOOTCONFIG="nanopi-m6-spi-rk3588s_defconfig"
+		BOOTCONFIG="nanopi-m6-spi-rk3588s_defconfig"
 		target_make=${target_make/nanopi-m6-spi-rk3588s_defconfig/}
 	else
-  		BOOTCONFIG="nanopi-m6-rk3588s_defconfig"
+		BOOTCONFIG="nanopi-m6-rk3588s_defconfig"
 		target_make=${target_make/nanopi-m6-rk3588s_defconfig/}
 	fi
🧹 Nitpick comments (2)
config/boards/nanopi-m6.conf (2)

68-68: Update the display_alert message to accurately reflect the function's purpose.

The message "hack bootconfig for spi image" is misleading for this function, which saves/preserves the SPI configuration rather than modifying it. Consider a more descriptive message.

Apply this diff:

-	display_alert "u-boot for ${BOARD}" "u-boot: hack bootconfig for spi image" "info"
+	display_alert "u-boot for ${BOARD}" "u-boot: preserving spi bootconfig" "info"

85-86: Consider using single blank line between functions.

Two consecutive blank lines before the function declaration is inconsistent with typical style conventions, though not a functional issue.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 34db990 and e550f88.

⛔ Files ignored due to path filters (6)
  • patch/u-boot/v2025.10/defconfig/nanopi-m6-rk3588s_defconfig is excluded by !patch/**
  • patch/u-boot/v2025.10/defconfig/nanopi-m6-spi-rk3588s_defconfig is excluded by !patch/**
  • patch/u-boot/v2025.10/dt_uboot/rk3588s-nanopi-m6-spi-u-boot.dtsi is excluded by !patch/**
  • patch/u-boot/v2025.10/dt_uboot/rk3588s-nanopi-m6-u-boot.dtsi is excluded by !patch/**
  • patch/u-boot/v2025.10/dt_upstream_rockchip/rk3588s-nanopi-m6-spi.dts is excluded by !patch/**
  • patch/u-boot/v2025.10/dt_upstream_rockchip/rk3588s-nanopi-m6.dts is excluded by !patch/**
📒 Files selected for processing (1)
  • config/boards/nanopi-m6.conf (2 hunks)
🔇 Additional comments (3)
config/boards/nanopi-m6.conf (3)

20-22: LGTM!

The guard correctly skips vendor-specific SPI boot mapping for mainline branches (current/edge), allowing the new mainline U-Boot configuration to take precedence.


87-104: LGTM! Mainline U-Boot configuration is well-structured.

The function properly configures mainline U-Boot for current/edge branches with appropriate guards, version tags, and target mappings. The multi-line UBOOT_TARGET_MAP declaration correctly handles both SPI and standard boot configurations.


81-81: ****

The destination directory $uboottempdir/usr/lib/u-boot/ is guaranteed to exist when this function executes. The compile_uboot function in lib/functions/compilation/uboot.sh creates the directory at line 431 with mkdir -p "$uboottempdir/usr/lib/u-boot", which executes before the pre_package_uboot_image extension methods are called at line 459. Additionally, the function already includes a file existence check for the source file at line 80, providing defensive handling.

Likely an incorrect or invalid review comment.

@igorpecovnik igorpecovnik merged commit 50a4141 into armbian:main Oct 22, 2025
1 check passed
@github-actions
Copy link
Contributor

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

@github-actions github-actions bot added Ready to merge Reviewed, tested and ready for merge and removed Needs review Seeking for review labels Oct 22, 2025
@rpardini
Copy link
Member

Nice, null-patch-free

jonaswood01 added a commit to TexasInstruments/armbian-build that referenced this pull request Oct 22, 2025
* live_main_upstream/main: (236 commits)
  qemu-uboot-{x86|arm64}: bump u-boot to v2025.10 final
  mixtile-blade3: bump edge u-boot to v2025.10 final
  cm3588-nas: bump u-boot to v2025.10 final
  cm3588-nas: u-boot: bump 2025.01 -> 2025.10-rc4
  nanopct6(-lts): bump u-boot to v2025.10 final
  nanopct6(-lts): u-boot: bump 2025.04 -> 2025.10-rc4
  nanopi-r3s-lts: board config maint
  bsp armbian-ramlog - move HDD_LOG declaration before sourcing /etc/default/armbian-ramlog don't do clever things when using overridden HDD_LOG
  `Automatic` board configs status synchronise
  nanopi-m6: add support for mainline uboot (armbian#8793)
  mainline uboot doesnt work with vendor kernel
  get rid of vendor uboot, adjust aic8800
  fix typo and brackets
  bump uboot to latest stable, simplify logic
  opi5plus - board config maintenance (armbian#8787)
  rk35xx, rockchip-rk3588: fix pre_config_uboot_target prevent board-specific hooks from running
  `Automatic` board configs status synchronise
  rockchip64-6.18: add DT patches for NPU on T6(-LTS) and CM3588-NAS
  rockchip64-6.18: fix `net-phy-realtek-add-rtl8211x-LED-configuration-from-OF` for v6.18-rc2
  rockchip64-6.18: drop upstreamed DT changes for R6*, T6, CM3588-NAS (USB3/HDMI-RX)
  rockchip64-6.18: rewrite/rebase patches - no changes - vs v6.18-rc2
  mainline-kernel: bump 6.18 to `-rc2`
  Add warning for rockchip uboot on modern hosts
  SpacemiT: Update `EDGE` to linux-6.17.y
  Move to supported, drop device tree as it was merged to the kernel repository
  add r58-4x4
  meson64-6.18: rewrite patches
  meson64: bump edge 6.17 -> 6.18
  meson64-6.18: bump 6.17 -> 6.18 via rename
  rockchip64-6.18: .config: `CONFIG_DRM_ACCEL_ROCKET=m`
  drivers_network: update `rtl8723DS` with amazingfate's fix for 6.18
  drivers_network: update `rtl8852bs` with amazingfate's fix for 6.18
  rockchip64-6.18: rewrite/rebase patches - no changes
  rockchip64-6.18: media-0001-Add-rkvdec-Support-v5: drop upstreamed patch (:12)
  rockchip64-6.18: update patches
  rockchip64_common: bump edge to 6.18
  uefi-arm64-6.18: fix net-stmicro-stmmac-Phytium-onboard-ethernet-drivers-and-ACPI-glue
  uefi-arm64-edge: bump edge 6.17 -> 6.18 via rename
  uefi-loong64-edge: bump to 6.18
  uefi: bump edge to 6.18
  Add wget to prepare-host.sh (armbian#8779)
  armsom-forge1: add uboot patch to enable booting from btrfs partition
  armsom-forge1: change BOOTCONFIG to its own
  partitioning: allow single root partition for all filesystem type
  remove wget from build-host basic-deps
  build machinery - replace wget with curl cuz reasons
  qcs6490-edge: bump to 6.18
  qcs6490-edge: bump to 6.17
  armbian-kernel.sh enable zram compression backends: LZ4, LZ4HC, ZSTD, DEFLATE, 842, and LZO
  rockchip: Add CSC board Luckfox Lyra Zero W
  filogic patches - tweak 0000.patching_config.yaml
  filogic - fix for openwrt kernel tree's lack of bpi-r4 sd dtb
  filogic - enable more kernel modules
  potential edge kernel for filogic/bananapi BPI-Router-Linux v6.12 as current, chainsx as legacy
  armsom-forge1: rename dtb name to match mainline
  build machinery - fixup compilation for uboot/atf BRANCH=edge, pass --no-warn-rwx-segments to linker, not compiler
  build(deps): bump peter-evans/create-pull-request from 6 to 7
  build(deps): bump actions/download-artifact from 4 to 5
  build(deps): bump github/codeql-action from 3 to 4
  build(deps): bump rich from 14.1.0 to 14.2.0
  build(deps): bump actions/checkout from 4 to 5
  update rtl88x2cs external driver for kernel 6.18+
  `Automatic` board configs status synchronise
  `Automatic` board configs status synchronise
  meson64-6.17: edge: .config: enable a bunch of RTL/RTW88
  meson64-6.17: edge: .config update, no changes
  meson64-6.17: arm64: dts: amlogic: Enable the npu node for Radxa Zero 2
  meson64-6.17: rewrite/rebase against v6.17.1, no changes
  meson64-6.17: rework g12b pinmux/pinctrl; thanks to retro98boy
  meson64-6.17: rework `jethome-0001-Fix-meson64-add-gpio-irq-patch-from-https-lkml.org-l.patch`
  meson64-6.17: reworked hwmon-emc2305-fixups-for-driver.patch; thanks to pyavitz
  meson64-6.17: borrow drv-spi-spidev-remove-warnings.patch from rockchip64
  meson64: bump edge to 6.17
  meson64: bump to 6.17 via rename
  meson64-6.16: rewrite/rebase patches vs v6.16.10
  linux-uefi-arm64-cloud.config: enable CONFIG_SND_VIRTIO so virtual desktop has sound
  linux-uefi-arm64-cloud.config: enable CONFIG_INPUT_UINPUT for spice agent
  Bump u-boot to v2025.10-rc5 for orangepi4-lts
  Bump u-boot to v2025.10-rc5 for Radxa rockpi-e
  `Automatic` board configs status synchronise
  Add Wi-Fi injection patch for Linux 6.12 kernels.
  bsp: armbian-install: Correct the eMMC indication for some devices.
  sunxi-6.12: Switch to v6.12.51
  sunxi-6.12: re-extract megous patches
  mixtile-blade3: u-boot: edge: v2025.10-rc3; add dts/u-boot.dtsi/defconfig
  u-boot: v2025.10: prepare 0000.patching_config.yaml for null-patch-free u-boot
  mixtile-blade3: use vendor uboot also for legacy branch
  mixtile-blade3: generic mainline uboot for edge branch
  Automatic: kernel config rewrite
  GHA: rewrite kernel configs and open a PR if there are changes
  Use Debian SID when generating JSONs
  Add Kernel overlay to reduce eMMC frequency for FriendlyElec NanoPC-T6 boards
  SMART AM40: Enable native HDMI interface in OPS slot
  mainline-kernel.conf: let 6.17 update further than v6.17 (eg v6.17.1) (armbian#8737)
  Update rtl88x2cs driver commit hash for kernel 6.17+
  don't fail distro agnostic sshd adjustments when config is not found (armbian#8729)
  `Automatic` board configs status synchronise
  rockchip64-6.17: add rkvdec patch for rk35xx back
  extensions: radxa-aic8800: allow 6.17; skip DKMS only on >= 6.18
  rockchip64: current: fix display mode patches for rk3588 boards
  ...

Signed-off-by: Jonas Wood <jw@ti.com>
@coderabbitai coderabbitai bot mentioned this pull request Nov 15, 2025
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

11 Milestone: Fourth quarter release 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