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

Modules and firmware includes #3312

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

hundeboll
Copy link
Contributor

In order to include out-of-tree modules (and their required firmware) installed in an updates subfolder, a special case is added when a file is found below that folder.

Furthermore, a firmware file required by a module might be a symbolic link to the real firmware file. Add handling of this case too.

mkosi/kmod.py Outdated Show resolved Hide resolved
mkosi/kmod.py Outdated Show resolved Hide resolved
mkosi/kmod.py Outdated Show resolved Hide resolved
@hundeboll hundeboll force-pushed the modules-and-firmware-includes branch 2 times, most recently from 5e6af61 to 0177fd9 Compare January 3, 2025 09:43
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.

This seems unnecessarily complicated, why not loop over required, calls resolve() on each entry and add all resolved paths to required as well?

@hundeboll hundeboll force-pushed the modules-and-firmware-includes branch from 0177fd9 to aadac1d Compare January 3, 2025 11:10
@hundeboll
Copy link
Contributor Author

This seems unnecessarily complicated, why not loop over required, calls resolve() on each entry and add all resolved paths to required as well?

Okay, spent some time to get to know gen_required_kernel_modules(). Better?

@hundeboll
Copy link
Contributor Author

Also removed the unconditional include of modules / firmwares below an updates folder, as the include / exlcude logic already handles those two. I've updated the documentation instead.

mkosi/kmod.py Outdated Show resolved Hide resolved
mkosi/kmod.py Outdated Show resolved Hide resolved
mkosi/kmod.py Outdated Show resolved Hide resolved
mkosi/kmod.py Outdated Show resolved Hide resolved
@hundeboll hundeboll force-pushed the modules-and-firmware-includes branch from aadac1d to 623881c Compare January 3, 2025 12:24
mkosi/kmod.py Outdated Show resolved Hide resolved
@hundeboll hundeboll force-pushed the modules-and-firmware-includes branch from 623881c to 6cc4454 Compare January 3, 2025 12:55
mkosi/kmod.py Outdated Show resolved Hide resolved
@hundeboll hundeboll force-pushed the modules-and-firmware-includes branch from 6cc4454 to 21b9a1a Compare January 3, 2025 13:01
mkosi/resources/man/mkosi.1.md Outdated Show resolved Hide resolved
mkosi/kmod.py Outdated Show resolved Hide resolved
@DaanDeMeyer
Copy link
Contributor

@hundeboll The ubuntu and centos initrd sizes need to be bumped by 1 in tests/test_initrd.py

@hundeboll hundeboll force-pushed the modules-and-firmware-includes branch from fb71b33 to 84abdc9 Compare January 6, 2025 09:23
The kernel module include/exclude logic matches against paths below any
folder in /usr/lib/modules/$(uname -r)/*/, and not just the `kernel`
folder. Replace the explicitly mentioned `kernel` folder from the
example path with an asterisk to make it clear the folders like `extra`
and `updates` are searched too.
Some modules reference a firmware file that is just a link to a "real"
file. Make sure those files are also included when needed by resolving
those referenced symlinks and including their target files in the set of
required firmware files.
@hundeboll hundeboll force-pushed the modules-and-firmware-includes branch from 84abdc9 to a37fd6d Compare January 6, 2025 09:24
@DaanDeMeyer DaanDeMeyer merged commit 64897fd into systemd:main Jan 6, 2025
31 of 36 checks passed
# Some firmware dependencies are symbolic links, so the targets for those must be included in the list
# of required firmware files too. Intermediate symlinks are not included, and so links pointing to links
# results in dangling symlinks in the final image.
for fw in firmware.copy():
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the call to copy even required here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Otherwise this is mutating the set while it is being iterated over, which throws a RuntimeError: Set changed size during iteration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants