Kbuild support for rebuilding a single driver gone?

Bjørn Mork bjorn at mork.no
Wed Jul 8 03:17:40 EDT 2020


"Valdis Klētnieks" <valdis.kletnieks at vt.edu> writes:
> On Tue, 07 Jul 2020 14:22:42 +0200, Bjrn Mork said:
>> I have "always" tested simple patches by rebuilding just the affected
>> driver on whatever kernel I happen to run.  Like this:
>
>>  make -C /lib/modules/4.19.0-9-amd64/build M=$(pwd)/drivers/net/usb qmi_wwan.ko
>
> I suspect the problem is that M=  is causing everything in that directory to be
> rebuilt, possibly because it points at itself rather than an output directory elsewhere.
>
> Because it points at itself, why are you even specifying it, instead of just saying
> make -C /lib/modules/4.19.0-9-amd64/build drivers/net/usb/qmi_wwan.ko

Masahiro Yamada fixed the problem immediately after I followed Greg's
great advice: https://patchwork.kernel.org/patch/11649263/

Applying that patch locally to the top level Makefile from the Debian
linux-headers 5.6 and 5.7 packages fixes the problem for me.  So
everything will be fine when this eventually trickles down there via
stable.

> (For that matter, using a 4.19 directory for -C when you're apparently
> working with a git tree is probably rather sketchy as well...

Yes, sure, that is obviously not something I can, or do, expect to work
unconditionally.

Let me try to explain why I do that, with the risk of revealing too much
of my sloppy methods :-)

I like to test stuff myself before acking on anything. And I prefer
testing drivers with real hardware if I can spare the time to do that.
Nowadays I mostly run some distro kernel, since I don't do much kernel
related developement. Building and loading a module or two for the
currently running kernel takes a few seconds.  Buikding and booting a
new kernel takes at least 10 minutes, and often much much more when
there are unrelated problems to solve first..  Not to mention the hassle
of having to shut down whatever else I was using the "test hardware"
(i.e the laptop I am doing all my work on) for.

Given this choice I will always try to build on my current kernel
first, knowing that it is a best effort thing.  If it works - fine.  If
it doesn't - well, I didn't expect it to.  But that will usually result
in me cancelling the run test.

Now, for the reasons that it works in this case: The usbnet API is
pretty stable.  There hasn't really been much going on there for
ages. Some drivers are actively developed and pick up new features from
e.g the net subsystem, like the r8152 ethtool example, but most of them
are in maintenance mode and only get occasional fixes and device id
additions. The result is that you can copy most of drivers/net/usb from
mainline or net-next straight into an old kernel like 4.19.

Not sure the lack of new development is a good thing, but it is very
convenient ;-)



Bjørn



More information about the Kernelnewbies mailing list