Skip to content

enh(tools): add an overlay autopatcher#12

Open
MichaIng wants to merge 3 commits into
dietpifrom
overlay-autopatcher
Open

enh(tools): add an overlay autopatcher#12
MichaIng wants to merge 3 commits into
dietpifrom
overlay-autopatcher

Conversation

@MichaIng

@MichaIng MichaIng commented May 31, 2026

Copy link
Copy Markdown
Owner

This new overlay autopatcher follows these concepts:

  • Can work independent and compatible with existing overlay, device tree, and Makefile patches, with a dedicated configurable source dir.
  • Simply appends all needed targets and commands to the existing device tree Makefile, not adding the overlay subdir to kernel sources, for simplicity, and to not collide with existing overlay patches, if present. The resulting files are copied to the overlay subdir at packaging time.
  • It can also work on existing overlay subdirs and their existing Makefile. Some commands and target patterns are overridden, which however does not break functionality. When mixing old and new overlay patches, individual source dirs should be used to avoid duplicate overlay compilation.
  • Allows to define one or more optional base dtbs to test the overlay against. Mainline Linux supports an own -dtbs Makefile facility for this, but it creates and installs the merged dtb, which we do not want. Defining an own command is overall easier.
  • Uses per-overlay readme files, for easier processing in extrenal scripts, and less friction when rebasing added overlays.
  • Allows to define per-overlay fixup scripts. Every fixup script Armbian currently ships, contains steps needed/compatible only for particular overlays. None of the scripts does anything functional without a single respective overlay enabled, but may add device tree clutter, fail to apply, or cause certain board features to fail, in worst case. Checking for and running a respective fixup script only right after the respective overlay has been successfully merged, makes a lot more sense, better sorted U-Boot output, easier maintenance and cleanup of overlays.

In case of rockchip64, after migrating spidev, spinor, and 1-wire overlays for RK3399, and moving code for their supported parameters from the generic fixup script into individual per-overlay scripts, the generic fixup script can be removed.

After migrating all overlays to the new autopatcher, no separate overlay source dir is needed anymore, and all old patches related to overlays, the README, and the Makefile, can be removed as well. However, leaving the README and Makefile in place does no harm, they are just ignored without an overlay-directories patching config key. The CONFIG_ARCH_WANT_FLAT_DTB_INSTALL adjustment is not needed, if/as no overlay subdir is used in kernel sources, but only after the kernel build before packaging.

  • rockchip-rockpi4cplus-usb-host.dtso has been removed, since it duplicates with rockchip-rk3399-dwc3-0-host.dtso, and is not needed on the ROCK 4C Plus in particular: In mainline Linux, the dwc3-0 controller is in host mode by default.

@MichaIng

Copy link
Copy Markdown
Owner Author

@copilot
Please split the remaining rockchip64-7.0/overlay/README.rockchip-overlays entries into individual *.readme files, as done for most other cases in this PR.

Copilot AI commented May 31, 2026

Copy link
Copy Markdown

@copilot
Please split the remaining rockchip64-7.0/overlay/README.rockchip-overlays entries into individual *.readme files, as done for most other cases in this PR.

Done in commit rockchip64-7.0: split remaining README.rockchip-overlays entries into individual .readme files. Created 13 individual .readme files for all rk3318-box overlay entries and removed the now-empty README.rockchip-overlays.

@MichaIng MichaIng force-pushed the overlay-autopatcher branch from 2a4cc73 to e3a66ce Compare June 4, 2026 14:38
@MichaIng MichaIng force-pushed the dietpi branch 8 times, most recently from 48a3074 to b03903f Compare June 11, 2026 11:30
MichaIng and others added 3 commits June 11, 2026 13:46
It follows these concepts:
* Works independent and compatible with existing overlay, device tree, and Makefile patches, with a dedicated configurable source dir
* Simply appends all needed targets and commands to the existing device tree Makefile, not adding the overlay subdir to kernel sources, for simplicity, and to not collide with existing overlay patches. The resulting files are copied to the overlay subdir at packaging time.
* Allows to define one or more optional base dtbs to test the overlay against. Mainline Linux supports an own `-dtbs` Makefile facility for this, but it creates and installs the merged dtb, which we do not want. Defining an own command is overall easier.
* Uses per-overlay readme files, for easier processing in extrenal scripts, and less friction when rebasing added overlays
* Allows to define per-overlay fixup scripts. Every fixup script Armbian ships, contains steps needed only for particular overlays. There are no scripts for all overlay prefixes, and no script is reasonable to run without the respective overlay(s) enabled. Checking for and running a respective fixup script right after the respective overlay has been successfully merged makes a lot more sense, better sorted U-Boot output, easier maintenance and cleanup of overlays.

enh(patch): migrate spidev, spinor, and 1-wire overlays for RK3399 to auto-patcher

The generic fixup script is not needed anymore, since the 3 related overlays have their own per-overlay fixup script now.

Signed-off-by: MichaIng <micha@dietpi.com>
Signed-off-by: MichaIng <micha@dietpi.com>
@MichaIng MichaIng force-pushed the overlay-autopatcher branch from e3a66ce to 929c4dc Compare June 11, 2026 11:46
@MichaIng MichaIng force-pushed the dietpi branch 7 times, most recently from d9ea4b9 to 421d4e8 Compare June 15, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants