Skip to content

Conversation

@rpardini
Copy link
Member

@rpardini rpardini commented Jan 12, 2026

u-boot: v2026.01: rockchip: rk3588: stable MAC addresses system fdt fixup on gmac0/1

  • 🌱 u-boot: v2026.01: rockchip: rk3588: stable MAC addresses system fdt fixup on gmac0/1
    • Add a generic mechanism to patch MAC addresses from the environment (ethaddr/eth1addr) into gmac0/gmac1 DT nodes (mac-address) for RK3588 boards, skipping nodes not status="okay".
    • Addresses are given to nodes in a first-status-okay-come, first-served basis.
    • If no nodes are found, inject ethaddr into /chosen as a fallback.
    • Logging and a compile-time warning are included for clarity.
    • New Kconfig ROCKCHIP_RK3588_STABLE_GMAC_OF_FIXUP implies OF_SYSTEM_SETUP when enabled
    • Any gmac-based boards can benefit from this with scripts/config --enable CONFIG_ROCKCHIP_RK3588_STABLE_GMAC_OF_FIXUP
  • 🌿 mixtile-core3588e: u-boot: enable ramboot, add usb471/2 to targets
  • 🍃 mixtile-core3588e: u-boot: enable ROCKCHIP_RK3588_STABLE_GMAC_OF_FIXUP
    • which I just patched in 1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX

…ixup on gmac0/1

- Add a generic mechanism to patch MAC addresses from the environment (ethaddr/eth1addr) into gmac0/gmac1 DT nodes (mac-address) for RK3588 boards, skipping nodes not status="okay".
- Addresses are given to nodes in a first-status-okay-come, first-served basis.
- If no nodes are found, inject ethaddr into /chosen as a fallback.
- Logging and a compile-time warning are included for clarity.
- New Kconfig `ROCKCHIP_RK3588_STABLE_GMAC_OF_FIXUP` implies OF_SYSTEM_SETUP when enabled
- Any gmac-based boards can benefit from this with `scripts/config --enable CONFIG_ROCKCHIP_RK3588_STABLE_GMAC_OF_FIXUP`
- Yes I will (try) to send this upstream one day
- which I just patched in `1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX`
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 12, 2026

📝 Walkthrough

Walkthrough

This change extends RK3588 U-Boot configuration for the Mixtile Core3588E board by adding USB boot target variants and implementing a device tree MAC address fixup mechanism. The MAC fixup reads ethaddr/eth1addr environment variables and patches them into gmac device tree nodes during system setup, ensuring stable MAC addresses.

Changes

Cohort / File(s) Change Summary
Board Configuration
config/boards/mixtile-core3588e.csc
Extended UBOOT_TARGET_MAP with declare -g to include USB boot targets (u-boot-rockchip-usb471.bin, u-boot-rockchip-usb472.bin); added post_config_uboot_target hook for RAMBoot and stable GMAC configuration.
U-Boot RK3588 MAC Fixup
arch/arm/mach-rockchip/rk3588/Kconfig, arch/arm/mach-rockchip/rk3588/rk3588.c
Introduced ROCKCHIP_RK3588_STABLE_GMAC_OF_FIXUP Kconfig option; implemented rk3588_fdt_fixup_mac() to patch MAC addresses (ethaddr/eth1addr) into gmac0/gmac1 device tree nodes with fallback to /chosen; integrated into ft_system_setup() hook.
U-Boot Patch
patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch
New patch file packaging the RK3588 MAC fixup logic and Kconfig integration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • SuperKali
  • Tonymac32
  • igorpecovnik
  • paolosabatino
  • NicoD-SBC
  • pyavitz

Poem

🐰 MAC addresses dance through the device tree,
USB boot targets set the system free,
GMAC nodes patched with stable care,
FDT fixups flowing everywhere! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding stable MAC address fixup for RK3588 gmac nodes via device-tree patching in U-Boot v2026.01, which aligns with the primary objective across both commits.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings

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 size/medium PR with more then 50 and less then 250 lines 02 Milestone: First quarter release Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Jan 12, 2026
@rpardini
Copy link
Member Author

This is how it plays out:

<...snip...>
## Loading init Ramdisk from Legacy Image at 12180000 ...
   Image Name:   uInitrd
   Image Type:   AArch64 Linux RAMDfying Checksum ... OK
## Flattened Device Tree blob at 12000000
   Booting using the fdt blob at 0x12000000
Working FDT set to 12000000
   Loading Ramdisk to eb03f000, end ecbffe43 ... OK
   Loading Device Tree to 00000000ecdcb000, end 00000000ece60fff ... OK
Working FDT set to ecdcb000
[rk3588] ft_system_setup() called
[rk3588] rk3588_fdt_fixup_mac() called
[rk3588] MAC fixup: ethaddr=26:d6:38:4b:54:3a, eth1addr=26:d6:38:4b:54:3b
[rk3588] Skipping gmac node at offset 40428: status='disabled'
[rk3588] Patching gmac node at offset 125564 with MAC
[rk3588] Successfully set mac-address
[rk3588] Total gmac nodes found: 2, patched: 1
[rk3588] ft_system_setup() completed

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x412fd050]
[    0.000000] Linux version 6.19.0-rc4-edge-rockchip64 (build@armbian) (aarch64-linux-gnu-gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0, GNU ld (GNU Binutils for Ubuntu) 2.42) #5 SMP PREEMPT Sun Jan  4 22:41:55 UTC 2026
<...snip...>

@rpardini rpardini marked this pull request as ready for review January 12, 2026 15:18
@rpardini rpardini requested a review from a team January 12, 2026 15:19
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

🤖 Fix all issues with AI agents
In
@patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch:
- Around line 86-94: Add an explicit check for the /chosen node returned by
fdt_path_offset before calling fdt_setprop: after computing int chosen =
fdt_path_offset(blob, "/chosen"); verify chosen is non-negative, and if negative
log an explicit message (using fdt_strerror(chosen)) and skip calling
fdt_setprop; only call fdt_setprop(blob, chosen, "mac-address", macs[0], 6) when
chosen >= 0 and keep the existing logging for fdt_setprop’s return value.
📜 Review details

Configuration used: Path: .coderabbit.yaml

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 b954ad8 and 2844259.

📒 Files selected for processing (2)
  • config/boards/mixtile-core3588e.csc
  • patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch
🧰 Additional context used
🧠 Learnings (25)
📓 Common learnings
Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:73-75
Timestamp: 2025-03-31T22:20:41.849Z
Learning: When porting patches between U-Boot versions (like from 2025.01 to 2025.04), rpardini prefers to maintain patches as-is rather than introducing refactoring changes, even when potential improvements are identified. This approach prioritizes consistency and reduces the risk of introducing new issues.
Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub or the PR API to get the complete picture of what files are being added or modified.
Learnt from: rpardini
Repo: armbian/build PR: 9159
File: patch/u-boot/u-boot-genio/0026-dts-configs-add-Grinn-GenioSBC-510.patch:161-161
Timestamp: 2026-01-03T20:46:29.189Z
Learning: For the Armbian genio family (config/sources/families/genio.conf and patch/u-boot/u-boot-genio/), when reviewing PRs that include vendor U-Boot patches from Collabora, avoid flagging potential issues in board configurations that are out of scope for the PR's primary focus (e.g., don't flag Genio 510/700 board issues when the PR is focused on radxa-nio-12l/Genio 1200). The maintainer prioritizes keeping vendor patches close to upstream for easier re-copying and maintenance, even if secondary board configs have potential mismatches.
<!-- </add_learning>
Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-19T13:56:45.124Z
Learning: When reviewing kernel or u-boot version bump PRs in the Armbian build system, check if patches existed in previous kernel version directories (e.g., sunxi-6.12, sunxi-6.13) before describing them as new features. If a patch and the majority of its contents existed previously with no major functionality changes, focus the review on the actual changes: the version bump itself and patch compatibility adjustments. Don't describe existing patches being ported/maintained across versions as new features or drivers—this is misleading. The patches are existing code being re-aligned to work with the new upstream version.
Learnt from: amazingfate
Repo: armbian/build PR: 8619
File: config/sources/families/rockchip.conf:222-230
Timestamp: 2025-09-14T06:32:29.806Z
Learning: In the Armbian build system, the write_uboot_platform() function implementations follow different patterns across Rockchip family files. The newer standard (used in rockchip64_common.inc and rk3506) includes 'status=none' parameter in dd commands, while older implementations (rk3288, rk322x) use an older pattern without this parameter. The rk3506 implementation correctly follows the current Rockchip family standard.
Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub API (https://api.github.com/repos/armbian/build/pulls/{pr_number}/files) to get the complete picture of what files are being added or modified, especially for U-Boot patches that will be applied during the build process.
Learnt from: EvilOlaf
Repo: armbian/build PR: 8968
File: patch/u-boot/u-boot-sunxi/arm64-dts-sun50i-h6-orangepi.dtsi-Rollback-r_rsb-to-r_i2c.patch:36-36
Timestamp: 2025-11-20T18:20:11.985Z
Learning: The rewrite-patches tool (REWRITE_PATCHES=yes) in the Armbian build system can inadvertently introduce semantic changes when the u-boot/kernel git base revision differs from expected state. The tool applies patches, commits them, and re-exports them using git format-patch, which can cause the re-exported patch to reflect the base revision's state rather than preserving the original patch intent. This is particularly problematic for device tree changes like interrupt specifications. The tool currently lacks validation mechanisms to detect such semantic drift, and affected patches must be manually corrected after rewriting.
Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:76-86
Timestamp: 2025-03-31T22:20:48.475Z
Learning: For the Armbian build project, maintaining consistency with existing patches across U-Boot versions (such as between 2025.01 and 2025.04) is prioritized over refactoring individual patches for code improvements.
Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:17-25
Timestamp: 2025-12-13T11:45:02.422Z
Learning: In the SpacemiT U-Boot patches for Armbian (patch/u-boot/legacy/u-boot-spacemit-k1/), the environment variable `devnum` is set to the device name string (e.g., "mmc", "nvme") rather than a numeric index, and `distro_bootpart` holds the partition number. This implementation aligns with mainline U-Boot conventions for the SpacemiT platform and has been verified to work correctly by the maintainer.
Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:28-67
Timestamp: 2025-12-13T11:39:08.046Z
Learning: In the Armbian build system for SpacemiT U-Boot patches (patch/u-boot/legacy/u-boot-spacemit-k1/), alignment with mainline U-Boot behavior is prioritized. For example, in boot mode handling, leaving devnum unchanged in the default case (when devtype is cleared) follows mainline conventions rather than explicitly clearing it to handle edge cases.
Learnt from: HackingGate
Repo: armbian/build PR: 8665
File: config/boards/photonicat2.csc:4-4
Timestamp: 2025-10-26T10:41:35.118Z
Learning: In the Armbian build system, rk3576 boards consistently use BOARDFAMILY="rk35xx" for both vendor and edge kernel targets. The rk35xx family configuration sources rockchip64_common.inc, which provides edge and current kernel branch definitions, making these branches available even though they're not defined directly in rk35xx.conf.
Learnt from: rpardini
Repo: armbian/build PR: 8879
File: config/sources/families/uefi-x86.conf:0-0
Timestamp: 2025-11-06T15:36:04.682Z
Learning: As of PR #8879, the uefi-x86 family in the Armbian build system now includes kernel patches for the first time. The current and edge branches for uefi-x86 are specifically configured for Apple T2-based x86 machines, including T2-specific patches from the linux-t2 project and custom kernel configuration options for Apple hardware drivers.
Learnt from: Grippy98
Repo: armbian/build PR: 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.
📚 Learning: 2025-11-02T20:49:56.719Z
Learnt from: igorpecovnik
Repo: armbian/build PR: 8849
File: config/boards/radxa-e54c.csc:14-28
Timestamp: 2025-11-02T20:49:56.719Z
Learning: In Armbian board configuration files (config/boards/*.conf, *.csc, etc.), do not use kernel_config_set, kernel_config_set_m, kernel_config_set_y, or custom_kernel_config__* functions to modify kernel configuration. Kernel configuration is associated with LINUXFAMILY/BOARDFAMILY, not individual BOARD. Board-specific kernel modifications cause inconsistency in kernel packages published to the apt repository because boards within a family share the same kernel packages. Kernel configuration changes must be made in the appropriate kernel config file (e.g., config/kernel/linux-*-*.config) or in family configuration files (config/sources/families/*.conf, *.inc) instead.

Applied to files:

  • config/boards/mixtile-core3588e.csc
📚 Learning: 2025-12-13T11:39:08.046Z
Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:28-67
Timestamp: 2025-12-13T11:39:08.046Z
Learning: In the Armbian build system for SpacemiT U-Boot patches (patch/u-boot/legacy/u-boot-spacemit-k1/), alignment with mainline U-Boot behavior is prioritized. For example, in boot mode handling, leaving devnum unchanged in the default case (when devtype is cleared) follows mainline conventions rather than explicitly clearing it to handle edge cases.

Applied to files:

  • config/boards/mixtile-core3588e.csc
  • patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch
📚 Learning: 2025-09-14T06:32:29.806Z
Learnt from: amazingfate
Repo: armbian/build PR: 8619
File: config/sources/families/rockchip.conf:222-230
Timestamp: 2025-09-14T06:32:29.806Z
Learning: In the Armbian build system, the write_uboot_platform() function implementations follow different patterns across Rockchip family files. The newer standard (used in rockchip64_common.inc and rk3506) includes 'status=none' parameter in dd commands, while older implementations (rk3288, rk322x) use an older pattern without this parameter. The rk3506 implementation correctly follows the current Rockchip family standard.

Applied to files:

  • config/boards/mixtile-core3588e.csc
  • patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch
📚 Learning: 2025-12-13T11:45:02.422Z
Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:17-25
Timestamp: 2025-12-13T11:45:02.422Z
Learning: In the SpacemiT U-Boot patches for Armbian (patch/u-boot/legacy/u-boot-spacemit-k1/), the environment variable `devnum` is set to the device name string (e.g., "mmc", "nvme") rather than a numeric index, and `distro_bootpart` holds the partition number. This implementation aligns with mainline U-Boot conventions for the SpacemiT platform and has been verified to work correctly by the maintainer.

Applied to files:

  • config/boards/mixtile-core3588e.csc
  • patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch
📚 Learning: 2026-01-03T20:46:29.189Z
Learnt from: rpardini
Repo: armbian/build PR: 9159
File: patch/u-boot/u-boot-genio/0026-dts-configs-add-Grinn-GenioSBC-510.patch:161-161
Timestamp: 2026-01-03T20:46:29.189Z
Learning: For the Armbian genio family (config/sources/families/genio.conf and patch/u-boot/u-boot-genio/), when reviewing PRs that include vendor U-Boot patches from Collabora, avoid flagging potential issues in board configurations that are out of scope for the PR's primary focus (e.g., don't flag Genio 510/700 board issues when the PR is focused on radxa-nio-12l/Genio 1200). The maintainer prioritizes keeping vendor patches close to upstream for easier re-copying and maintenance, even if secondary board configs have potential mismatches.
<!-- </add_learning>

Applied to files:

  • config/boards/mixtile-core3588e.csc
📚 Learning: 2025-09-12T19:28:38.491Z
Learnt from: Grippy98
Repo: armbian/build PR: 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.

Applied to files:

  • config/boards/mixtile-core3588e.csc
📚 Learning: 2025-10-26T10:41:35.118Z
Learnt from: HackingGate
Repo: armbian/build PR: 8665
File: config/boards/photonicat2.csc:4-4
Timestamp: 2025-10-26T10:41:35.118Z
Learning: In the Armbian build system, rk3576 boards consistently use BOARDFAMILY="rk35xx" for both vendor and edge kernel targets. The rk35xx family configuration sources rockchip64_common.inc, which provides edge and current kernel branch definitions, making these branches available even though they're not defined directly in rk35xx.conf.

Applied to files:

  • config/boards/mixtile-core3588e.csc
📚 Learning: 2025-09-18T03:36:17.862Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8537
File: config/boards/qcom-robotics-rb5.conf:1-1
Timestamp: 2025-09-18T03:36:17.862Z
Learning: In Armbian board configuration files (regardless of file extension), the standard pattern is to have only one line as a comment describing the board hardware specifications. This single-line description typically includes the SoC model, core count, RAM options, and key features like connectivity options, storage interfaces, and special features. The file extensions indicate board support status: .conf (standard support), .csc (community supported), .eos (end of support), .tvb (tvbox), .wip (work in progress).

Applied to files:

  • config/boards/mixtile-core3588e.csc
📚 Learning: 2025-03-31T22:20:41.849Z
Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:73-75
Timestamp: 2025-03-31T22:20:41.849Z
Learning: When porting patches between U-Boot versions (like from 2025.01 to 2025.04), rpardini prefers to maintain patches as-is rather than introducing refactoring changes, even when potential improvements are identified. This approach prioritizes consistency and reduces the risk of introducing new issues.

Applied to files:

  • config/boards/mixtile-core3588e.csc
  • patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch
📚 Learning: 2025-07-25T03:51:50.830Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub or the PR API to get the complete picture of what files are being added or modified.

Applied to files:

  • config/boards/mixtile-core3588e.csc
📚 Learning: 2025-07-23T07:30:52.265Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8417
File: config/boards/orangepi5pro.csc:57-58
Timestamp: 2025-07-23T07:30:52.265Z
Learning: In the Armbian build system, BOOTPATCHDIR can contain board-specific subdirectories (e.g., board_orangepi5pro) for applying patches to specific boards only. The framework automatically checks if such board-specific subdirectories exist for the board being built and applies those patches accordingly.

Applied to files:

  • config/boards/mixtile-core3588e.csc
📚 Learning: 2025-10-14T05:08:11.785Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8754
File: config/boards/bestv-r3300-l.csc:14-16
Timestamp: 2025-10-14T05:08:11.785Z
Learning: In the Armbian build system, BOOTBRANCH_BOARD is a valid framework variable used as a fallback when BOOTBRANCH is unset. The framework checks BOOTBRANCH_BOARD before applying the default bootloader branch value (see config/sources/common.conf). Board configuration files can use BOOTBRANCH_BOARD to specify the bootloader branch.

Applied to files:

  • config/boards/mixtile-core3588e.csc
📚 Learning: 2025-11-13T14:50:44.662Z
Learnt from: tabrisnet
Repo: armbian/build PR: 8925
File: lib/functions/host/docker.sh:141-141
Timestamp: 2025-11-13T14:50:44.662Z
Learning: In the Armbian build system, certain boards have U-Boot that doesn't build correctly on ubuntu:noble but works on ubuntu:jammy. For these boards, DOCKER_ARMBIAN_BASE_IMAGE can be set to "ubuntu:jammy" via an extension file loaded before docker_cli_prepare() runs, allowing legacy toolchains to work while the community works on proper fixes with limited resources.

Applied to files:

  • config/boards/mixtile-core3588e.csc
📚 Learning: 2025-06-12T21:03:39.686Z
Learnt from: djurny
Repo: armbian/build PR: 8287
File: config/bootscripts/boot-sunxi.cmd:148-161
Timestamp: 2025-06-12T21:03:39.686Z
Learning: In Armbian U-Boot bootscripts, the `${cpu}` environment variable is always pre-set by U-Boot (or defaults to a valid value), so additional guards against it being unset are unnecessary.

Applied to files:

  • config/boards/mixtile-core3588e.csc
📚 Learning: 2025-08-02T05:46:10.664Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-08-02T05:46:10.664Z
Learning: In the Armbian build system, the modern recommended approach for kernel configuration is to use the kernel-config command via "./compile.sh BOARD=boardname BRANCH=branchname kernel-config" instead of the deprecated KERNEL_CONFIGURE=yes flag. This provides a two-step workflow: configure using menuconfig, then build, with better transparency and control over configuration changes.

Applied to files:

  • config/boards/mixtile-core3588e.csc
📚 Learning: 2025-06-04T23:45:38.860Z
Learnt from: djurny
Repo: armbian/build PR: 8272
File: config/bootscripts/boot-mvebu.cmd:182-186
Timestamp: 2025-06-04T23:45:38.860Z
Learning: In config/bootscripts/boot-mvebu.cmd, the `fdtfile` variable is mandatory for booting and is pre-set by U-Boot, but can be overridden via armbianEnv.txt. If `fdtfile` is empty, the subsequent device tree file search logic will eventually fail and trigger the critical error "Cannot find DT!" with proper error handling.

Applied to files:

  • config/boards/mixtile-core3588e.csc
📚 Learning: 2025-12-28T15:39:55.793Z
Learnt from: rpardini
Repo: armbian/build PR: 9119
File: config/boards/mixtile-core3588e.csc:1-1
Timestamp: 2025-12-28T15:39:55.793Z
Learning: In board configuration comments, e.g., a reference to Jetson SoM, treat it as indicating compatibility with the form factor/pin layout rather than implying the board uses an NVIDIA Jetson product. This helps reviewers avoid misclassifying boards as Jetson-based. Apply this understanding broadly to all .csc files under config/boards to ensure consistent interpretation of form-factor references.

Applied to files:

  • config/boards/mixtile-core3588e.csc
📚 Learning: 2025-11-20T18:20:11.985Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8968
File: patch/u-boot/u-boot-sunxi/arm64-dts-sun50i-h6-orangepi.dtsi-Rollback-r_rsb-to-r_i2c.patch:36-36
Timestamp: 2025-11-20T18:20:11.985Z
Learning: The rewrite-patches tool (REWRITE_PATCHES=yes) in the Armbian build system can inadvertently introduce semantic changes when the u-boot/kernel git base revision differs from expected state. The tool applies patches, commits them, and re-exports them using git format-patch, which can cause the re-exported patch to reflect the base revision's state rather than preserving the original patch intent. This is particularly problematic for device tree changes like interrupt specifications. The tool currently lacks validation mechanisms to detect such semantic drift, and affected patches must be manually corrected after rewriting.

Applied to files:

  • patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch
📚 Learning: 2025-12-17T05:09:02.306Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-17T05:09:02.306Z
Learning: In the Armbian build system, kernel patches (e.g., in patch/kernel/archive/sunxi-6.18/patches.armbian/) contain device tree overlays and other code that have existed for years and are maintained/ported across kernel versions. When reviewing PRs that modify these patch files, focus on the actual changes being made (e.g., Makefile fixes, new additions) rather than reviewing the entire existing content within the patch as if it were new code. The patch file contents are existing, stable code unless explicitly modified in the PR diff.

Applied to files:

  • patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch
📚 Learning: 2025-03-31T22:20:48.475Z
Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:76-86
Timestamp: 2025-03-31T22:20:48.475Z
Learning: For the Armbian build project, maintaining consistency with existing patches across U-Boot versions (such as between 2025.01 and 2025.04) is prioritized over refactoring individual patches for code improvements.

Applied to files:

  • patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch
📚 Learning: 2025-09-09T07:30:22.419Z
Learnt from: amazingfate
Repo: armbian/build PR: 8595
File: lib/functions/compilation/patch/drivers_network.sh:0-0
Timestamp: 2025-09-09T07:30:22.419Z
Learning: RTW_WARN_LMT sed workaround in driver_rtl8852bs() function in lib/functions/compilation/patch/drivers_network.sh is necessary for kernel 6.1 compatibility, even when the upstream wifi-rtl8852bs driver has the macro defined for newer kernels. The workaround ensures cross-kernel compatibility from 6.1 to 6.16+.

Applied to files:

  • patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch
📚 Learning: 2025-12-21T10:28:48.455Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 9086
File: patch/kernel/archive/uefi-arm64-6.19/net-stmicro-stmmac-Phytium-onboard-ethernet-drivers-and-ACPI-glue-for-6.x.patch.disabled:625-633
Timestamp: 2025-12-21T10:28:48.455Z
Learning: The patch "net-stmicro-stmmac-Phytium-onboard-ethernet-drivers-and-ACPI-glue-for-6.x.patch" in patch/kernel/archive/uefi-arm64-6.19/ is known to break compilation on kernel 6.19 and is therefore disabled (has .disabled extension).

Applied to files:

  • patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch
📚 Learning: 2025-12-19T13:56:45.124Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-19T13:56:45.124Z
Learning: When reviewing kernel or u-boot version bump PRs in the Armbian build system, check if patches existed in previous kernel version directories (e.g., sunxi-6.12, sunxi-6.13) before describing them as new features. If a patch and the majority of its contents existed previously with no major functionality changes, focus the review on the actual changes: the version bump itself and patch compatibility adjustments. Don't describe existing patches being ported/maintained across versions as new features or drivers—this is misleading. The patches are existing code being re-aligned to work with the new upstream version.

Applied to files:

  • patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch
📚 Learning: 2026-01-10T04:28:58.758Z
Learnt from: kasimling
Repo: armbian/build PR: 9177
File: patch/kernel/archive/rockchip64-6.18/rk3588-1212-arm64-dts-Automatic-fan-speed-and-USB-3.0-Type-A-por.patch:37-41
Timestamp: 2026-01-10T04:28:58.758Z
Learning: When reviewing Linux kernel device-tree bindings involving thermal cooling devices, THERMAL_NO_LIMIT can be used for both min_state (lower) and max_state (upper). If used as lower/min_state, the framework converts it to 0; if used as upper/max_state, it converts to the cooling device's max_state. Verify patch entries like: cooling-device = <&fan THERMAL_NO_LIMIT 1> are valid and correctly reflect the intended bounds. Ensure consistent interpretation of NO_LIMIT in both min and max contexts and that the resulting values align with the device's actual limits.

Applied to files:

  • patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch
🔇 Additional comments (6)
config/boards/mixtile-core3588e.csc (2)

42-42: LGTM: USB boot targets added correctly.

The UBOOT_TARGET_MAP extension adds u-boot-rockchip-usb471.bin and u-boot-rockchip-usb472.bin artifacts, which are generated when CONFIG_ROCKCHIP_MASKROM_IMAGE is enabled (line 67). This enables RAM boot via USB for recovery scenarios.


66-70: LGTM: RAMBoot and stable MAC configuration enables.

The new config enables are well-structured:

  • CONFIG_ROCKCHIP_MASKROM_IMAGE enables USB boot image generation (u-boot-rockchip-usb471.bin / u-boot-rockchip-usb472.bin) for the targets added in line 42
  • CONFIG_ROCKCHIP_RK3588_STABLE_GMAC_OF_FIXUP enables the MAC address fixup feature, with a helpful comment referencing the implementing patch

Both are appropriately logged with display_alert.

patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch (4)

27-32: LGTM: Kconfig option is well-defined.

The select OF_SYSTEM_SETUP dependency correctly ensures ft_system_setup() will be called when this feature is enabled.


43-48: LGTM: Appropriate guards and includes.

The !defined(CONFIG_SPL_BUILD) guard correctly excludes this code from SPL builds where FDT fixup isn't needed. The #warning directive provides visibility during compilation as intended.


63-84: LGTM: Main gmac iteration logic is correct.

The loop correctly:

  • Uses fdt_node_offset_by_compatible() for proper device tree traversal
  • Treats missing status property as "okay" (DT convention)
  • Patches mac-address on enabled nodes in discovery order
  • Limits to 2 MACs maximum

The first-come-first-served assignment aligns with the stated design.


98-106: LGTM: ft_system_setup() implementation.

The __weak attribute allows board-specific overrides while providing a sensible default. The conditional compilation guard correctly matches the function definition above.

Comment on lines +86 to +94
+ if (patched == 0 && have_mac[0]) {
+ log_info("[rk3588] No gmac nodes patched, injecting ethaddr into /chosen as last resort\n");
+ int chosen = fdt_path_offset(blob, "/chosen");
+ int ret = fdt_setprop(blob, chosen, "mac-address", macs[0], 6);
+ if (ret)
+ log_info("[rk3588] Failed to set mac-address in /chosen: %s\n", fdt_strerror(ret));
+ else
+ log_info("[rk3588] Set mac-address in /chosen\n");
+ }
Copy link
Contributor

@coderabbitai coderabbitai bot Jan 12, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Minor: Missing check for /chosen node existence.

fdt_path_offset() returns a negative error code if /chosen doesn't exist. While the subsequent fdt_setprop() will fail and ret will capture the error, explicitly checking would provide a clearer error message.

Suggested improvement
 	if (patched == 0 && have_mac[0]) {
 		log_info("[rk3588] No gmac nodes patched, injecting ethaddr into /chosen as last resort\n");
 		int chosen = fdt_path_offset(blob, "/chosen");
+		if (chosen < 0) {
+			log_info("[rk3588] /chosen node not found: %s\n", fdt_strerror(chosen));
+			return;
+		}
 		int ret = fdt_setprop(blob, chosen, "mac-address", macs[0], 6);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
+ if (patched == 0 && have_mac[0]) {
+ log_info("[rk3588] No gmac nodes patched, injecting ethaddr into /chosen as last resort\n");
+ int chosen = fdt_path_offset(blob, "/chosen");
+ int ret = fdt_setprop(blob, chosen, "mac-address", macs[0], 6);
+ if (ret)
+ log_info("[rk3588] Failed to set mac-address in /chosen: %s\n", fdt_strerror(ret));
+ else
+ log_info("[rk3588] Set mac-address in /chosen\n");
+ }
if (patched == 0 && have_mac[0]) {
log_info("[rk3588] No gmac nodes patched, injecting ethaddr into /chosen as last resort\n");
int chosen = fdt_path_offset(blob, "/chosen");
if (chosen < 0) {
log_info("[rk3588] /chosen node not found: %s\n", fdt_strerror(chosen));
return;
}
int ret = fdt_setprop(blob, chosen, "mac-address", macs[0], 6);
if (ret)
log_info("[rk3588] Failed to set mac-address in /chosen: %s\n", fdt_strerror(ret));
else
log_info("[rk3588] Set mac-address in /chosen\n");
}
🤖 Prompt for AI Agents
In
@patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch
around lines 86 - 94, Add an explicit check for the /chosen node returned by
fdt_path_offset before calling fdt_setprop: after computing int chosen =
fdt_path_offset(blob, "/chosen"); verify chosen is non-negative, and if negative
log an explicit message (using fdt_strerror(chosen)) and skip calling
fdt_setprop; only call fdt_setprop(blob, chosen, "mac-address", macs[0], 6) when
chosen >= 0 and keep the existing logging for fdt_setprop’s return value.

Copy link
Member Author

Choose a reason for hiding this comment

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

Bah. Is that all you got?

Copy link
Contributor

Choose a reason for hiding this comment

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

@rpardini Fair enough! Let me look deeper at the actual logic rather than error handling nits.

After reviewing the code more carefully and checking device tree documentation, I notice something more substantial: the /chosen fallback mechanism may not actually work as intended.

The /chosen node is documented as an informational node that doesn't describe devices, and it may contain arbitrary platform-specific configuration data. However, the standard documented properties in /chosen are things like stdout-path, kaslr-seed, initrd, etc. — but not mac-address.

The typical pattern is for U-Boot to overwrite the local-mac-address property in the actual ethernet/gmac device nodes, not to inject MAC addresses into /chosen. I couldn't find any evidence in the kernel documentation or standard bindings that Linux drivers would look for a mac-address property in /chosen.

So the fallback on lines 97-104 (injecting ethaddr into /chosen/mac-address) likely won't be consumed by any driver, making it an ineffective fallback. If no gmac nodes are patched, the MAC address simply won't be used.

Was the /chosen fallback intended for some downstream or custom driver code, or would it be better to just log a warning and skip the injection entirely?


🧠 Learnings used
Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:73-75
Timestamp: 2025-03-31T22:20:41.849Z
Learning: When porting patches between U-Boot versions (like from 2025.01 to 2025.04), rpardini prefers to maintain patches as-is rather than introducing refactoring changes, even when potential improvements are identified. This approach prioritizes consistency and reduces the risk of introducing new issues.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8968
File: patch/u-boot/u-boot-sunxi/arm64-dts-sun50i-h6-orangepi.dtsi-Rollback-r_rsb-to-r_i2c.patch:36-36
Timestamp: 2025-11-20T18:20:11.985Z
Learning: The rewrite-patches tool (REWRITE_PATCHES=yes) in the Armbian build system can inadvertently introduce semantic changes when the u-boot/kernel git base revision differs from expected state. The tool applies patches, commits them, and re-exports them using git format-patch, which can cause the re-exported patch to reflect the base revision's state rather than preserving the original patch intent. This is particularly problematic for device tree changes like interrupt specifications. The tool currently lacks validation mechanisms to detect such semantic drift, and affected patches must be manually corrected after rewriting.

Learnt from: EvilOlaf
Repo: armbian/build PR: 9086
File: patch/kernel/archive/uefi-arm64-6.19/net-stmicro-stmmac-Phytium-onboard-ethernet-drivers-and-ACPI-glue-for-6.x.patch.disabled:625-633
Timestamp: 2025-12-21T10:28:48.455Z
Learning: The patch "net-stmicro-stmmac-Phytium-onboard-ethernet-drivers-and-ACPI-glue-for-6.x.patch" in patch/kernel/archive/uefi-arm64-6.19/ is known to break compilation on kernel 6.19 and is therefore disabled (has .disabled extension).

Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:76-86
Timestamp: 2025-03-31T22:20:48.475Z
Learning: For the Armbian build project, maintaining consistency with existing patches across U-Boot versions (such as between 2025.01 and 2025.04) is prioritized over refactoring individual patches for code improvements.

Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:28-67
Timestamp: 2025-12-13T11:39:08.046Z
Learning: In the Armbian build system for SpacemiT U-Boot patches (patch/u-boot/legacy/u-boot-spacemit-k1/), alignment with mainline U-Boot behavior is prioritized. For example, in boot mode handling, leaving devnum unchanged in the default case (when devtype is cleared) follows mainline conventions rather than explicitly clearing it to handle edge cases.

Learnt from: amazingfate
Repo: armbian/build PR: 8619
File: config/sources/families/rockchip.conf:222-230
Timestamp: 2025-09-14T06:32:29.806Z
Learning: In the Armbian build system, the write_uboot_platform() function implementations follow different patterns across Rockchip family files. The newer standard (used in rockchip64_common.inc and rk3506) includes 'status=none' parameter in dd commands, while older implementations (rk3288, rk322x) use an older pattern without this parameter. The rk3506 implementation correctly follows the current Rockchip family standard.

Learnt from: amazingfate
Repo: armbian/build PR: 8595
File: lib/functions/compilation/patch/drivers_network.sh:0-0
Timestamp: 2025-09-09T07:30:22.419Z
Learning: RTW_WARN_LMT sed workaround in driver_rtl8852bs() function in lib/functions/compilation/patch/drivers_network.sh is necessary for kernel 6.1 compatibility, even when the upstream wifi-rtl8852bs driver has the macro defined for newer kernels. The workaround ensures cross-kernel compatibility from 6.1 to 6.16+.

Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:17-25
Timestamp: 2025-12-13T11:45:02.422Z
Learning: In the SpacemiT U-Boot patches for Armbian (patch/u-boot/legacy/u-boot-spacemit-k1/), the environment variable `devnum` is set to the device name string (e.g., "mmc", "nvme") rather than a numeric index, and `distro_bootpart` holds the partition number. This implementation aligns with mainline U-Boot conventions for the SpacemiT platform and has been verified to work correctly by the maintainer.

Learnt from: SuperKali
Repo: armbian/build PR: 8608
File: lib/functions/compilation/patch/drivers_network.sh:361-363
Timestamp: 2025-09-11T06:06:52.328Z
Learning: For the RTW88 SDIO RF path detection fix patch (004-rtw88-sdio-rf-path-detection-fix.patch), SuperKali prefers using exact version matching (eq 6.1 || eq 6.16) rather than range checks, as the patch has only been tested on those specific kernel versions and may be mainstreamed soon.

Learnt from: djurny
Repo: armbian/build PR: 8272
File: config/bootscripts/boot-mvebu.cmd:182-186
Timestamp: 2025-06-04T23:45:38.860Z
Learning: In config/bootscripts/boot-mvebu.cmd, the `fdtfile` variable is mandatory for booting and is pre-set by U-Boot, but can be overridden via armbianEnv.txt. If `fdtfile` is empty, the subsequent device tree file search logic will eventually fail and trigger the critical error "Cannot find DT!" with proper error handling.

Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-19T13:56:45.124Z
Learning: When reviewing kernel or u-boot version bump PRs in the Armbian build system, check if patches existed in previous kernel version directories (e.g., sunxi-6.12, sunxi-6.13) before describing them as new features. If a patch and the majority of its contents existed previously with no major functionality changes, focus the review on the actual changes: the version bump itself and patch compatibility adjustments. Don't describe existing patches being ported/maintained across versions as new features or drivers—this is misleading. The patches are existing code being re-aligned to work with the new upstream version.

Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-17T05:09:02.306Z
Learning: In the Armbian build system, kernel patches (e.g., in patch/kernel/archive/sunxi-6.18/patches.armbian/) contain device tree overlays and other code that have existed for years and are maintained/ported across kernel versions. When reviewing PRs that modify these patch files, focus on the actual changes being made (e.g., Makefile fixes, new additions) rather than reviewing the entire existing content within the patch as if it were new code. The patch file contents are existing, stable code unless explicitly modified in the PR diff.

Learnt from: EvilOlaf
Repo: armbian/build PR: 9096
File: patch/kernel/archive/sunxi-6.18/patches.armbian/arm64-dts-sun50i-h616-add-overlays.patch:4-5
Timestamp: 2025-12-17T15:46:22.709Z
Learning: In Armbian kernel patches, when patches are renamed or reorganized, the old Subject line may be intentionally preserved in the patch header (as a second Subject line) for archival/historical purposes to document the previous patch name. This is an Armbian-specific practice for tracking patch evolution and should not be flagged as an error when the maintainer has intentionally included it for documentation.

Learnt from: rpardini
Repo: armbian/build PR: 9159
File: patch/u-boot/u-boot-genio/0026-dts-configs-add-Grinn-GenioSBC-510.patch:161-161
Timestamp: 2026-01-03T20:46:29.189Z
Learning: For the Armbian genio family (config/sources/families/genio.conf and patch/u-boot/u-boot-genio/), when reviewing PRs that include vendor U-Boot patches from Collabora, avoid flagging potential issues in board configurations that are out of scope for the PR's primary focus (e.g., don't flag Genio 510/700 board issues when the PR is focused on radxa-nio-12l/Genio 1200). The maintainer prioritizes keeping vendor patches close to upstream for easier re-copying and maintenance, even if secondary board configs have potential mismatches.
<!-- </add_learning>

Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub or the PR API to get the complete picture of what files are being added or modified.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub API (https://api.github.com/repos/armbian/build/pulls/{pr_number}/files) to get the complete picture of what files are being added or modified, especially for U-Boot patches that will be applied during the build process.

Copy link
Member Author

Choose a reason for hiding this comment

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

It was intended as a fallback for non-gmac boards, since this is mach-rockchip code. For example, if CONFIG_ROCKCHIP_RK3588_STABLE_GMAC_OF_FIXUP was enabled on a board that doesn't have any gmac's "okay"'ed (99% of the time, it's one or two RTL8125 / rtl8169 over pcie), those would still get a stable MAC address; well, at least the first one would.

Copy link
Contributor

Choose a reason for hiding this comment

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

@rpardini, thanks for clarifying the intent! That makes perfect sense for the design goal—providing stable MAC addresses for boards that enable this config but don't have gmac controllers.

However, I couldn't find evidence that the /chosen/mac-address fallback will actually be consumed by PCIe ethernet drivers like r8169 (RTL8125/rtl8169). The /chosen node typically contains "arbitrary number of additional properties for platform-specific configuration data", but standard network drivers look for mac-address and local-mac-address properties in their own device tree nodes, not in /chosen.

U-Boot's standard fdt_fixup_ethernet() function "overwrites the local-mac-address property of your device tree after it gets loaded into memory" in the actual ethernet device nodes found via /aliases. I couldn't find any examples of drivers reading MAC addresses from /chosen.

For PCIe devices that enumerate at runtime, there typically isn't a pre-existing device tree node to patch (unlike gmac which has a static DT node). Have you tested this fallback mechanism with RTL8125/rtl8169 boards, or is there downstream code that handles reading from /chosen? It's possible this is Armbian/RK-specific functionality I'm not aware of, but based on standard kernel behavior, this fallback might not be picked up by the drivers.


🧠 Learnings used
Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:73-75
Timestamp: 2025-03-31T22:20:41.849Z
Learning: When porting patches between U-Boot versions (like from 2025.01 to 2025.04), rpardini prefers to maintain patches as-is rather than introducing refactoring changes, even when potential improvements are identified. This approach prioritizes consistency and reduces the risk of introducing new issues.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8968
File: patch/u-boot/u-boot-sunxi/arm64-dts-sun50i-h6-orangepi.dtsi-Rollback-r_rsb-to-r_i2c.patch:36-36
Timestamp: 2025-11-20T18:20:11.985Z
Learning: The rewrite-patches tool (REWRITE_PATCHES=yes) in the Armbian build system can inadvertently introduce semantic changes when the u-boot/kernel git base revision differs from expected state. The tool applies patches, commits them, and re-exports them using git format-patch, which can cause the re-exported patch to reflect the base revision's state rather than preserving the original patch intent. This is particularly problematic for device tree changes like interrupt specifications. The tool currently lacks validation mechanisms to detect such semantic drift, and affected patches must be manually corrected after rewriting.

Learnt from: EvilOlaf
Repo: armbian/build PR: 9086
File: patch/kernel/archive/uefi-arm64-6.19/net-stmicro-stmmac-Phytium-onboard-ethernet-drivers-and-ACPI-glue-for-6.x.patch.disabled:625-633
Timestamp: 2025-12-21T10:28:48.455Z
Learning: The patch "net-stmicro-stmmac-Phytium-onboard-ethernet-drivers-and-ACPI-glue-for-6.x.patch" in patch/kernel/archive/uefi-arm64-6.19/ is known to break compilation on kernel 6.19 and is therefore disabled (has .disabled extension).

Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:76-86
Timestamp: 2025-03-31T22:20:48.475Z
Learning: For the Armbian build project, maintaining consistency with existing patches across U-Boot versions (such as between 2025.01 and 2025.04) is prioritized over refactoring individual patches for code improvements.

Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:28-67
Timestamp: 2025-12-13T11:39:08.046Z
Learning: In the Armbian build system for SpacemiT U-Boot patches (patch/u-boot/legacy/u-boot-spacemit-k1/), alignment with mainline U-Boot behavior is prioritized. For example, in boot mode handling, leaving devnum unchanged in the default case (when devtype is cleared) follows mainline conventions rather than explicitly clearing it to handle edge cases.

Learnt from: amazingfate
Repo: armbian/build PR: 8619
File: config/sources/families/rockchip.conf:222-230
Timestamp: 2025-09-14T06:32:29.806Z
Learning: In the Armbian build system, the write_uboot_platform() function implementations follow different patterns across Rockchip family files. The newer standard (used in rockchip64_common.inc and rk3506) includes 'status=none' parameter in dd commands, while older implementations (rk3288, rk322x) use an older pattern without this parameter. The rk3506 implementation correctly follows the current Rockchip family standard.

Learnt from: amazingfate
Repo: armbian/build PR: 8595
File: lib/functions/compilation/patch/drivers_network.sh:0-0
Timestamp: 2025-09-09T07:30:22.419Z
Learning: RTW_WARN_LMT sed workaround in driver_rtl8852bs() function in lib/functions/compilation/patch/drivers_network.sh is necessary for kernel 6.1 compatibility, even when the upstream wifi-rtl8852bs driver has the macro defined for newer kernels. The workaround ensures cross-kernel compatibility from 6.1 to 6.16+.

Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:17-25
Timestamp: 2025-12-13T11:45:02.422Z
Learning: In the SpacemiT U-Boot patches for Armbian (patch/u-boot/legacy/u-boot-spacemit-k1/), the environment variable `devnum` is set to the device name string (e.g., "mmc", "nvme") rather than a numeric index, and `distro_bootpart` holds the partition number. This implementation aligns with mainline U-Boot conventions for the SpacemiT platform and has been verified to work correctly by the maintainer.

Learnt from: rpardini
Repo: armbian/build PR: 9159
File: patch/u-boot/u-boot-genio/0026-dts-configs-add-Grinn-GenioSBC-510.patch:161-161
Timestamp: 2026-01-03T20:46:29.189Z
Learning: For the Armbian genio family (config/sources/families/genio.conf and patch/u-boot/u-boot-genio/), when reviewing PRs that include vendor U-Boot patches from Collabora, avoid flagging potential issues in board configurations that are out of scope for the PR's primary focus (e.g., don't flag Genio 510/700 board issues when the PR is focused on radxa-nio-12l/Genio 1200). The maintainer prioritizes keeping vendor patches close to upstream for easier re-copying and maintenance, even if secondary board configs have potential mismatches.
<!-- </add_learning>

Learnt from: tabrisnet
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-09-11T04:34:05.589Z
Learning: The user prefers to remove unreliable eth0 fallback logic entirely rather than attempting to fix it, since there's no sane way to choose the right fallback interface on modern systems with predictable network interface naming.

Learnt from: EvilOlaf
Repo: armbian/build PR: 9096
File: patch/kernel/archive/sunxi-6.18/patches.armbian/arm64-dts-sun50i-h616-add-overlays.patch:4-5
Timestamp: 2025-12-17T15:46:22.709Z
Learning: In Armbian kernel patches, when patches are renamed or reorganized, the old Subject line may be intentionally preserved in the patch header (as a second Subject line) for archival/historical purposes to document the previous patch name. This is an Armbian-specific practice for tracking patch evolution and should not be flagged as an error when the maintainer has intentionally included it for documentation.

Learnt from: igorpecovnik
Repo: armbian/build PR: 8789
File: config/kernel/linux-sunxi64-edge.config:839-839
Timestamp: 2025-10-22T07:51:53.015Z
Learning: In Armbian's wireless driver configuration, CONFIG_RK_WIFI_DEVICE_* options are Rockchip-specific device registration settings, while CONFIG_WLAN_UWE* are the actual cross-platform driver modules for UWE5622 wireless chips. The UWE5622 chip (manufactured by Unisoc/Spreadtrum) is used on multiple Allwinner boards including Orange Pi Zero 2/2W/3 and Orange Pi 3 LTS, so CONFIG_WLAN_UWE5621/5622 along with Unisoc infrastructure options (CONFIG_SPARD_WLAN_SUPPORT, CONFIG_SC23XX, CONFIG_UNISOC_WIFI_PS, CONFIG_WCN_BSP_DRIVER_BUILDIN) are correct in sunxi64 kernel configs.

Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-19T13:56:45.124Z
Learning: When reviewing kernel or u-boot version bump PRs in the Armbian build system, check if patches existed in previous kernel version directories (e.g., sunxi-6.12, sunxi-6.13) before describing them as new features. If a patch and the majority of its contents existed previously with no major functionality changes, focus the review on the actual changes: the version bump itself and patch compatibility adjustments. Don't describe existing patches being ported/maintained across versions as new features or drivers—this is misleading. The patches are existing code being re-aligned to work with the new upstream version.

Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-17T05:09:02.306Z
Learning: In the Armbian build system, kernel patches (e.g., in patch/kernel/archive/sunxi-6.18/patches.armbian/) contain device tree overlays and other code that have existed for years and are maintained/ported across kernel versions. When reviewing PRs that modify these patch files, focus on the actual changes being made (e.g., Makefile fixes, new additions) rather than reviewing the entire existing content within the patch as if it were new code. The patch file contents are existing, stable code unless explicitly modified in the PR diff.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub or the PR API to get the complete picture of what files are being added or modified.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub API (https://api.github.com/repos/armbian/build/pulls/{pr_number}/files) to get the complete picture of what files are being added or modified, especially for U-Boot patches that will be applied during the build process.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, you just make me aware of fdt_fixup_ethernet(), which, in case had worked, would make this whole effort utterly unnecessary. Maybe all I am missing is an ethernet0 = &gmac1 in board device tree.

Copy link
Contributor

Choose a reason for hiding this comment

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

🧩 Analysis chain

🌐 Web query:

U-Boot fdt_fixup_ethernet function MAC address aliases

💡 Result:

Short summary — how fdt_fixup_ethernet handles MAC address aliases in U‑Boot

  • What it scans: U‑Boot’s fdt_fixup_ethernet walks the device‑tree /aliases properties and looks for alias names starting with "ethernet" (ethernet, ethernet0, ethernet1, ...). [1][2]

  • What it does for each alias: it resolves the alias to the device node path, reads the MAC (from the node—e.g. mac-address / local-mac-address), and writes that MAC into U‑Boot environment variables like ethaddr, eth1addr, eth2addr (matching the trailing index in the alias). If the env var is already set it won’t overwrite environment‑based MACs. [1][3]

  • Multiple interfaces: older code had a bug where adding MACs changed the /aliases offsets so only ethernet0 was handled; that was fixed by recomputing the alias property offset per iteration so all ethernetN aliases are processed. See the patch that fixes setting MACs for multiple interfaces. [2]

Useful references:

  • Patch introducing/fixing alias handling and multiple-interface bugfix. [1][2]
  • Practical discussion / use-case (Toradex forum) showing aliases ethernet0/ethernet1 enabling fdt_fixup_ethernet to pass MACs to Linux. [3]

References:
[1] Patchwork: "fdt: eth_fixup: Add hook for board to override MAC".
[2] Patchwork: "fdt: fix setting MAC addresses for multiple interfaces" (fdt_fixup_ethernet change).
[3] Toradex community: passing MAC from U‑Boot to Linux using ethernet aliases.


🌐 Web query:

U-Boot write MAC address to device tree for Linux kernel

💡 Result:

Short answer — two common ways:

  1. Let U-Boot populate the DT from its ethaddr environment (automatic if the DT has ethernet aliases and U-Boot board fixup support). Set ethaddr and saveenv; U-Boot will copy it into the device-tree passed to Linux on boards that implement the DT Ethernet fixup. [1][2]

  2. Manually write the MAC into the loaded DT with the fdt commands before booting the kernel. Example sequence (adjust node path to your board's ethernet node):

  • set the MAC in env (use colons for ethaddr, spaces or hex bytes for fdt):
    => setenv ethaddr aa:bb:cc:dd:ee:ff
    => setenv macbytes aa bb cc dd ee ff
    => saveenv

  • load the dtb and point to it, resize, then set the property:
    => load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/.dtb
    => fdt addr ${fdt_addr_r}
    => fdt resize
    => fdt set /ethernet@ff... local-mac-address "[${macbytes}]"
    => booti ${kernel_addr_r} - ${fdt_addr_r}

Notes:

  • Property name varies: common names are local-mac-address or mac-address/mac-addresses depending on binding. Use the correct node path (you can inspect with fdt print). [3][1]
  • The fdt set syntax used above (bracketed space-separated bytes) is the common U-Boot pattern; many boards/scripts use it (Rock64/SoC examples). [1][3]

References:
[1] U-Boot fdt command docs (usage & examples).
[2] U-Boot/board behavior and automatic ethaddr→DT fixup.
[3] Practical examples (Rock64/other boards) showing fdt set local-mac-address usage.


🌐 Web query:

U-Boot fdt_fixup_ethernet write ethaddr environment to device tree

💡 Result:

Short answer

  • fdt_fixup_ethernet() takes MACs from U-Boot environment (ethaddr, eth1addr, etc.; historically also usbethaddr) and writes them into the device tree node(s) as the mac-address (or local-mac-address) property using the fdt fixup helpers (do_fixup_by_path / fdt_setprop). [1][2][3]

Details you may need

  • It looks up ethernet aliases under /aliases (ethernet, ethernet1, ethernet2, ...) and for each alias sets the corresponding node's mac-address property from the matching env var (ethaddr → ethernet, eth1addr → ethernet1, ...). Implementation historically had special-casing for "usbethaddr" (later deprecated) so current behavior uses eth%daddr names. [1][2]
  • The code uses the fdt fixup functions (do_fixup_by_path / fdt_setprop) to write the 6-byte MAC into the blob. A weak board hook (board_get_enetaddr) has been discussed/used by some patches to allow boards to supply/override MACs. [1][3]
  • Exact behavior depends on U-Boot version: check your tree's common/fdt_support.c / drivers/net/* and the fdt_fixup_ethernet implementation to confirm env variable names and whether usbethaddr is still handled. [2][3]

If you want, tell me your U-Boot version or paste the fdt_fixup_ethernet() code from your tree and I’ll point exactly which env names are used and where the write happens.


🏁 Script executed:

#!/bin/bash
# Check if RK3588 boards already have ethernet aliases in their device trees
# and whether fdt_fixup_ethernet is called in rockchip code

echo "=== Searching for ethernet aliases in RK3588 device trees ==="
rg -n "ethernet[0-9]?\s*=" patch/u-boot/v2026.01/ --type-add 'dts:*.dts*' --type dts -C2 || echo "No ethernet aliases found in v2026.01 patches"

echo ""
echo "=== Searching for fdt_fixup_ethernet calls in rockchip code ==="
rg -n "fdt_fixup_ethernet" patch/u-boot/v2026.01/ -C3 || echo "No fdt_fixup_ethernet calls found"

echo ""
echo "=== Checking if ft_board_setup exists in RK3588 code (where fdt_fixup_ethernet is typically called) ==="
rg -n "ft_board_setup|ft_system_setup" patch/u-boot/v2026.01/1000-rockchip-rk3588* -C3

Length of output: 2188


🌐 Web query:

U-Boot fdt_fixup_ethernet automatically called ft_board_setup

💡 Result:

Short answer: No—fdt_fixup_ethernet is not guaranteed to be automatically invoked inside ft_board_setup. Historically U-Boot had an implicit call, that was removed, and board code or core fdt handling now needs to call fdt_fixup_ethernet explicitly (or call it both before and again after ft_board_setup if overlays / later alias entries appear). [1][2][3]

What the sources show:

  • A sunxi patch added an explicit call to fdt_fixup_ethernet() inside the board's ft_board_setup() because the implicit call had been removed. [1]
  • A hook was added so boards can supply MACs to fdt_fixup_ethernet, but that still requires calling the function (it’s not magically run for every board). [2]
  • Recent fixes/patches show maintainers call fdt_fixup_ethernet before ft_board_setup and sometimes again after (or add an explicit call in ft_board_setup) to handle aliases introduced/changed by overlays or later setup. [3]

If you want, tell me which U-Boot version/board you use and I’ll point to the exact place to add the explicit call or summarize the call order for that version.


@rpardini, excellent observation! Yes, U-Boot's standard fdt_fixup_ethernet() could potentially simplify this significantly. Here's what I found:

How the standard approach works:

U-Boot's fdt_fixup_ethernet() walks /aliases looking for properties starting with "ethernet" (ethernet, ethernet0, ethernet1, ...), resolves each alias to a device node, and writes the corresponding environment MAC (ethaddr, eth1addr, eth2addr) into that node's mac-address or local-mac-address property.

The catch:

fdt_fixup_ethernet() is NOT automatically called—boards must explicitly invoke it, typically in ft_board_setup() or ft_system_setup(). Some boards had an implicit call historically, but that was removed.

What this means for your patch:

You already have the ft_system_setup() hook in place. You could potentially simplify your implementation to:

__weak int ft_system_setup(void *blob, struct bd_info *bd)
{
    log_info("[rk3588] ft_system_setup() called\n");
#if IS_ENABLED(CONFIG_ROCKCHIP_RK3588_STABLE_GMAC_OF_FIXUP) && !defined(CONFIG_SPL_BUILD)
    fdt_fixup_ethernet(blob);  // Standard U-Boot function
#endif
    log_info("[rk3588] ft_system_setup() completed\n");
    return 0;
}

And add to the mixtile-core3588e device tree (and other RK3588 boards):

aliases {
    ethernet0 = &gmac0;
    ethernet1 = &gmac1;
};

Tradeoffs:

Your custom implementation has some advantages over the standard approach:

  • ✅ Explicitly checks status="okay" (standard function might not skip disabled nodes)
  • ✅ Detailed logging of what's being patched
  • ✅ The /chosen fallback (though we discussed its effectiveness)

But the standard approach offers:

  • ✅ Less custom code to maintain
  • ✅ Well-tested across many boards/architectures
  • ✅ Easier to upstream (standard U-Boot behavior)

Worth testing whether the standard fdt_fixup_ethernet() already handles disabled nodes properly, or if your status-checking logic is indeed necessary. The standard approach might "just work" with the right aliases!


🧠 Learnings used
Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:73-75
Timestamp: 2025-03-31T22:20:41.849Z
Learning: When porting patches between U-Boot versions (like from 2025.01 to 2025.04), rpardini prefers to maintain patches as-is rather than introducing refactoring changes, even when potential improvements are identified. This approach prioritizes consistency and reduces the risk of introducing new issues.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8968
File: patch/u-boot/u-boot-sunxi/arm64-dts-sun50i-h6-orangepi.dtsi-Rollback-r_rsb-to-r_i2c.patch:36-36
Timestamp: 2025-11-20T18:20:11.985Z
Learning: The rewrite-patches tool (REWRITE_PATCHES=yes) in the Armbian build system can inadvertently introduce semantic changes when the u-boot/kernel git base revision differs from expected state. The tool applies patches, commits them, and re-exports them using git format-patch, which can cause the re-exported patch to reflect the base revision's state rather than preserving the original patch intent. This is particularly problematic for device tree changes like interrupt specifications. The tool currently lacks validation mechanisms to detect such semantic drift, and affected patches must be manually corrected after rewriting.

Learnt from: EvilOlaf
Repo: armbian/build PR: 9086
File: patch/kernel/archive/uefi-arm64-6.19/net-stmicro-stmmac-Phytium-onboard-ethernet-drivers-and-ACPI-glue-for-6.x.patch.disabled:625-633
Timestamp: 2025-12-21T10:28:48.455Z
Learning: The patch "net-stmicro-stmmac-Phytium-onboard-ethernet-drivers-and-ACPI-glue-for-6.x.patch" in patch/kernel/archive/uefi-arm64-6.19/ is known to break compilation on kernel 6.19 and is therefore disabled (has .disabled extension).

Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:76-86
Timestamp: 2025-03-31T22:20:48.475Z
Learning: For the Armbian build project, maintaining consistency with existing patches across U-Boot versions (such as between 2025.01 and 2025.04) is prioritized over refactoring individual patches for code improvements.

Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:28-67
Timestamp: 2025-12-13T11:39:08.046Z
Learning: In the Armbian build system for SpacemiT U-Boot patches (patch/u-boot/legacy/u-boot-spacemit-k1/), alignment with mainline U-Boot behavior is prioritized. For example, in boot mode handling, leaving devnum unchanged in the default case (when devtype is cleared) follows mainline conventions rather than explicitly clearing it to handle edge cases.

Learnt from: amazingfate
Repo: armbian/build PR: 8619
File: config/sources/families/rockchip.conf:222-230
Timestamp: 2025-09-14T06:32:29.806Z
Learning: In the Armbian build system, the write_uboot_platform() function implementations follow different patterns across Rockchip family files. The newer standard (used in rockchip64_common.inc and rk3506) includes 'status=none' parameter in dd commands, while older implementations (rk3288, rk322x) use an older pattern without this parameter. The rk3506 implementation correctly follows the current Rockchip family standard.

Learnt from: amazingfate
Repo: armbian/build PR: 8595
File: lib/functions/compilation/patch/drivers_network.sh:0-0
Timestamp: 2025-09-09T07:30:22.419Z
Learning: RTW_WARN_LMT sed workaround in driver_rtl8852bs() function in lib/functions/compilation/patch/drivers_network.sh is necessary for kernel 6.1 compatibility, even when the upstream wifi-rtl8852bs driver has the macro defined for newer kernels. The workaround ensures cross-kernel compatibility from 6.1 to 6.16+.

Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:17-25
Timestamp: 2025-12-13T11:45:02.422Z
Learning: In the SpacemiT U-Boot patches for Armbian (patch/u-boot/legacy/u-boot-spacemit-k1/), the environment variable `devnum` is set to the device name string (e.g., "mmc", "nvme") rather than a numeric index, and `distro_bootpart` holds the partition number. This implementation aligns with mainline U-Boot conventions for the SpacemiT platform and has been verified to work correctly by the maintainer.

Learnt from: rpardini
Repo: armbian/build PR: 9159
File: patch/u-boot/u-boot-genio/0026-dts-configs-add-Grinn-GenioSBC-510.patch:161-161
Timestamp: 2026-01-03T20:46:29.189Z
Learning: For the Armbian genio family (config/sources/families/genio.conf and patch/u-boot/u-boot-genio/), when reviewing PRs that include vendor U-Boot patches from Collabora, avoid flagging potential issues in board configurations that are out of scope for the PR's primary focus (e.g., don't flag Genio 510/700 board issues when the PR is focused on radxa-nio-12l/Genio 1200). The maintainer prioritizes keeping vendor patches close to upstream for easier re-copying and maintenance, even if secondary board configs have potential mismatches.
<!-- </add_learning>

Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-17T05:09:02.306Z
Learning: In the Armbian build system, kernel patches (e.g., in patch/kernel/archive/sunxi-6.18/patches.armbian/) contain device tree overlays and other code that have existed for years and are maintained/ported across kernel versions. When reviewing PRs that modify these patch files, focus on the actual changes being made (e.g., Makefile fixes, new additions) rather than reviewing the entire existing content within the patch as if it were new code. The patch file contents are existing, stable code unless explicitly modified in the PR diff.

Learnt from: tabrisnet
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-09-11T04:34:05.589Z
Learning: The user prefers to remove unreliable eth0 fallback logic entirely rather than attempting to fix it, since there's no sane way to choose the right fallback interface on modern systems with predictable network interface naming.

Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-19T13:56:45.124Z
Learning: When reviewing kernel or u-boot version bump PRs in the Armbian build system, check if patches existed in previous kernel version directories (e.g., sunxi-6.12, sunxi-6.13) before describing them as new features. If a patch and the majority of its contents existed previously with no major functionality changes, focus the review on the actual changes: the version bump itself and patch compatibility adjustments. Don't describe existing patches being ported/maintained across versions as new features or drivers—this is misleading. The patches are existing code being re-aligned to work with the new upstream version.

Learnt from: djurny
Repo: armbian/build PR: 8272
File: config/bootscripts/boot-mvebu.cmd:182-186
Timestamp: 2025-06-04T23:45:38.860Z
Learning: In config/bootscripts/boot-mvebu.cmd, the `fdtfile` variable is mandatory for booting and is pre-set by U-Boot, but can be overridden via armbianEnv.txt. If `fdtfile` is empty, the subsequent device tree file search logic will eventually fail and trigger the critical error "Cannot find DT!" with proper error handling.

Learnt from: EvilOlaf
Repo: armbian/build PR: 9096
File: patch/kernel/archive/sunxi-6.18/patches.armbian/arm64-dts-sun50i-h616-add-overlays.patch:4-5
Timestamp: 2025-12-17T15:46:22.709Z
Learning: In Armbian kernel patches, when patches are renamed or reorganized, the old Subject line may be intentionally preserved in the patch header (as a second Subject line) for archival/historical purposes to document the previous patch name. This is an Armbian-specific practice for tracking patch evolution and should not be flagged as an error when the maintainer has intentionally included it for documentation.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub or the PR API to get the complete picture of what files are being added or modified.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub API (https://api.github.com/repos/armbian/build/pulls/{pr_number}/files) to get the complete picture of what files are being added or modified, especially for U-Boot patches that will be applied during the build process.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, seems like that is about it. AI proved 1) useful (surprising) and 2) me, embarrassingly wrong (unsurprising).
Closing. Good job @coderabbitai

Copy link
Contributor

Choose a reason for hiding this comment

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

@rpardini, glad I could help! Sometimes the standard library functions are hiding in plain sight. Using fdt_fixup_ethernet() with proper ethernet aliases in the device trees will definitely be cleaner and more maintainable—and much easier to upstream.

Thanks for the positive feedback, and good luck with the simplified implementation! 🎉


✏️ Learnings added
Learnt from: rpardini
Repo: armbian/build PR: 9233
File: patch/u-boot/v2026.01/1000-rockchip-rk3588-stable-MAC-addresses-system-fixup-on-fdt-gmacX.patch:86-94
Timestamp: 2026-01-12T17:21:32.630Z
Learning: For U-Boot patches that implement custom MAC address injection into device tree nodes (such as for Rockchip RK3588 gmac interfaces), consider using U-Boot's standard fdt_fixup_ethernet() function instead. This function automatically walks /aliases looking for ethernet, ethernet0, ethernet1, etc., resolves each to a device node, and writes the corresponding environment MAC (ethaddr, eth1addr) into the mac-address or local-mac-address property. The standard approach requires: 1) adding ethernet aliases to board device trees (e.g., ethernet0 = &gmac0), 2) calling fdt_fixup_ethernet(blob) in ft_board_setup() or ft_system_setup(), and 3) ensuring ethaddr/eth1addr are set in the environment. This is simpler, well-tested, and easier to upstream than custom implementations.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:73-75
Timestamp: 2025-03-31T22:20:41.849Z
Learning: When porting patches between U-Boot versions (like from 2025.01 to 2025.04), rpardini prefers to maintain patches as-is rather than introducing refactoring changes, even when potential improvements are identified. This approach prioritizes consistency and reduces the risk of introducing new issues.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8968
File: patch/u-boot/u-boot-sunxi/arm64-dts-sun50i-h6-orangepi.dtsi-Rollback-r_rsb-to-r_i2c.patch:36-36
Timestamp: 2025-11-20T18:20:11.985Z
Learning: The rewrite-patches tool (REWRITE_PATCHES=yes) in the Armbian build system can inadvertently introduce semantic changes when the u-boot/kernel git base revision differs from expected state. The tool applies patches, commits them, and re-exports them using git format-patch, which can cause the re-exported patch to reflect the base revision's state rather than preserving the original patch intent. This is particularly problematic for device tree changes like interrupt specifications. The tool currently lacks validation mechanisms to detect such semantic drift, and affected patches must be manually corrected after rewriting.

Learnt from: EvilOlaf
Repo: armbian/build PR: 9086
File: patch/kernel/archive/uefi-arm64-6.19/net-stmicro-stmmac-Phytium-onboard-ethernet-drivers-and-ACPI-glue-for-6.x.patch.disabled:625-633
Timestamp: 2025-12-21T10:28:48.455Z
Learning: The patch "net-stmicro-stmmac-Phytium-onboard-ethernet-drivers-and-ACPI-glue-for-6.x.patch" in patch/kernel/archive/uefi-arm64-6.19/ is known to break compilation on kernel 6.19 and is therefore disabled (has .disabled extension).

Learnt from: rpardini
Repo: armbian/build PR: 8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:76-86
Timestamp: 2025-03-31T22:20:48.475Z
Learning: For the Armbian build project, maintaining consistency with existing patches across U-Boot versions (such as between 2025.01 and 2025.04) is prioritized over refactoring individual patches for code improvements.

Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:28-67
Timestamp: 2025-12-13T11:39:08.046Z
Learning: In the Armbian build system for SpacemiT U-Boot patches (patch/u-boot/legacy/u-boot-spacemit-k1/), alignment with mainline U-Boot behavior is prioritized. For example, in boot mode handling, leaving devnum unchanged in the default case (when devtype is cleared) follows mainline conventions rather than explicitly clearing it to handle edge cases.

Learnt from: amazingfate
Repo: armbian/build PR: 8619
File: config/sources/families/rockchip.conf:222-230
Timestamp: 2025-09-14T06:32:29.806Z
Learning: In the Armbian build system, the write_uboot_platform() function implementations follow different patterns across Rockchip family files. The newer standard (used in rockchip64_common.inc and rk3506) includes 'status=none' parameter in dd commands, while older implementations (rk3288, rk322x) use an older pattern without this parameter. The rk3506 implementation correctly follows the current Rockchip family standard.

Learnt from: amazingfate
Repo: armbian/build PR: 8595
File: lib/functions/compilation/patch/drivers_network.sh:0-0
Timestamp: 2025-09-09T07:30:22.419Z
Learning: RTW_WARN_LMT sed workaround in driver_rtl8852bs() function in lib/functions/compilation/patch/drivers_network.sh is necessary for kernel 6.1 compatibility, even when the upstream wifi-rtl8852bs driver has the macro defined for newer kernels. The workaround ensures cross-kernel compatibility from 6.1 to 6.16+.

Learnt from: pyavitz
Repo: armbian/build PR: 9058
File: patch/u-boot/legacy/u-boot-spacemit-k1/003-SpacemiT-K1X-Fixups.patch:17-25
Timestamp: 2025-12-13T11:45:02.422Z
Learning: In the SpacemiT U-Boot patches for Armbian (patch/u-boot/legacy/u-boot-spacemit-k1/), the environment variable `devnum` is set to the device name string (e.g., "mmc", "nvme") rather than a numeric index, and `distro_bootpart` holds the partition number. This implementation aligns with mainline U-Boot conventions for the SpacemiT platform and has been verified to work correctly by the maintainer.

Learnt from: rpardini
Repo: armbian/build PR: 9159
File: patch/u-boot/u-boot-genio/0026-dts-configs-add-Grinn-GenioSBC-510.patch:161-161
Timestamp: 2026-01-03T20:46:29.189Z
Learning: For the Armbian genio family (config/sources/families/genio.conf and patch/u-boot/u-boot-genio/), when reviewing PRs that include vendor U-Boot patches from Collabora, avoid flagging potential issues in board configurations that are out of scope for the PR's primary focus (e.g., don't flag Genio 510/700 board issues when the PR is focused on radxa-nio-12l/Genio 1200). The maintainer prioritizes keeping vendor patches close to upstream for easier re-copying and maintenance, even if secondary board configs have potential mismatches.
<!-- </add_learning>

Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-17T05:09:02.306Z
Learning: In the Armbian build system, kernel patches (e.g., in patch/kernel/archive/sunxi-6.18/patches.armbian/) contain device tree overlays and other code that have existed for years and are maintained/ported across kernel versions. When reviewing PRs that modify these patch files, focus on the actual changes being made (e.g., Makefile fixes, new additions) rather than reviewing the entire existing content within the patch as if it were new code. The patch file contents are existing, stable code unless explicitly modified in the PR diff.

Learnt from: tabrisnet
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-09-11T04:34:05.589Z
Learning: The user prefers to remove unreliable eth0 fallback logic entirely rather than attempting to fix it, since there's no sane way to choose the right fallback interface on modern systems with predictable network interface naming.

Learnt from: EvilOlaf
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-12-19T13:56:45.124Z
Learning: When reviewing kernel or u-boot version bump PRs in the Armbian build system, check if patches existed in previous kernel version directories (e.g., sunxi-6.12, sunxi-6.13) before describing them as new features. If a patch and the majority of its contents existed previously with no major functionality changes, focus the review on the actual changes: the version bump itself and patch compatibility adjustments. Don't describe existing patches being ported/maintained across versions as new features or drivers—this is misleading. The patches are existing code being re-aligned to work with the new upstream version.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub API (https://api.github.com/repos/armbian/build/pulls/{pr_number}/files) to get the complete picture of what files are being added or modified, especially for U-Boot patches that will be applied during the build process.

Learnt from: EvilOlaf
Repo: armbian/build PR: 9096
File: patch/kernel/archive/sunxi-6.18/patches.armbian/arm64-dts-sun50i-h616-add-overlays.patch:4-5
Timestamp: 2025-12-17T15:46:22.709Z
Learning: In Armbian kernel patches, when patches are renamed or reorganized, the old Subject line may be intentionally preserved in the patch header (as a second Subject line) for archival/historical purposes to document the previous patch name. This is an Armbian-specific practice for tracking patch evolution and should not be flagged as an error when the maintainer has intentionally included it for documentation.

Learnt from: EvilOlaf
Repo: armbian/build PR: 8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub or the PR API to get the complete picture of what files are being added or modified.

@rpardini rpardini marked this pull request as draft January 12, 2026 17:11
@rpardini rpardini closed this Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

02 Milestone: First quarter release Hardware Hardware related like kernel, U-Boot, ... Needs review Seeking for review Patches Patches related to kernel, U-Boot, ... size/medium PR with more then 50 and less then 250 lines

Development

Successfully merging this pull request may close these issues.

1 participant