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

dracut-install: add weak dependencies support #2658

Closed
wants to merge 1 commit into from

Conversation

jtornosm
Copy link

@jtornosm jtornosm commented Jun 28, 2024

It has been seen that for some network mac drivers (i.e. lan78xx) the related module for the phy is loaded dynamically depending on the current hardware. In this case, the associated phy is read using mdio bus and then the associated phy module is loaded during runtime (kernel function phy_request_driver_module). However, no software dependency is defined, so the user tools will no be able to get this dependency. For example, if dracut is used and the hardware is present, lan78xx will be included but no phy module will be added, and in the next restart the device will not work from boot because no related phy will be found during initramfs stage.

In order to solve this, we could define a normal 'pre' software dependency in lan78xx module with all the possible phy modules (there may be some), but proceeding in that way, all the possible phy modules would be loaded while only one is necessary.

So, a new type of dependency has been created, that we are going to call 'weak' to be used only by the user tools that need to detect this situation. In that way, for example, dracut could check the 'weak' dependency of the modules involved in order to install these dependencies in initramfs too. That is, for the commented lan78xx module, defining the 'weak' dependency with the possible phy modules list, only the necessary phy would be loaded on demand keeping the same behavior, but all the possible phy modules would be available from initramfs.

The 'weak' dependency support has been already included in kmod: kmod-project/kmod@05828b4
And in kernel:
https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/commit/?h=modules-next&id=1f3dacc0dcef6681c2acf5890e018012f6b53085
After these, 'weak' dependencies for modules will start to appear.
Read the possible weak dependencies from dracut in order to take them into account.

All related documentation has been filled for kmod.
Tests have been added in kmod test-suite:
kmod-project/kmod@d06712b

Changes

Add weak dependencies support

Checklist

  • [ X] I have tested it locally
  • [ X] I have reviewed and updated any documentation if relevant (kmod help)
  • [ X] I am providing new code and test(s) for it (kmod test-suite)

Fixes #
New feature

It has been seen that for some network mac drivers (i.e. lan78xx) the
related module for the phy is loaded dynamically depending on the current
hardware. In this case, the associated phy is read using mdio bus and then
the associated phy module is loaded during runtime (kernel function
phy_request_driver_module). However, no software dependency is defined, so
the user tools will no be able to get this dependency. For example, if
dracut is used and the hardware is present, lan78xx will be included but no
phy module will be added, and in the next restart the device will not work
from boot because no related phy will be found during initramfs stage.

In order to solve this, we could define a normal 'pre' software dependency
in lan78xx module with all the possible phy modules (there may be some),
but proceeding in that way, all the possible phy modules would be loaded
while only one is necessary.

So, a new type of dependency has been created, that we are going to call
'weak' to be used only by the user tools that need to detect this situation.
In that way, for example, dracut could check the 'weak' dependency of the
modules involved in order to install these dependencies in initramfs too.
That is, for the commented lan78xx module, defining the 'weak' dependency
with the possible phy modules list, only the necessary phy would be loaded
on demand keeping the same behavior, but all the possible phy modules would
be available from initramfs.

The 'weak' dependency support has been already included in kmod:
kmod-project/kmod@05828b4
And in kernel:
https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/commit/?h=modules-next&id=1f3dacc0dcef6681c2acf5890e018012f6b53085
After these, 'weak' dependencies for modules will start to appear.
Read the possible weak dependencies from dracut in order to take them into
account.

Signed-off-by: Jose Ignacio Tornos Martinez <[email protected]>
@github-actions github-actions bot added the dracut-install Issues related to dracut install label Jun 28, 2024
@aafeijoo-suse
Copy link
Member

@jtornosm thanks for working on this feature. This repo is currently not maintained, could you resubmit this PR to https://github.com/dracut-ng/dracut-ng? I opened there dracut-ng/dracut-ng#383 last month.

@jtornosm
Copy link
Author

jtornosm commented Jul 1, 2024

Sure, I will do there
Thanks

@jtornosm jtornosm closed this Jul 1, 2024
@jtornosm
Copy link
Author

jtornosm commented Jul 1, 2024

This PR will be continued in dracut-ng:
dracut-ng/dracut-ng#439

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dracut-install Issues related to dracut install
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants