Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for embedding devicetree into UKI #2440

Closed
wants to merge 1 commit into from

Conversation

manut
Copy link

@manut manut commented Mar 1, 2024

Resolves #2439

To easily use the dtbs provided with kernel packages allow specifying a devicetree name in mkosi.

It can be passed as parameter to ukify.
The dtb is typically installed by the kernel package.

@manut manut force-pushed the task/dtb branch 4 times, most recently from e395ee5 to 931ff21 Compare March 1, 2024 10:58
Resolves systemd#2439

To easily use the dtbs provided with kernel packages allow specifying a
devicetree name in mkosi.

It can be passed as parameter to ukify.
The dtb is typically installed by the kernel package.

Signed-off-by: Manuel Traut <[email protected]>
Copy link
Contributor

@behrmann behrmann left a comment

Choose a reason for hiding this comment

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

Looks mostly reasonable to me. I think this might also be possible by embedding a ukify config file in the package manager tree or the image. I think that was also our idea at some point, to not have to provide all the knobs from ukify's CLI in mkosi, although we've already exposed quite a few of them.

mkosi/config.py Show resolved Hide resolved
@@ -1872,6 +1872,11 @@ def build_uki(
"--ro-bind", stub, stub,
]

if context.config.devicetree:
dtb = context.root / f"usr/lib/linux-image-{kver}" / context.config.devicetree
Copy link
Contributor

Choose a reason for hiding this comment

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

There should probably be some checking here for the case that the file does not exist in the image.

Copy link
Author

Choose a reason for hiding this comment

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

The "other" options like e.g. initrds also do not check the existence of the files.

If a non existing dtb will be configured the current output looks like this:

‣  Generating unified kernel image for kernel version 6.6.15-arm64
bwrap: Can't find source path /home/manut/.cache/mkosi/mkosi-workspaceuw1qmalv/root/usr/lib/linux-image-6.6.15-arm64/idonot/exist.dtb: No such file or directory
bwrap: Can't find source path /home/manut/.cache/mkosi/mkosi-workspaceuw1qmalv/root/usr/lib/linux-image-6.6.15-arm64/idonot/exist.dtb: No such file or directory
‣ "/usr/bin/ukify --cmdline @/home/manut/.cache/mkosi/mkosi-workspaceuw1qmalv/cmdline --os-release @/home/manut/.cache/mkosi/mkosi-workspaceuw1qmalv/root/usr/lib/os-release --stub /home/manut/.cache/mkosi/mkosi-workspaceuw1qmalv/root/usr/lib/systemd/boot/efi/linuxaa64.efi.stub --output /home/manut/.cache/mkosi/mkosi-workspaceuw1qmalv/root/boot/EFI/Linux/debian-6.6.15-arm64.efi --efi-arch aa64 --uname 6.6.15-arm64 --devicetree /home/manut/.cache/mkosi/mkosi-workspaceuw1qmalv/root/usr/lib/linux-image-6.6.15-arm64/idonot/exist.dtb --sign-kernel --signtool sbsign --secureboot-private-key /home/manut/qemu/mkosi.key --secureboot-certificate /home/manut/qemu/mkosi.crt --pcr-private-key /home/manut/qemu/mkosi.key --pcr-banks sha1,sha256 build --linux /home/manut/.cache/mkosi/mkosi-workspaceuw1qmalv/root/usr/lib/modules/6.6.15-arm64/vmlinuz --initrd /home/manut/.cache/mkosi/mkosi-workspaceuw1qmalv/initrd/image.raw-initrd" returned non-zero exit code 1.

Shall we fail with a nicer looking message?

@@ -1872,6 +1872,11 @@ def build_uki(
"--ro-bind", stub, stub,
]

if context.config.devicetree:
dtb = context.root / f"usr/lib/linux-image-{kver}" / context.config.devicetree
Copy link
Contributor

@DaanDeMeyer DaanDeMeyer Mar 2, 2024

Choose a reason for hiding this comment

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

This seems like a completely arbitrary location to me for putting device trees. Is there any kind of spec mandating that this is where device trees should be installed? If not, we need such a spec first. See for example uapi-group/specifications#91 where a standard location for UKI addons is proposed. We'd need such a proposal for device trees as well.

Until then, I'd prefer if you used a ukify config file in a package manager tree to accomplish this.

@DaanDeMeyer
Copy link
Contributor

Closing due to lack of response

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.

Allow specifying a devicetree binary that is passed to ukify
4 participants