Re: [PATCH] net: usb: lan78xx: add weak dependency with micrel phy module

From: Dragan Simic
Date: Mon Jul 29 2024 - 00:43:59 EST


On 2024-07-28 22:57, Andrew Lunn wrote:
In other words, this patch doesn't subtract anything. Instead, it just
adds a weakdep link between the lan78xx and micrel modules, so the kernel
itself can report that dependency, which may actually result in one more
PHY driver added to a generated initial ramdisk.

So at the moment, does the initramfs contain all PHY modules? I guess
it does, because you have no knowledge which are actually needed. And
this does not help you in any way, as you said, it does not subtract
anything.

Basically, an initial ramdisk shouldn't contain any PHY modules that
aren't automatically detected as needed on a particular system, for
which the initial ramdisk is built. That's how selecting modules
while building the initial ramdisks works. On the other hand, if it's
some initial ramdisk built by a Linux distribution and intended to
support multiple systems or boards, it may contain whatever the
distribution sees fit.

Having weakdeps defined actually does help here. For example, a Linux
distribution mentioned above no longer needs to hand-craft the rules
for initial ramdisk generation for the PHY modules that should be put
into an initial ramdisk together with the lan78xx driver, if the Linux
distribution chooses to include the lax78xx driver. Having weakdep(s)
defined makes the kernel do that instead. Also, there's no point in
including every single PHY driver module, because not all of them are
needed for a particular selection of MAC drivers, which comes from the
intended purpose of the initial ramdisk built by a Linux distribution,
i.e. the target architecture, supported board category, etc.

Let's also keep in mind that including all PHY modules into an initial
ramdisk inevitably makes it larger, which often isn't an option for
resource-constrained embedded systems.