Skip to content

Conversation

craftyguy
Copy link
Contributor

@craftyguy craftyguy commented Jul 28, 2025

This renames Devicetree --> Devicetrees, and adds support for listing
regex, globs, files as currently supported for KernelModule* options.
When multiple devicetrees are found, they are added to dtbauto sections
when building a UKI.
Multiple dtbs are not supported for type 1 booting.

Fixes #3827

@DaanDeMeyer
Copy link
Contributor

The latter is useful for situations where the list of dtbs is not known at configure time (e.g. in postmarketOS, dtbs aren't known until package install time since we use packaging to configure the distro.. i.e. packages and config they provide influence which dtb(s) are needed to boot on particular devices)

This makes sense, but why not just make these packages install stuff to some canonical location where mkosi can look this stuff up inside the image after package installation? I'm not convinced we need a separate setting for adding an extra lookup directory for this stuff.

@craftyguy
Copy link
Contributor Author

This makes sense, but why not just make these packages install stuff to some canonical location where mkosi can look this stuff up inside the image after package installation? I'm not convinced we need a separate setting for adding an extra lookup directory for this stuff.

Sounds good but I'm not sure how we'd want that implemented here though. kernel-install specifies /usr/lib/modules/KERNEL_VERSION/dtb/, so there's already a canonical location for these files... but the current Devicetree= option tells mkosi to pick 1 dtb under that dir.

So, maybe if Devicetree=all it just includes all dtbs in that dir? Or a new option to signal to mkosi to get everything in that dir (and ignore Devicetree= if that's also set) ?

@DaanDeMeyer
Copy link
Contributor

Devicetree=all sounds like it could do the trick.

Or what if we make that setting take a glob and if it's a glob, we include all those device trees?

@craftyguy
Copy link
Contributor Author

craftyguy commented Aug 21, 2025 via email

@DaanDeMeyer
Copy link
Contributor

@craftyguy I think we can go with a glob for the existing Devicetree setting. If it's a glob (a glob has one of *, ?, [ or ]), then we use --devicetree-auto, otherwise we keep using --devicetree.

And we should probably fail hard if it is a glob and type 1 entries are configured to be used since we need to be using UKIs for the devicetree-auto stuff I think.

@craftyguy
Copy link
Contributor Author

@DaanDeMeyer ok I think I got this implemented, and tested with some globs locally (expected dtbs were embedded in dtbauto sections)

@DaanDeMeyer
Copy link
Contributor

Please pull in #3881 or rebase on top of it when merged.

@craftyguy
Copy link
Contributor Author

Picked to this branch

@craftyguy
Copy link
Contributor Author

@DaanDeMeyer I tried to make this behave like the kernel modules regex/glob stuff, and in the latest patch I replaced Devicetree= with Devicetrees= (I asked in chat whether this is what you meant, but lmk if you think this should be a sep. option).

Anyways, it seems to work when I set Devicetrees=rk3588-*,sc8280xp-lenovo-thinkpad-x13s-el2.dtb , with debug logging:

‣ Devicetrees include: rk3588-* sc8280xp-lenovo-thinkpad-x13s-el2.dtb
‣ Found 972 DTB files in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-jaguar-pre-ict-tester.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-armsom-sige7.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-rock-5b-pcie-srns.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-rock-5b.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-coolpi-cm5-genbook.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-edgeble-neu6a-io.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-toybrick-x0.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-jaguar.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-friendlyelec-cm3588-nas.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-tiger-haikou-haikou-video-demo.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-rock-5-itx.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-coolpi-cm5-evb.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-evb1-v10.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-turing-rk1.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-mnt-reform2.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-orangepi-5-ultra.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-rock-5b-plus.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-tiger-haikou.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-quartzpro64.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-edgeble-neu6b-io.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-orangepi-5-max.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-armsom-w3.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-nanopc-t6-lts.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-firefly-itx-3588j.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-h96-max-v58.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-nanopc-t6.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-rock-5b-pcie-ep.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-edgeble-neu6b-wifi.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-edgeble-neu6a-wifi.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-ok3588-c.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-orangepi-5-plus.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: rockchip/rk3588-evb2-v10.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Matched DTB: qcom/sc8280xp-lenovo-thinkpad-x13s-el2.dtb in usr/lib/modules/6.16.3-0-stable/dtb
‣ Including 33 devicetree files

@craftyguy craftyguy force-pushed the devicetree-auto branch 3 times, most recently from 70d9021 to 2058ecf Compare August 26, 2025 20:59
@craftyguy craftyguy force-pushed the devicetree-auto branch 2 times, most recently from e349590 to 79c81e8 Compare August 27, 2025 05:38
Copy link
Contributor

@DaanDeMeyer DaanDeMeyer left a comment

Choose a reason for hiding this comment

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

Looks good, just a few nits

@craftyguy craftyguy force-pushed the devicetree-auto branch 3 times, most recently from 156eba9 to 176e458 Compare September 2, 2025 20:34
This renames Devicetree --> Devicetrees, and adds support for listing
regex, globs, files as currently supported for KernelModule* options.
When multiple devicetrees are found, they are added to dtbauto sections
when building a UKI.
Multiple dtbs are not supported for type 1 booting.

Fixes systemd#3827
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

add support for dtbauto for embedding multiple dtbs in UKI
3 participants