Skip to content

Conversation

@rpardini
Copy link
Member

@rpardini rpardini commented Jan 3, 2026

genio/radxa-nio-12l: OPTEE/u-boot/TF-A/FIP bootloader + EXT=mtkflash + fixes

  • 🌱 genio: u-boot: patches: vendor u-boot patches from Collabora (pristine)
  • 🌿 genio: u-boot: patches: ATF patches from Collabora (pristine)
  • 🍃 genio: u-boot: patches: cosmetic formatting fixes on top of Collabora
    • small hack to get around stupid "From xx" parsing in Armbian patcher
    • also: fix attribution in 0023-watchdog-mtk_wdt-Correct-maximum-timeout-from-15-to
  • 🍀 genio: u-boot: patches: rewrite Collabora patches
  • 🐸 genio: implement complete OPTEE/u-boot/TF-A (x2)/FIP build
    • genio: implemented complete bootloader build according to Collabora's scripts
      • main difference from other similar stack is that TF-A builds final FIP, not u-boot
      • thus I first disable ATF build initially, then build it in hook
      • alternatively: we could build our own FIP, but that would diverge too much
      • declare functions inside hook so hashing does all the versioning automatically
    • write_uboot_platform() is a no-op; don't write bootloader to image
    • ensure bootloader builds across bookworm/trixie/jammy/noble/resolute
      • keep in mind original code is for bookworm (tested to build and work on trixie)
      • need to juggle the -Wl, prefix on LDFLAGS
        • this is not mainline ATF and it does "stupid with flags"
    • genio: u-boot: always clean optee & first atf build before building
      • so one can switch build host with DOCKER_ARMBIAN_BASE_IMAGE (UFS...)
    • genio: u-boot: using armbian/mtkbin repo
      • outputs fip.img & lk.bin directly to output(/images)
      • disk images do not contain any bootloader
  • 🌳 genio: export (from the image) bins needed for flashing
    • so regular armbian/build users can get them in output/images
  • 🌴 radxa-nio-12l: enable build u-boot from sources
    • using family code
  • 🌵 genio: mt8195: atf: patch: add TF-A RAM size autodetection pass to bl33
    • With this, bl2 will pass down the DRAM size it gets from libdram down to bl33 (u-boot proper) via a magic location
    • This is a rework of the implementation for another MTK plat (GRINN)
  • 🌱 genio: u-boot: patch: mt8195: adjust memory size at runtime and fixup fdt
    • Use TFA + libdram to obtain and set the actual memory size.
    • Overwrite the memory size in the devicetree that is passed to the kernel with the actual size detected.
    • All credit to Bartosz Bilas' work for the mt8188/mt8370.
    • This doesn't really "use" TF-A/libdram though, those call bl33 with magic arguments which we read here.
    • That is implemented by a patch in TF-A for the mt8195 platform.
  • 🌿 genio: u-boot: patch: mt8195: boot order: SD -> UFS -> eMMC -> USB -> Network
    • this way, one doesn't need to cripple UFS to be able to boot from SD
    • USB didn't get the same treatment as it's slow and not working...
      • ...and beyond me to fix; both OTG and Host mode are funky in u-boot...
      • ...but seem to work fine in kernel
    • IMPORTANT: keep in mind: "SDcard is NOT UFS (4k block)" and don't fall for traps!
    • Network note:
      • setenv ethaddr xx:xx:xx:xx:xx:xx & saveenv & reset
      • required for network booting; mtk doesn't use random/cpu# MAC
      • required for stable MAC in kernel (keep IP from changing, etc)
  • 🍃 genio: u-boot: patch: UFS 4k UMS fixes + BTRFS fixes/enablement
    • backport fixes from upstream u-boot for
      • BTRFS (plus enable BTRFS and BZIP2 support for radxa-nio-12l)
        • tested with CARD_DEVICE=/dev/mmcblk1 ROOTFS_TYPE=btrfs BTRFS_COMPRESSION=zstd (no UFS!)
        • also with EXT=ufs CARD_DEVICE=/dev/sdc ROOTFS_TYPE=btrfs BTRFS_COMPRESSION=zstd (UFS!)
      • 4k block size UFS for UMS: fixes block size issue (USB issues unhandled)
    • Enable "bind" command for the Mediatek-standard USB Gadget Ethernet
  • 🍀 genio: u-boot: patch: fdt_addr_r/kernel_addr_r/ramdisk_addr_r for large kernels/initrds
    • this patches u-boot default addresses with the same values used in the boot-genio bootscript
    • this enables booting extlinux with large kernels and initrd (eg: EXT=u-boot-menu)
  • 🐸 radxa-nio-12l: include SRC_CMDLINE for extlinux booting; add explanations
    • set SRC_CMDLINE, used in extlinux/EXT=u-boot-menu scenarios
    • note about d4/d8/d16 irrelevance now as we have RAM autodetection
    • note about where the blobs (libdram/libbase/lk.bin) live in GH: https://github.com/armbian/mtkbin
  • 🌳 radxa-nio-12l: u-boot: fix u-boot env conflict; include userspace tooling
    • u-boot stores env in UFS LUN 1
    • use a 2mb offset (different from vendor/Collabora's) to avoid any env conflict
    • point fw_printenv/setenv at it at the correct offset and size
  • 🌴 radxa-nio-12l: u-boot: config: extra CMD options
    • CONFIG_CMD_ITEST # itest expects integers on both sides, whereas regular test assumes strings
    • CONFIG_CMD_BOOTZ # bootz allows booting zImages
    • CONFIG_CMD_MEMINFO # meminfo shows memory info in u-boot
    • CONFIG_CMD_SETEXPR # setexpr allows arithmetic expressions in setenv
  • 🌵 extensions/mtkflash: Mediatek mtk-flash direct flashing after build
    • similar to rkdevflash, but for Mediatek devices
    • also simpler; lk.bin & fip.img are produced by image build and directly used
    • requires Rust+Cargo, so add those to hostdeps
      • since this is a core extension, those will be included in all Docker images too
      • which was bound to happen anyway since Rust in Linux Kernel is no longer an experiment
    • extensions/mtkflash: sha1-based bin path, use fork & add --no-erase-boot1
    • example invocation:
      • BOARD=radxa-nio-12l BRANCH=collabora RELEASE=trixie EXT=ufs,mtkflash MTKFLASH_TTYACM_DEVICE=1
  • 🌱 genio: bootscript: boot-genio: rework addr's so can boot large initrd's
    • desktop images have half the world in their initrd (plymouth?)
    • bdinfo shows reserved regions, which are hit depending on the size of initrd
    • when reserved region is hit, u-boot says ** Reading file would overwrite reserved memory **
    • done by AI after looking at bdinfo reserved regions
    • hard lesson: all 0x hex have to be double quoted, otherwise Wrong image format for "source" command
    • add note about Meco having conjured up load_addr (it's loadaddr); doesn't hurt
    • while at it, remove copypasta/duplicate bootlogo/consoleargs stanza

Summary by CodeRabbit

  • New Features

    • Radxa NIO‑12L support (4/8/16GB variants), Grinn GenioSBC‑700 & GenioSBC‑510 support.
    • Integrated Mediatek flashing flow (automatic fetch/build/flash).
    • BTRFS and BZIP2 support enabled; USB bind command exposed; longer USB connect timeout.
    • Runtime DRAM detection with device‑tree memory fixups; updated boot device ordering.
  • Bug Fixes

    • Extended watchdog timeout, fixed ramdisk/address overlaps, improved USB ethernet error handling, multiple BTRFS robustness fixes, added MMC1 support.
  • Chores

    • Updated device trees, defconfigs, and bootloader build orchestration.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 3, 2026

📝 Walkthrough

Walkthrough

Adds Radxa NIO‑12L board config and GENIO family build orchestration: U‑Boot environment/fw_env handling, OPTEE/ATF/FIP build steps, mtk‑flash extension for flashing, many U‑Boot patches (DTs, defconfigs, USB gadget refactor, memory runtime fixups), and device‑tree additions for multiple boards.

Changes

Cohort / File(s) Summary
Radxa NIO‑12L board config
config/boards/radxa-nio-12l.conf
Adds BOOTCONFIG/BOOT_SOC/MEDIATEK_GENIO_SOC_PLATFORM/SRC_CMDLINE/PACKAGE_LIST_BOARD; updates BOOT_FDT_FILE comment; adds post_config_uboot_target__nio_12l_armbian_specific_environment_location() and post_family_tweaks__config_radxa_nio_12l_fwenv() to set CONFIG_ENV_OFFSET and emit fw_env.config.
GENIO family sources & orchestration
config/sources/families/genio.conf
Makes BOOTCONFIG overridable; introduces BOOTSOURCE/BOOTBRANCH/BOOTPATCHDIR/BOOTDIR/UBOOT_TARGET_MAP and many MEDIATEK_GENIO_* variables; adds fetch/postprocess hooks and functions to build OPTEE, ATF, and produce FIP; exports FIP/LK artifacts; adds host deps hook.
MTK flash extension
extensions/mtkflash.sh
New extension: host deps (rust/cargo), fetch/build mtk‑flash, check/version, and post_build_image_write hook that composes mtk‑flash args, prompts user and flashes device.
ATF patches (FIP & libdram)
patch/atf/atf-genio/0001-*.patch, 0002-*.patch, 2200-*.patch
Introduces STORAGE_APPEND_FIP support to place FIP in boot partition; adds libdram drivers and APIs to determine runtime DRAM size and pass via BOOT_ARGUMENT for several MTK platforms.
U‑Boot: DT, defconfigs, board support
patch/u-boot/u-boot-genio/0016-0023,0018-0020,0027-0030,3300-3306
Adds Radxa NIO‑12L DTS/DTSI variants and Grinn GenioSBC DTs; updates defconfigs (new radxa variants, mediatek DT paths), increases ENV size, enables various MTK drivers and features (MMC, ADC, PMIC, regulators), enables bind/cmds, BTRFS/BZIP2, adjusts boot addresses and ramdisk/fdt/kernel envs, and runtime memory fixups (ft_board_setup + CONFIG_OF_*).
U‑Boot: USB gadget & UDC refactor
patch/u-boot/u-boot-genio/0004-0011,0007-0011,0013-0015
Large refactor to DM-based USB gadget flow: fix CONFIG_USBNET symbol, improve usb_ether_init error handling, remove legacy non‑DM paths, factor out udc device helpers, switch to udevice-based UDC control, move to probe/remove lifecycle and update callbacks, increase USB connect timeout.
U‑Boot: UMS, btrfs, watchdog, ramdisk fixes
patch/u-boot/u-boot-genio/3303-3304,0001,0023
UMS updated for per‑LUN sector sizes and udevice fsg_init; multiple btrfs robustness fixes; ramdisk load addresses raised; watchdog max timeout extended.
Boot scripts
config/bootscripts/boot-genio.cmd
Introduces explicit U‑Boot memory layout and updates fdt_addr_r/kernel_addr_r/ramdisk_addr_r to new high addresses; adjusts bootlogo/consoleargs handling accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant Armbian as Armbian Build
    participant Fetch as Fetch Tools
    participant OPTEE as Build OPTEE
    participant ATF as Build ATF
    participant FIP as Produce FIP
    participant Export as Image Export

    Armbian->>Fetch: fetch_sources_tools__700_genio()
    Fetch->>Fetch: download OPTEE & mtkbin prebuilts
    Fetch-->>Armbian: prebuilts ready

    Armbian->>OPTEE: mediatek_genio_build_optee()
    OPTEE-->>Armbian: tee.bin

    Armbian->>ATF: mediatek_genio_build_atf()
    ATF-->>Armbian: bl2/bl31

    Armbian->>FIP: mediatek_genio_produce_fip()
    FIP-->>Armbian: fip.bin / fip.img

    Armbian->>Export: pre_umount_final_image__700_genio()
    Export-->>Armbian: exported fip.img, lk.bin
Loading
sequenceDiagram
    participant Board as U-Boot Board
    participant Probe as usb_eth_probe
    participant DM as DM Device
    participant UDC as UDC Controller
    participant Reg as usb_gadget_register_driver

    Board->>Probe: usb_eth_probe(udev)
    Probe->>DM: dev_get_priv(udev)
    DM-->>Probe: priv

    Probe->>Reg: usb_gadget_register_driver()
    Reg->>UDC: udc_device_get_by_index()
    UDC-->>Reg: udevice handle

    Board->>Probe: usb_eth_start(udev)
    Board->>Probe: usb_eth_stop(udev)
    Probe->>Reg: usb_gadget_unregister_driver()
    Reg->>UDC: udc_device_put()
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~90 minutes

Possibly related PRs

Suggested reviewers

  • HeyMeco
  • igorpecovnik

Poem

🐰
I hopped through patches, tail aflutter bright,
DTs and FIP stitched into the night,
USB and RAM, all tuned with care,
mtk‑flash ready — firmware in the air,
A carrot cake build, now flash and delight! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding OPTEE/u-boot/TF-A/FIP bootloader support and the mtkflash extension for the radxa-nio-12l board, plus related fixes.

✏️ 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/large PR with 250 lines or more 02 Milestone: First quarter release Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Framework Framework components Patches Patches related to kernel, U-Boot, ... labels Jan 3, 2026
@rpardini
Copy link
Member Author

rpardini commented Jan 3, 2026

  • very early preview so @HeyMeco and others can find my mistakes 😉
  • I still need to review u-boot patches
    • drop the ones unneeded (there's a lot for vendor kernel stuff)
    • hopefully implement RAM size detection and FDT patching for the NIO-12L (Collabora already has it for others)
    • let u-boot boot from network (boot order issue, net/dhcp already works on the onboard eth)
  • I still need to investigate a possible current branch based on LTS kernel by extracting patches from C's 6.18-rc1
  • armbian/mtkbin repo (@igorpecovnik)
    • for now one can set MTKBIN_GIT_URL="https://github.com/rpardini/armbian-mtkbin.git"

@rpardini
Copy link
Member Author

rpardini commented Jan 3, 2026

@coderabbitai review

@coderabbitai

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as outdated.

@HeyMeco
Copy link
Collaborator

HeyMeco commented Jan 3, 2026

And I thought I had spent too much time on this platform :D

I'm going to make the argument we don't need to bloat the project with all the specifics around this family and bootloaders and how it differs from all the other ones where we are not able to run boot code from at least sdcard.

I do not want to maintain this and I don't know if you want to do that either for the future. I think it makes to sense have this as a separate project to easily build custom uboot for genio like a companion project to armbian build for Genio/Nio-12L.

@rpardini
Copy link
Member Author

rpardini commented Jan 3, 2026

The reasons I did this, in order:

  1. because I can. hacking is fun. learning stuff about different platforms is fun. this was not a difficult bootchain to setup, if you compare to so many others we have. the work you already did (which is great, thanks!) was very useful, but feels half-baked without a proper bootloader build, compared to other boards.
  2. in current state, one can only access 4Gb (not 8, and not my 16Gb!) in the kernel. adding "overlays" for this is more work than included here, and also wouldn't work out of the box.
  3. in current state, u-boot can't boot from the network, despite everything required for it to work being setup.
  4. in current state, to flash an Armbian image, users have to flash the Collabora image first.
  5. in current state, uber-hacker people have to jump through hoops to flash UFS, if compared to what EXT=rkdevflash provides for Rockchip platforms, and mtk-flash is ready to go.

If you don't want to maintain this, it's your (and your users) loss. I've done it, it's here, it's fun, it works, if you can't grok it I can try and explain it.

If it comes to that, I've other 163 commits on my fork I maintain anyway, so I'll just wait for you to drop maintainership and then merge it, which is not fun for anyone.

@HeyMeco
Copy link
Collaborator

HeyMeco commented Jan 3, 2026

I hope I didn't come off wrong. I'm all for this and especially point 1. The PR description is just very cluttered and I commented my first reaction.

But about:

  1. I still need to review this PR and I think you also know about the current state of the PR as it's purposefully set to draft. When it comes to the implementation before this PR that is an issue and I haven't made the overlays yet as a workaround. It's just the way it is currently for the platform (even though other mtk's can do automatic detection + something like efi dtbfixup or selecting a different devicetree with the right ram size)
  2. I can't tell without looking into it more if that's just a config issue or something that can be fixed easily or not
  3. With https://github.com/grinn-global/mtk-flash it's "just" mtk-flash --da ./lk.bin [optional: --fip ./bootloader.img] [optional: --img ./ArmbianImage.img] --dev /DEVICE/TO/FLASH> so no need to flash any custom images first
  4. Covered in 4 - the issue is just lack of docs that goes on my cap

If it comes to that, I've other 163 commits on my fork I maintain anyway, so I'll just wait for you to drop maintainership and then merge it, which is not fun for anyone.

You and me can do better than that

@rpardini rpardini force-pushed the pr/genioradxa-nio-12l-OPTEEu-bootTF-AFIP-bootloader--EXTmtkflash--fixes branch from 719f890 to fccc84d Compare January 4, 2026 05:46
@rpardini
Copy link
Member Author

rpardini commented Jan 4, 2026

Sent v2, strictly about bootloader + EXT=mtkflash + core atf fixes for that binutils flag fiasco. A fix for ufs extension is included, though.

Other general fixes, kernel work, etc will be sent in separate pulls.

@rpardini
Copy link
Member Author

rpardini commented Jan 4, 2026

2. It's just the way it is currently for the platform

No longer. Automatic RAM autodetection was implemented, as per the existing ones. It was mostly transposing code from one mt plat to another. TF-A (bl2) reads the size from libdram, passes that to bl33 (u-boot proper), which takes that during early dram_init() for its own use, then in board.c patches the kernel DT with the correct size. Everyone's happy.

3. I can't tell without looking into it more if that's just a config issue or something that can be fixed easily or not

I can tell.

4. so no need to flash any custom images first

One still needed to flash "some" Collabora stuff (namely, fip.img, exactly the objective of this PR). No longer.

6. the issue is just lack of docs that goes on my cap

Here's new docs for nerds: ./compile.sh BOARD=radxa-nio-12l BRANCH=collabora RELEASE=trixie EXT=ufs,mtkflash MTKFLASH_TTYACM_DEVICE=1 + "adapt TTYACM=x to your case" + "build on Linux sans-Docker"

@rpardini rpardini force-pushed the pr/genioradxa-nio-12l-OPTEEu-bootTF-AFIP-bootloader--EXTmtkflash--fixes branch from fccc84d to 91f2a69 Compare January 4, 2026 19:45
@rpardini
Copy link
Member Author

rpardini commented Jan 4, 2026

v3. More enhancements.

  • 🥳 BTRFS support (backported fixes from mainline u-boot)
  • 🎉 Boot from SD first (u-boot still always loaded from UFS, of course), so can easily switch UFS/SD
  • 🥇 Separate u-boot env and support for fw_printenv/setenv from userspace

Split off a few commits into separate PRs (both are needed for this to work):


  • 🥱 Plug for EXT=mtkflash
image

@rpardini rpardini force-pushed the pr/genioradxa-nio-12l-OPTEEu-bootTF-AFIP-bootloader--EXTmtkflash--fixes branch from 91f2a69 to c8e5bef Compare January 5, 2026 18:51
@rpardini
Copy link
Member Author

rpardini commented Jan 5, 2026

Sent v4. Ready.

@rpardini rpardini marked this pull request as ready for review January 5, 2026 18:55
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: 2

Fix all issues with AI Agents 🤖
In
@patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch:
- Around line 66-83: The libdram module is incomplete: implement
platform_memory_size() or point the build at a prebuilt library and fix rules.mk
to reference actual sources; either add a C source (e.g., dram_size.c) that
defines uint64_t platform_memory_size(void) and any helpers, then set
LOCAL_SRCS-y in plat/mediatek/mt8195/drivers/libdram/rules.mk to list that file
and ensure PLAT_INCLUDES covers the header, or if using a vendor prebuilt,
remove/replace LOCAL_SRCS-y usage and configure the module to link the prebuilt
(e.g., add a LOCAL_PREBUILT_LIBS/LOCAL_MODULE_SUFFIX or equivalent so
MAKE_MODULE links the vendor libdram) and ensure the header declaring
platform_memory_size() is installed for consumers.

In
@patch/u-boot/u-boot-genio/3306-GENIO-mt8195-fdt_addr_r-kernel_addr_r-ramdisk_addr_r-for-large-kernels-initrds.patch:
- Around line 22-32: The patch sets kernel_addr_r=0x40000000 which conflicts
with scriptaddr; change kernel_addr_r to a non-overlapping address (e.g.,
0x42000000) so kernel load region does not overlap boot script memory, and
update both occurrences of "kernel_addr_r" in the diff (and any related
documentation/comments) to the new value; alternatively, if you prefer to keep
kernel_addr_r, move scriptaddr instead—ensure whichever symbol (kernel_addr_r or
scriptaddr) is changed is updated consistently across the file and any places
that assume the address.
♻️ Duplicate comments (1)
patch/atf/atf-genio/0002-plat-mediatek-use-libdram-to-pass-actual-memory-size.patch (1)

63-81: Missing libdram source files (already flagged).

This issue was identified in a previous review. The rules.mk references $(LOCAL_SRCS-y) but it's never defined, so platform_memory_size() has no implementation.

🧹 Nitpick comments (4)
config/boards/radxa-nio-12l.conf (1)

37-44: Heredoc comment won't expand variables.

The comment on line 38 references ${BOARD_NAME} but won't be expanded since the heredoc uses single quotes ('FW_ENV_CONFIG'). This is cosmetic-only and doesn't affect functionality, but could be confusing when reading the generated file.

🔎 Optional fix to expand the board name in comment
-	cat <<- 'FW_ENV_CONFIG' > "${SDCARD}"/etc/fw_env.config
-		# UFS LUN 2 (scsi 1 in u-boot) u-boot env for the ${BOARD_NAME}
+	cat <<- FW_ENV_CONFIG > "${SDCARD}"/etc/fw_env.config
+		# UFS LUN 2 (scsi 1 in u-boot) u-boot env for the ${BOARD_NAME}

Note: If you switch to unquoted heredoc, ensure no other content needs literal $ characters.

extensions/mtkflash.sh (3)

15-18: LGTM - Host dependencies properly declared.

The function correctly adds Rust toolchain and build-essential dependencies. The TODO comment about converting to array is acknowledged for future refactoring.

Would you like me to open an issue to track the array conversion refactor, or is this already planned?


110-115: Consider explicit error handling for the flashing command.

The direct execution of mtk-flash (line 114) bypasses the logging wrapper, which is appropriate for an interactive tool. However, consider adding an explicit check after execution for clearer error reporting:

🔎 Proposed improvement for error handling
 # finally run mtk-flash with the accumulated arguments
-"${mtkflash_bin_path}" "${mtkflash_cmd_args[@]}"
+"${mtkflash_bin_path}" "${mtkflash_cmd_args[@]}" || {
+	exit_with_error "mtk-flash command failed. Please check the device connection and try again."
+}

134-145: Consider explicit error handling for version command.

The version check (line 136) relies on set -e for error handling. While functional, explicit error handling would provide clearer feedback:

🔎 Proposed improvement for version check
 function check_mtkflash() {
 	declare mtkflash_version="undetermined"
-	mtkflash_version="$("${mtkflash_bin_path}" --version)"
+	mtkflash_version="$("${mtkflash_bin_path}" --version)" || exit_with_error "Failed to determine mtk-flash version"
 	display_alert "mtkflash version" "${EXTENSION} :: '${mtkflash_version}'" ""

The sudo usage for symlink creation (line 144) is acceptable with || true protection. Note that sudo may prompt for a password in some environments.

Comment on lines +66 to +83
diff --git a/plat/mediatek/mt8195/drivers/libdram/rules.mk b/plat/mediatek/mt8195/drivers/libdram/rules.mk
new file mode 100644
index 000000000..38f23c3dd
--- /dev/null
+++ b/plat/mediatek/mt8195/drivers/libdram/rules.mk
@@ -0,0 +1,12 @@
+#
+# Copyright (c) 2025, Grinn sp. z o.o. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+LOCAL_DIR := $(call GET_LOCAL_DIR)
+
+MODULE := libdram
+
+PLAT_INCLUDES += -I${LOCAL_DIR}/
+$(eval $(call MAKE_MODULE,$(MODULE),$(LOCAL_SRCS-y),$(MTK_BL)))
Copy link
Contributor

@coderabbitai coderabbitai bot Jan 5, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if there's a prebuilt libdram library or implementation in the ATF tree
echo "=== Searching for libdram files ==="
fd -t f 'libdram' 2>/dev/null | head -20
echo ""

echo "=== Searching for platform_memory_size implementation ==="
rg -n 'platform_memory_size' --type c --type asm 2>/dev/null || echo "No implementation found"
echo ""

echo "=== Searching for LOCAL_SRCS-y definitions ==="
rg -n 'LOCAL_SRCS-y' 2>/dev/null | head -20
echo ""

echo "=== Checking the rules.mk for MT8188 (patch 0002) for comparison ==="
fd -t f 'rules.mk' -p '*mt8188*' 2>/dev/null | head -5

Repository: armbian/build

Length of output: 799


🏁 Script executed:

#!/bin/bash
# Find the MT8195 patch file and examine its content more carefully
echo "=== Locating the patch file ==="
fd -t f '2200-plat-mediatek-mt8195-use-libdram' 2>/dev/null

echo ""
echo "=== Extracting rules.mk diff section ==="
fd -t f '2200-plat-mediatek-mt8195-use-libdram' -x cat {} \; 2>/dev/null | head -100

Repository: armbian/build

Length of output: 3751


🏁 Script executed:

#!/bin/bash
# Look for how MAKE_MODULE is used elsewhere
echo "=== Searching for MAKE_MODULE patterns with empty LOCAL_SRCS ==="
rg -B 5 'MAKE_MODULE' --type makefile 2>/dev/null | head -40
echo ""

echo "=== Check for vendor or prebuilt libdram ==="
fd -t d 'libdram' 2>/dev/null

Repository: armbian/build

Length of output: 167


🏁 Script executed:

#!/bin/bash
# Extract the full patch content for MT8195 2200 to see all changes
echo "=== Full MT8195 patch content ==="
cat patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch | tail -50

echo ""
echo "=== Checking MT8188 patch (0002) for comparison ==="
cat patch/atf/atf-genio/0002-plat-mediatek-use-libdram-to-pass-actual-memory-size.patch | head -150

Repository: armbian/build

Length of output: 5352


🏁 Script executed:

#!/bin/bash
# Look for platform.mk changes in both patches to see how LOCAL_SRCS-y is handled
echo "=== Search for LOCAL_SRCS or PLAT in platform.mk changes in MT8195 patch ==="
grep -A 10 -B 5 'platform.mk' patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch

echo ""
echo "=== Search for LOCAL_SRCS or PLAT in platform.mk changes in MT8188 patch ==="
grep -A 10 -B 5 'platform.mk' patch/atf/atf-genio/0002-plat-mediatek-use-libdram-to-pass-actual-memory-size.patch

Repository: armbian/build

Length of output: 1564


🏁 Script executed:

#!/bin/bash
# Check what's actually in the atf-genio patches directory to understand the build context
echo "=== List all files in atf-genio patch directory ==="
ls -la patch/atf/atf-genio/ | head -20

echo ""
echo "=== Check if there are any other libdram or mt8195 related patches ==="
ls -la patch/atf/atf-genio/*mt8195* 2>/dev/null || echo "No other mt8195 patches"
ls -la patch/atf/atf-genio/*libdram* 2>/dev/null || echo "No other libdram patches"

Repository: armbian/build

Length of output: 1081


Incomplete libdram module—missing implementation of platform_memory_size().

The patch creates the libdram header and build rules but provides no implementation for platform_memory_size(). The rules.mk references $(LOCAL_SRCS-y) without defining it, and no source files (.c or .S) implementing the function are included. The module cannot be built without either source files implementing the function or a prebuilt vendor library.

Either add source files for platform_memory_size() implementation or explicitly configure the build rules to link against a prebuilt libdram library.

🤖 Prompt for AI Agents
In
@patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
around lines 66-83, The libdram module is incomplete: implement
platform_memory_size() or point the build at a prebuilt library and fix rules.mk
to reference actual sources; either add a C source (e.g., dram_size.c) that
defines uint64_t platform_memory_size(void) and any helpers, then set
LOCAL_SRCS-y in plat/mediatek/mt8195/drivers/libdram/rules.mk to list that file
and ensure PLAT_INCLUDES covers the header, or if using a vendor prebuilt,
remove/replace LOCAL_SRCS-y usage and configure the module to link the prebuilt
(e.g., add a LOCAL_PREBUILT_LIBS/LOCAL_MODULE_SUFFIX or equivalent so
MAKE_MODULE links the vendor libdram) and ensure the header declaring
platform_memory_size() is installed for consumers.

Copy link
Member Author

Choose a reason for hiding this comment

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

You absolutely miss the point about what libdram is or where it comes from. It's the crux of the biscuit for Mediatek. Go home.

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

🏁 Script executed:

#!/bin/bash
# Search for any references to libdram in the genio family configuration and build system
echo "=== Searching for libdram references in genio family ==="
rg -i 'libdram' config/sources/families/genio.conf 2>/dev/null || echo "No matches in genio.conf"
echo ""

echo "=== Check for OPTEE or vendor prebuilt references ==="
rg -i 'OPTEE.*PLAT|MEDIATEK.*PLAT' config/sources/families/genio.conf 2>/dev/null | head -20
echo ""

echo "=== Search for platform.mk or libdram in ATF vendor sources context ==="
rg -i 'dramk|libdram' patch/atf/atf-genio/ 2>/dev/null | head -30
echo ""

echo "=== Check MT8188 patch for similar pattern ==="
grep -A 5 'libdram' patch/atf/atf-genio/0002-plat-mediatek-use-libdram-to-pass-actual-memory-size.patch | head -30

Length of output: 7181


@rpardini, I apologize—you're absolutely right. I completely misunderstood the architecture here.

After searching the codebase, I now see that libdram is a Mediatek vendor prebuilt library fetched from the armbian/mtkbin repository during the build process. The genio.conf clearly shows:

# uses 2 prebuilts: libbase-prebuilt and libdram-prebuilt straight from git
# Fetch armbian/mtkbin for libdram, libbase, and lk.bin

The build system fetches libdram.a and passes it to ATF via LIBDRAM=${libdram_prebuilt_bin}. The platform_memory_size() implementation exists inside that vendor prebuilt, not in the patch.

Your patch is correctly creating the interface layer (header + rules.mk) that allows ATF to link against the vendor prebuilt. This is the standard pattern for Mediatek vendor components in the boot flow.

I apologize for the noise and incorrect analysis. The patch is fine as-is.

🐰


🧠 Learnings used
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: djurny
Repo: armbian/build PR: 8166
File: config/bootscripts/boot-mvebu.cmd:38-50
Timestamp: 2025-05-07T20:49:40.969Z
Learning: The 4KB (0x1000) boundary used for device tree size calculations in U-Boot scripts is specific to how the `fdt resize` command works internally and should remain hardcoded rather than being tied to adjustable alignment variables.

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: 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: djurny
Repo: armbian/build PR: 8287
File: config/bootscripts/boot-sunxi.cmd:38-44
Timestamp: 2025-06-12T21:14:36.024Z
Learning: In config/bootscripts/boot-sunxi.cmd the unconditional "+1" increment in func_align_addr_next (when align_overlap_oboe_avoidance="on") is intentional. It compensates for a known off-by-one error in U-Boot where the end address is calculated as start+size instead of start+size-1, so the extra page prevents overlap. This behavior should not be “optimized away”.

Learnt from: bryanbrattlof
Repo: armbian/build PR: 9081
File: config/boards/sk-am62-sip.conf:18-20
Timestamp: 2025-12-15T23:26:40.214Z
Learning: For TI K3 SoC boards with only 512MB of DDR (like SK-AM62-SIP), OP-TEE (BL32) and TFA must be placed at the bottom of DDR (e.g., BL32_BASE=0x80080000, CFG_TZDRAM_START=0x80080000) rather than the standard high-memory layout. This is necessary because U-Boot relocates itself to the highest DDR address (up to 2GB max) during bootup, which would overwrite OP-TEE/TFA if they were placed at the top of the 512MB DDR region. PRELOADED_BL33_BASE is typically set to 0x82000000 in this configuration.

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.

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:24.423Z
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: 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: 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: 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:65-72
Timestamp: 2025-09-14T11:37:35.089Z
Learning: In the Armbian build system, patch directories referenced in BOOTPATCHDIR and KERNELPATCHDIR configurations can be non-existent without causing build failures. Empty patch directories are also ignored by git, so missing patch directories should not be flagged as errors during code review.

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.

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: 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.

Copy link
Member Author

Choose a reason for hiding this comment

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

🫡

Copy link
Contributor

Choose a reason for hiding this comment

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

@rpardini, thank you for the correction and your patience! I appreciate you setting me straight on the Mediatek vendor prebuilt architecture. 🫡

(/ᐠ。ꞈ。ᐟ)


🧠 Learnings used
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: djurny
Repo: armbian/build PR: 8166
File: config/bootscripts/boot-mvebu.cmd:38-50
Timestamp: 2025-05-07T20:49:40.969Z
Learning: The 4KB (0x1000) boundary used for device tree size calculations in U-Boot scripts is specific to how the `fdt resize` command works internally and should remain hardcoded rather than being tied to adjustable alignment variables.

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: 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: djurny
Repo: armbian/build PR: 8287
File: config/bootscripts/boot-sunxi.cmd:38-44
Timestamp: 2025-06-12T21:14:36.024Z
Learning: In config/bootscripts/boot-sunxi.cmd the unconditional "+1" increment in func_align_addr_next (when align_overlap_oboe_avoidance="on") is intentional. It compensates for a known off-by-one error in U-Boot where the end address is calculated as start+size instead of start+size-1, so the extra page prevents overlap. This behavior should not be “optimized away”.

Learnt from: bryanbrattlof
Repo: armbian/build PR: 9081
File: config/boards/sk-am62-sip.conf:18-20
Timestamp: 2025-12-15T23:26:40.214Z
Learning: For TI K3 SoC boards with only 512MB of DDR (like SK-AM62-SIP), OP-TEE (BL32) and TFA must be placed at the bottom of DDR (e.g., BL32_BASE=0x80080000, CFG_TZDRAM_START=0x80080000) rather than the standard high-memory layout. This is necessary because U-Boot relocates itself to the highest DDR address (up to 2GB max) during bootup, which would overwrite OP-TEE/TFA if they were placed at the top of the 512MB DDR region. PRELOADED_BL33_BASE is typically set to 0x82000000 in this configuration.

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:24.423Z
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: 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: 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: 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: 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: 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.

@rpardini
Copy link
Member Author

rpardini commented Jan 5, 2026

Good to note, these 2 PR's are meant to be tested together:

Also part of my Genio effort:

All the patches I've added are Signed-off-by and I intend to send all of them to Collabora, but are ripe for picking before I do so.

- from https://gitlab.collabora.com/mediatek/aiot/boot/-/tree/main/patches/u-boot at 2db9a7b3f8c9c2141af6a01dd9372dbba809cf95
- I can see atleast one is a bit malformed so commit separately
- small hack to get around stupid "From xx" parsing in Armbian patcher
- also: fix attribution in `0023-watchdog-mtk_wdt-Correct-maximum-timeout-from-15-to`
- genio: implemented complete bootloader build according to Collabora's scripts
  - main difference from other similar stack is that TF-A builds final FIP, not u-boot
  - thus I first disable ATF build initially, then build it in hook
  - alternatively: we could build our own FIP, but that would diverge too much
  - declare functions inside hook so hashing does all the versioning automatically
- write_uboot_platform() is a no-op; don't write bootloader to image
- ensure bootloader _builds_ across bookworm/trixie/jammy/noble/resolute
  - keep in mind original code is for bookworm (tested to build and work on trixie)
  - need to juggle the `-Wl,` prefix on LDFLAGS
    - this is not mainline ATF and it does "stupid with flags"
- genio: u-boot: always clean optee & first atf build before building
  - so one can switch build host with `DOCKER_ARMBIAN_BASE_IMAGE` (UFS...)
- genio: u-boot: using `armbian/mtkbin` repo
  - outputs fip.img & lk.bin directly to output(/images)
  - disk images do _not_ contain any bootloader
- so regular armbian/build users can get them in `output/images`
- With this, bl2 will pass down the DRAM size it gets from libdram
  down to bl33 (u-boot proper) via a magic location
- This is a rework of the implementation for another MTK plat (GRINN)
… fdt

- Use TFA + libdram to obtain and set the actual memory size.
- Overwrite the memory size in the devicetree that is passed to the kernel with the actual size detected.
- All credit to Bartosz Bilas' work for the mt8188/mt8370.
- This doesn't really "use" TF-A/libdram though, those call bl33 with magic arguments which we read here.
- That is implemented by a patch in TF-A for the mt8195 platform.
… Network

- this way, one doesn't need to cripple UFS to be able to boot from SD
- USB didn't get the same treatment as it's slow and **not working**...
  - ...and beyond me to fix; both OTG and Host mode are funky in u-boot...
  - ...but seem to work fine in kernel
- IMPORTANT: keep in mind: "SDcard is NOT UFS (4k block)" and don't fall for traps!
- Network note:
    - `setenv ethaddr xx:xx:xx:xx:xx:xx` & `saveenv` & `reset`
    - required for network booting; mtk doesn't use random/cpu# MAC
    - required for stable MAC in kernel (keep IP from changing, etc)
- backport fixes from upstream u-boot for
  - BTRFS (plus enable BTRFS and BZIP2 support for radxa-nio-12l)
    - tested with `CARD_DEVICE=/dev/mmcblk1 ROOTFS_TYPE=btrfs BTRFS_COMPRESSION=zstd` (no UFS!)
    - also with `EXT=ufs CARD_DEVICE=/dev/sdc ROOTFS_TYPE=btrfs BTRFS_COMPRESSION=zstd` (UFS!)
  - 4k block size UFS for UMS: fixes block size issue (USB issues unhandled)
- Enable "bind" command for the Mediatek-standard USB Gadget Ethernet
…ge kernels/initrds

- this patches u-boot default addresses with the same values used in the boot-genio bootscript
- this enables booting extlinux with large kernels and initrd (eg: `EXT=u-boot-menu`)
…ions

- set SRC_CMDLINE, used in extlinux/EXT=u-boot-menu scenarios
- note about d4/d8/d16 irrelevance now as we have RAM autodetection
- note about where the blobs (libdram/libbase/lk.bin) live in GH: https://github.com/armbian/mtkbin
…ling

- u-boot stores env in UFS LUN 1
- use a 2mb offset (different from vendor/Collabora's) to avoid any env conflict
- point fw_printenv/setenv at it at the correct offset and size
- `CONFIG_CMD_ITEST`   # itest expects integers on both sides, whereas regular test assumes strings
- `CONFIG_CMD_BOOTZ`   # bootz allows booting zImages
- `CONFIG_CMD_MEMINFO` # meminfo shows memory info in u-boot
- `CONFIG_CMD_SETEXPR` # setexpr allows arithmetic expressions in setenv
- similar to `rkdevflash`, but for Mediatek devices
- also simpler; lk.bin & fip.img are produced by image build and directly used
- requires Rust+Cargo, so add those to hostdeps
  - since this is a core extension, those will be included in all Docker images too
  - which was bound to happen anyway since Rust in Linux Kernel is no longer an experiment
- extensions/mtkflash: sha1-based bin path, use fork & add `--no-erase-boot1`
- example invocation:
  - `BOARD=radxa-nio-12l BRANCH=collabora RELEASE=trixie EXT=ufs,mtkflash MTKFLASH_TTYACM_DEVICE=1`
- desktop images have half the world in their initrd (plymouth?)
- `bdinfo` shows reserved regions, which are hit depending on the size of initrd
- when reserved region is hit, u-boot says `** Reading file would overwrite reserved memory **`
- done by AI after looking at `bdinfo` reserved regions
- hard lesson: all `0x` hex have to be double quoted, otherwise `Wrong image format for "source" command`
- add note about Meco having conjured up `load_addr` (it's `loadaddr`); doesn't hurt
- while at it, remove copypasta/duplicate bootlogo/consoleargs stanza
@rpardini rpardini force-pushed the pr/genioradxa-nio-12l-OPTEEu-bootTF-AFIP-bootloader--EXTmtkflash--fixes branch from c8e5bef to 58b4633 Compare January 7, 2026 15:38
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

🧹 Nitpick comments (2)
extensions/mtkflash.sh (2)

49-115: Interactive execution approach is reasonable, but consider error propagation.

The comment on lines 49-50 explains why run_host_command_logged isn't used for the final flash command. However, executing mtk-flash directly at line 114 without any error handling means failures will propagate via set -e. This is likely the intended behavior, but a brief comment at line 114 would clarify this is intentional and that failure aborts the build.

The device path handling (lines 70-81) and pre-existence warning (lines 99-108) are good UX considerations.

📝 Optional: Add clarifying comment
 	# finally run mtk-flash with the accumulated arguments
+	# Note: running directly (not via run_host_command_logged) for interactivity; failure will abort via set -e
 	"${mtkflash_bin_path}" "${mtkflash_cmd_args[@]}"

134-145: Minor: Redundant file existence check before rm -f.

Line 141 checks if [[ -f /usr/local/bin/mtk-flash ]] before calling rm -f, but rm -f already silently ignores non-existent files. The check can be simplified.

♻️ Optional: Simplify symlink replacement
 function check_mtkflash() {
 	declare mtkflash_version="undetermined"
 	mtkflash_version="$("${mtkflash_bin_path}" --version)"
 	display_alert "mtkflash version" "${EXTENSION} :: '${mtkflash_version}'" ""
 
 	# as a courtesy to the user, install a symlink into /usr/local/bin, so mtk-flash can be called by itself as well
 	# either way never fail due to this
-	if [[ -f /usr/local/bin/mtk-flash ]]; then
-		run_host_command_logged rm -f /usr/local/bin/mtk-flash || true
-	fi
-	run_host_command_logged sudo ln -sf "${mtkflash_bin_path}" /usr/local/bin/mtk-flash || true
+	run_host_command_logged sudo ln -sf "${mtkflash_bin_path}" /usr/local/bin/mtk-flash || true
 }

The ln -sf command will overwrite existing symlinks/files, making the explicit rm -f unnecessary.

📜 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 c8e5bef and 58b4633.

📒 Files selected for processing (7)
  • config/boards/radxa-nio-12l.conf
  • config/bootscripts/boot-genio.cmd
  • config/sources/families/genio.conf
  • extensions/mtkflash.sh
  • patch/atf/atf-genio/0001-plat-mediatek-mt8188-8195-8365-Support-FIP-image-on-.patch
  • patch/atf/atf-genio/0002-plat-mediatek-use-libdram-to-pass-actual-memory-size.patch
  • patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
🚧 Files skipped from review as they are similar to previous changes (1)
  • patch/atf/atf-genio/0002-plat-mediatek-use-libdram-to-pass-actual-memory-size.patch
🧰 Additional context used
🧠 Learnings (62)
📓 Common learnings
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: 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: 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: 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: 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: igorpecovnik
Repo: armbian/build PR: 9087
File: .github/workflows/pr-check-pictures.yml:138-146
Timestamp: 2025-12-16T13:40:07.649Z
Learning: In the Armbian build repository, when introducing new requirements or checks (like the board assets verification workflow), the project prefers an initial educational-only period where violations post helpful PR comments and warnings but don't block merges. This allows contributors to become familiar with new requirements before enforcement is enabled (typically after ~6 months).
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: 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: 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: 8619
File: config/sources/families/rockchip.conf:64-70
Timestamp: 2025-09-14T06:29:18.958Z
Learning: In the Armbian build system, vendor branch configurations in family files are designed to be shared across multiple SoCs within the same family that use the same vendor kernel tree. For example, rk35xx and rockchip-rk3588 families both use identical vendor branch settings (same KERNELSOURCE, KERNELBRANCH, and KERNELPATCHDIR), demonstrating that vendor branches are intentionally generic rather than SoC-specific.
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: 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.
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.
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-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/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
  • patch/atf/atf-genio/0001-plat-mediatek-mt8188-8195-8365-Support-FIP-image-on-.patch
  • config/sources/families/genio.conf
📚 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:

  • patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
  • config/boards/radxa-nio-12l.conf
  • config/bootscripts/boot-genio.cmd
  • patch/atf/atf-genio/0001-plat-mediatek-mt8188-8195-8365-Support-FIP-image-on-.patch
  • config/sources/families/genio.conf
📚 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:

  • patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
  • config/boards/radxa-nio-12l.conf
  • config/bootscripts/boot-genio.cmd
  • patch/atf/atf-genio/0001-plat-mediatek-mt8188-8195-8365-Support-FIP-image-on-.patch
📚 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:

  • patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
  • config/boards/radxa-nio-12l.conf
  • config/bootscripts/boot-genio.cmd
  • patch/atf/atf-genio/0001-plat-mediatek-mt8188-8195-8365-Support-FIP-image-on-.patch
  • config/sources/families/genio.conf
📚 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:

  • patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
  • config/bootscripts/boot-genio.cmd
📚 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/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
  • config/bootscripts/boot-genio.cmd
  • patch/atf/atf-genio/0001-plat-mediatek-mt8188-8195-8365-Support-FIP-image-on-.patch
  • config/sources/families/genio.conf
📚 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/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
  • patch/atf/atf-genio/0001-plat-mediatek-mt8188-8195-8365-Support-FIP-image-on-.patch
  • config/sources/families/genio.conf
📚 Learning: 2025-09-14T11:37:35.089Z
Learnt from: amazingfate
Repo: armbian/build PR: 8619
File: config/sources/families/rockchip.conf:65-72
Timestamp: 2025-09-14T11:37:35.089Z
Learning: In the Armbian build system, patch directories referenced in BOOTPATCHDIR and KERNELPATCHDIR configurations can be non-existent without causing build failures. Empty patch directories are also ignored by git, so missing patch directories should not be flagged as errors during code review.

Applied to files:

  • patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.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/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.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/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
  • config/sources/families/genio.conf
📚 Learning: 2025-12-17T15:46:22.709Z
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.

Applied to files:

  • patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
  • config/sources/families/genio.conf
📚 Learning: 2025-06-12T21:14:36.024Z
Learnt from: djurny
Repo: armbian/build PR: 8287
File: config/bootscripts/boot-sunxi.cmd:38-44
Timestamp: 2025-06-12T21:14:36.024Z
Learning: In config/bootscripts/boot-sunxi.cmd the unconditional "+1" increment in func_align_addr_next (when align_overlap_oboe_avoidance="on") is intentional. It compensates for a known off-by-one error in U-Boot where the end address is calculated as start+size instead of start+size-1, so the extra page prevents overlap. This behavior should not be “optimized away”.

Applied to files:

  • patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
  • config/bootscripts/boot-genio.cmd
📚 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:

  • patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
  • config/sources/families/genio.conf
📚 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 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.

Applied to files:

  • patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
  • config/sources/families/genio.conf
📚 Learning: 2025-11-06T15:36:04.682Z
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.

Applied to files:

  • patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
📚 Learning: 2025-12-16T13:40:07.649Z
Learnt from: igorpecovnik
Repo: armbian/build PR: 9087
File: .github/workflows/pr-check-pictures.yml:138-146
Timestamp: 2025-12-16T13:40:07.649Z
Learning: In the Armbian build repository, when introducing new requirements or checks (like the board assets verification workflow), the project prefers an initial educational-only period where violations post helpful PR comments and warnings but don't block merges. This allows contributors to become familiar with new requirements before enforcement is enabled (typically after ~6 months).

Applied to files:

  • patch/atf/atf-genio/2200-plat-mediatek-mt8195-use-libdram-to-pass-actual-memory-size-to-U-Boot.patch
  • config/sources/families/genio.conf
📚 Learning: 2025-04-28T08:27:26.890Z
Learnt from: leggewie
Repo: armbian/build PR: 8133
File: extensions/apa.sh:1-2
Timestamp: 2025-04-28T08:27:26.890Z
Learning: In the Armbian build system, extension scripts in the `extensions/` directory contain hook functions and are meant to be sourced, not executed directly. These scripts don't require a shebang or `set -euo pipefail`.

Applied to files:

  • extensions/mtkflash.sh
📚 Learning: 2025-06-14T05:53:10.627Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8298
File: extensions/https_proxy.sh:1-9
Timestamp: 2025-06-14T05:53:10.627Z
Learning: In Armbian build framework, extensions are loaded and executed via lib/functions/general/extensions.sh using call_extension_method. The framework sets set -o errexit and set -o errtrace globally, and individual commands run with pipefail protection through the command execution functions.

Applied to files:

  • extensions/mtkflash.sh
📚 Learning: 2025-12-18T23:40:55.905Z
Learnt from: rpardini
Repo: armbian/build PR: 9101
File: lib/functions/image/compress-checksum.sh:44-48
Timestamp: 2025-12-18T23:40:55.905Z
Learning: In the Armbian build framework, host dependencies are strictly controlled, ensuring that specific tools like `zstdmt` are guaranteed to be available in the build environment.

Applied to files:

  • extensions/mtkflash.sh
  • config/sources/families/genio.conf
📚 Learning: 2025-06-14T05:53:10.627Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8298
File: extensions/https_proxy.sh:1-9
Timestamp: 2025-06-14T05:53:10.627Z
Learning: Armbian build framework extensions are NOT designed to run standalone but are called by the supervisor. The framework provides environment variables like USERPATCHES_PATH and SDCARD, and commands are executed with protection via run_host_command_logged and chroot_sdcard functions that use bash -e -o pipefail.

Applied to files:

  • extensions/mtkflash.sh
📚 Learning: 2025-06-22T00:45:26.182Z
Learnt from: djurny
Repo: armbian/build PR: 8315
File: lib/functions/rootfs/distro-agnostic.sh:54-68
Timestamp: 2025-06-22T00:45:26.182Z
Learning: In Armbian build system, external command dependencies like envsubst are handled by adding the required packages (e.g., gettext for envsubst) to host_dependencies in adaptative_prepare_host_dependencies function in lib/functions/host/prepare-host.sh, rather than checking command availability at runtime.

Applied to files:

  • extensions/mtkflash.sh
  • config/sources/families/genio.conf
📚 Learning: 2025-07-23T10:01:41.310Z
Learnt from: amazingfate
Repo: armbian/build PR: 8419
File: lib/functions/host/prepare-host.sh:272-275
Timestamp: 2025-07-23T10:01:41.310Z
Learning: In the Armbian build system, the design philosophy is to fail fast when host dependencies are not met rather than gracefully skipping unsupported architectures. This ensures build environment consistency and prevents silent failures. Host dependency checks should be explicit and non-negotiable.

Applied to files:

  • extensions/mtkflash.sh
  • config/sources/families/genio.conf
📚 Learning: 2025-09-14T05:23:42.991Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8632
File: config/sources/families/include/rockchip64_common.inc:327-334
Timestamp: 2025-09-14T05:23:42.991Z
Learning: In the Armbian build system for Rockchip boards, SPI flash consistently maps to /dev/mtd0, so hard-coding this device path in flashcp commands is acceptable and based on hardware conventions rather than being a bug.

Applied to files:

  • extensions/mtkflash.sh
📚 Learning: 2025-12-18T23:40:41.627Z
Learnt from: rpardini
Repo: armbian/build PR: 9101
File: lib/functions/image/compress-checksum.sh:44-48
Timestamp: 2025-12-18T23:40:41.627Z
Learning: In the Armbian build framework, scripts run with set -e, so a non-zero exit status will abort the script. During reviews, assume failures will stop execution unless explicitly handled. Verify that commands that must fail are checked, errors are propagated, and any critical steps have proper error handling (e.g., using pipefail where appropriate, checking exit codes, and not masking failures).

Applied to files:

  • extensions/mtkflash.sh
📚 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/radxa-nio-12l.conf
  • config/sources/families/genio.conf
📚 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/radxa-nio-12l.conf
📚 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/radxa-nio-12l.conf
  • config/bootscripts/boot-genio.cmd
📚 Learning: 2025-08-30T04:13:16.457Z
Learnt from: tabrisnet
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-08-30T04:13:16.457Z
Learning: Armbian kernel configuration files like linux-filogic-current.config are autogenerated overlays on top of arch defconfig. Comments added manually will be lost during future updates by maintainers, and explicit "CONFIG_OPTION is not set" statements aren't needed for mutually exclusive options since these are overlay configs that only specify changes from the base configuration.

Applied to files:

  • config/boards/radxa-nio-12l.conf
  • config/sources/families/genio.conf
📚 Learning: 2025-09-12T21:44:09.061Z
Learnt from: Grippy98
Repo: armbian/build PR: 8624
File: config/boards/sk-am62p.conf:8-8
Timestamp: 2025-09-12T21:44:09.061Z
Learning: For TI K3 family boards in Armbian, BOOT_FDT_FILE uses .dts extension (not .dtb) as the standard convention. The build system handles this correctly by automatically compiling .dts to .dtb during kernel build and using the BOOT_FDT_FILE value directly in bootloader configurations.

Applied to files:

  • config/boards/radxa-nio-12l.conf
📚 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/radxa-nio-12l.conf
  • config/bootscripts/boot-genio.cmd
  • config/sources/families/genio.conf
📚 Learning: 2025-07-17T04:12:33.125Z
Learnt from: pyavitz
Repo: armbian/build PR: 8388
File: config/boards/kickpik2b.conf:1-14
Timestamp: 2025-07-17T04:12:33.125Z
Learning: In the Armbian build system, board configuration files (*.conf) follow a project standard of not including shebang lines, even though they contain bash code and are sourced by the build system. This is an established Armbian convention that individual contributors are expected to follow, and changes to this standard would require broader project maintainer approval.

Applied to files:

  • config/boards/radxa-nio-12l.conf
  • config/sources/families/genio.conf
📚 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/radxa-nio-12l.conf
  • config/sources/families/genio.conf
📚 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/radxa-nio-12l.conf
  • config/sources/families/genio.conf
📚 Learning: 2025-09-07T17:39:32.272Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8586
File: config/boards/nanopi-r76s.conf:15-21
Timestamp: 2025-09-07T17:39:32.272Z
Learning: In the Armbian build system, the variables $BOARD and $SDCARD are always set by the build framework, so guard checks for these variables are unnecessary in board configuration files and hook functions.

Applied to files:

  • config/boards/radxa-nio-12l.conf
  • config/sources/families/genio.conf
📚 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/radxa-nio-12l.conf
  • config/sources/families/genio.conf
📚 Learning: 2025-05-07T20:49:40.969Z
Learnt from: djurny
Repo: armbian/build PR: 8166
File: config/bootscripts/boot-mvebu.cmd:38-50
Timestamp: 2025-05-07T20:49:40.969Z
Learning: The 4KB (0x1000) boundary used for device tree size calculations in U-Boot scripts is specific to how the `fdt resize` command works internally and should remain hardcoded rather than being tied to adjustable alignment variables.

Applied to files:

  • config/bootscripts/boot-genio.cmd
📚 Learning: 2025-09-01T06:11:43.476Z
Learnt from: wei633
Repo: armbian/build PR: 8557
File: config/bootscripts/boot-xpressreal-t3.cmd:0-0
Timestamp: 2025-09-01T06:11:43.476Z
Learning: In Armbian boot scripts without initramfs support, UUID= and LABEL= style device paths cannot be used for rootdev as they require initramfs to resolve during boot. Only direct device paths (/dev/mmcblkXpY) or PARTUUID= references (which U-Boot can resolve) will work.

Applied to files:

  • config/bootscripts/boot-genio.cmd
📚 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/bootscripts/boot-genio.cmd
  • config/sources/families/genio.conf
📚 Learning: 2025-09-24T09:54:07.968Z
Learnt from: amazingfate
Repo: armbian/build PR: 8668
File: extensions/ufs.sh:2-2
Timestamp: 2025-09-24T09:54:07.968Z
Learning: In Armbian's build system, DOCKER_ARMBIAN_BASE_IMAGE must be set globally at file load time in extensions, not inside extension_prepare_config functions, because docker operations happen early in the build process and would default to ubuntu:noble if not set before docker_cli_prepare() runs.

Applied to files:

  • config/bootscripts/boot-genio.cmd
📚 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/bootscripts/boot-genio.cmd
📚 Learning: 2025-12-15T23:26:40.214Z
Learnt from: bryanbrattlof
Repo: armbian/build PR: 9081
File: config/boards/sk-am62-sip.conf:18-20
Timestamp: 2025-12-15T23:26:40.214Z
Learning: For TI K3 SoC boards with only 512MB of DDR (like SK-AM62-SIP), OP-TEE (BL32) and TFA must be placed at the bottom of DDR (e.g., BL32_BASE=0x80080000, CFG_TZDRAM_START=0x80080000) rather than the standard high-memory layout. This is necessary because U-Boot relocates itself to the highest DDR address (up to 2GB max) during bootup, which would overwrite OP-TEE/TFA if they were placed at the top of the 512MB DDR region. PRELOADED_BL33_BASE is typically set to 0x82000000 in this configuration.

Applied to files:

  • config/bootscripts/boot-genio.cmd
  • patch/atf/atf-genio/0001-plat-mediatek-mt8188-8195-8365-Support-FIP-image-on-.patch
📚 Learning: 2025-03-31T12:57:13.880Z
Learnt from: libiunc
Repo: armbian/build PR: 8033
File: config/kernel/linux-starfive2-vendor.config:43-43
Timestamp: 2025-03-31T12:57:13.880Z
Learning: For StarFive2 platform kernel configurations, maintain alignment with vendor-provided configurations rather than modifying security settings like SECCOMP. This ensures hardware compatibility as intended by the manufacturer.

Applied to files:

  • patch/atf/atf-genio/0001-plat-mediatek-mt8188-8195-8365-Support-FIP-image-on-.patch
📚 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/sources/families/genio.conf
📚 Learning: 2025-09-27T21:47:58.020Z
Learnt from: tabrisnet
Repo: armbian/build PR: 8678
File: config/kernel/linux-bcm2711-edge.config:859-861
Timestamp: 2025-09-27T21:47:58.020Z
Learning: In the Armbian build system, kernel configuration files in config/kernel/ are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2025-06-25T03:40:52.109Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8330
File: config/sources/families/sun55iw3.conf:32-36
Timestamp: 2025-06-25T03:40:52.109Z
Learning: In Armbian build system configuration files like config/sources/families/*.conf, when KERNELSOURCE is not explicitly declared in a case branch, the system falls back to a default KERNELSOURCE value, so missing KERNELSOURCE declarations are not critical issues.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2025-09-27T21:50:15.915Z
Learnt from: tabrisnet
Repo: armbian/build PR: 8678
File: config/kernel/linux-sunxi64-current.config:94-94
Timestamp: 2025-09-27T21:50:15.915Z
Learning: When kernel config files are generated through Armbian's automated process (previous config → armbian-kernel.sh changes → make oldconfig → Armbian machinery processing), manual config file edits are not appropriate since they would be overwritten. Deprecated option handling should be implemented in the automated tooling instead.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2025-09-27T21:50:04.845Z
Learnt from: tabrisnet
Repo: armbian/build PR: 8678
File: config/kernel/linux-sm8250-edge.config:80-82
Timestamp: 2025-09-27T21:50:04.845Z
Learning: In the Armbian build system, kernel configuration files are generated through this automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2025-09-27T21:49:55.796Z
Learnt from: tabrisnet
Repo: armbian/build PR: 8678
File: config/kernel/linux-sm8250-current.config:78-80
Timestamp: 2025-09-27T21:49:55.796Z
Learning: In the Armbian build system, kernel configuration files are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2025-06-25T03:42:09.086Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8330
File: config/sources/families/sun55iw3.conf:32-36
Timestamp: 2025-06-25T03:42:09.086Z
Learning: In Armbian build system configuration files like config/sources/families/*.conf, KERNELSOURCE is explicitly declared when using unofficial or 3rd party kernel repositories (like the "dev" branch using https://github.com/apritzel/linux), but can be omitted when using the standard mainline kernel (like the "edge" branch) since it will fall back to the default mainline source.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2026-01-03T20:44:12.559Z
Learnt from: rpardini
Repo: armbian/build PR: 9159
File: config/sources/families/genio.conf:201-201
Timestamp: 2026-01-03T20:44:12.559Z
Learning: In the Armbian build system, when calling run_host_command_logged with arrays containing arguments that have shell metacharacters (e.g., semicolons, pipes), use "${array[*]Q}" instead of "${array[@]}". This is because run_host_command_logged executes via `bash -c "$*"`, and the Q operator shell-quotes each element to prevent bash from interpreting special characters as command separators or other shell syntax.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2025-09-13T19:51:14.713Z
Learnt from: pyavitz
Repo: armbian/build PR: 8631
File: config/boards/khadas-vim4.conf:42-42
Timestamp: 2025-09-13T19:51:14.713Z
Learning: In the Armbian build system, run_host_command_logged properly handles shell redirection operators like ">>" when passed as string arguments. This pattern is used consistently throughout the codebase, such as in lib/functions/rootfs/distro-agnostic.sh where it's used to append to armbianEnv.txt files. The function has been tested and confirmed to work correctly with this syntax.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2025-09-13T19:51:14.713Z
Learnt from: pyavitz
Repo: armbian/build PR: 8631
File: config/boards/khadas-vim4.conf:42-42
Timestamp: 2025-09-13T19:51:14.713Z
Learning: The run_host_command_logged function in the Armbian build system works by executing all its arguments through `bash -c "$*"`. This means shell redirection operators like ">>" are properly processed by bash, making commands like `run_host_command_logged echo "content" >> file.txt` work correctly. The function does not treat redirection operators as literal arguments.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2025-09-13T19:51:14.713Z
Learnt from: pyavitz
Repo: armbian/build PR: 8631
File: config/boards/khadas-vim4.conf:42-42
Timestamp: 2025-09-13T19:51:14.713Z
Learning: In the Armbian build system, run_host_command_logged can properly handle shell redirection operators like >> when passed as arguments, contrary to typical command wrapper behavior. The function has been tested to work correctly with redirection for appending to files like armbianEnv.txt.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2025-09-22T21:52:01.225Z
Learnt from: tabrisnet
Repo: armbian/build PR: 8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2025-08-30T06:48:09.091Z
Learnt from: tabrisnet
Repo: armbian/build PR: 0
File: :0-0
Timestamp: 2025-08-30T06:48:09.091Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the user prefers flexible grep patterns over anchored ones for BTRFS configuration checks, but agrees to use quiet grep (-q) to avoid polluting build logs.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2025-11-11T20:56:20.303Z
Learnt from: glneo
Repo: armbian/build PR: 8913
File: config/sources/families/include/k3_common.inc:57-60
Timestamp: 2025-11-11T20:56:20.303Z
Learning: In config/sources/families/include/k3_common.inc, the OP-TEE build command at line 59 should be updated in a future PR to explicitly set CROSS_COMPILE64=aarch64-linux-gnu- and CROSS_COMPILE32=arm-linux-gnueabihf- instead of relying on OP-TEE's internal defaults, for better clarity and maintainability. User glneo agreed to address this in a separate PR.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2025-11-10T22:05:40.490Z
Learnt from: tabrisnet
Repo: armbian/build PR: 8913
File: config/sources/families/k3-beagle.conf:16-16
Timestamp: 2025-11-10T22:05:40.490Z
Learning: In the Armbian build system, kernel branches using non-mainline/vendor forks (like BeagleBoard's linux repository) should be named "vendor" or "vendor-rt" rather than "current" or "edge". The "current" and "edge" naming is reserved for mainline kernel branches. This affects both the case statement in family config files (e.g., `vendor | vendor-rt)` instead of `current | current-rt)`) and the corresponding KERNEL_TARGET declarations in board config files.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2025-06-24T10:08:40.313Z
Learnt from: EvilOlaf
Repo: armbian/build PR: 8328
File: lib/functions/compilation/patch/drivers_network.sh:542-545
Timestamp: 2025-06-24T10:08:40.313Z
Learning: In the Armbian build system, when a PR removes build support for a specific kernel version, version check issues for that removed version become practically irrelevant even if they appear incorrect in isolation. Context about which kernel versions are being deprecated/removed is important for understanding the impact of version-related code changes.

Applied to files:

  • config/sources/families/genio.conf
📚 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/sources/families/genio.conf
📚 Learning: 2025-08-03T15:21:20.148Z
Learnt from: pyavitz
Repo: armbian/build PR: 8455
File: config/sources/families/sun50iw1.conf:19-24
Timestamp: 2025-08-03T15:21:20.148Z
Learning: In the Armbian build system, when copying firmware files during family_tweaks_s(), use /lib/firmware/updates/ instead of /lib/firmware/ to avoid conflicts with the Armbian firmware package. The /lib/firmware/updates directory takes precedence in Linux firmware loading hierarchy and is the proper location for user-installed firmware files.

Applied to files:

  • config/sources/families/genio.conf
📚 Learning: 2025-12-12T23:09:56.813Z
Learnt from: tabrisnet
Repo: armbian/build PR: 9058
File: config/sources/families/spacemit.conf:39-45
Timestamp: 2025-12-12T23:09:56.813Z
Learning: In Armbian build configs for vendor kernel sources, prefer the following branch naming conventions: use 'vendor' or 'vendor-rt' for stable vendor releases, and 'vendor-edge' for bleeding-edge/pre-release vendor versions. The 'edge' naming without the 'vendor-' prefix is reserved for mainline kernel branches. Apply this pattern to family config files under config/sources/families (e.g., spacemit.conf) to ensure consistent vendor kernel sourcing naming across the repository.

Applied to files:

  • config/sources/families/genio.conf
🧬 Code graph analysis (1)
extensions/mtkflash.sh (4)
lib/functions/logging/display-alert.sh (1)
  • display_alert (10-227)
lib/functions/logging/traps.sh (1)
  • exit_with_error (173-196)
lib/functions/general/git.sh (1)
  • fetch_from_repo (80-309)
lib/functions/logging/runners.sh (1)
  • run_host_command_logged (204-206)

@igorpecovnik igorpecovnik merged commit 063c641 into armbian:main Jan 8, 2026
12 checks passed
@rpardini
Copy link
Member Author

rpardini commented Jan 8, 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 Framework Framework components Hardware Hardware related like kernel, U-Boot, ... Needs review Seeking for review Patches Patches related to kernel, U-Boot, ... size/large PR with 250 lines or more

Development

Successfully merging this pull request may close these issues.

4 participants