Re: Kbuild support for rebuilding a single driver gone?

2020-07-08 Thread Bjørn Mork
"Valdis Klētnieks"  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

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Kbuild support for rebuilding a single driver gone?

2020-07-07 Thread Valdis Klētnieks
On Tue, 07 Jul 2020 14:22:42 +0200, Bj�rn 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

(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...


pgpoo9PLMMWz3.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Kbuild support for rebuilding a single driver gone?

2020-07-07 Thread Bjørn Mork
Greg KH  writes:

> Why not ask on the kbuild mailing list?

Because I'm too lazy to look up any list I'm not already subscribed to.
And I do feel like a newbie whenever I stumble acroess problems like
this one :-)

Thanks for the pointer.  Question redirected there now. 


Bjørn (newbie forever)

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Kbuild support for rebuilding a single driver gone?

2020-07-07 Thread Greg KH
On Tue, Jul 07, 2020 at 02:22:42PM +0200, Bjørn Mork wrote:
> I have "always" tested simple patches by rebuilding just the affected
> driver on whatever kernel I happen to run.  Like this:



Why not ask on the kbuild mailing list?


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Kbuild support for rebuilding a single driver gone?

2020-07-07 Thread Bjørn Mork
I have "always" tested simple patches by rebuilding just the affected
driver on whatever kernel I happen to run.  Like this:

bjorn@miraculix:/usr/local/src/git/linux$ make -C 
/lib/modules/4.19.0-9-amd64/build M=$(pwd)/drivers/net/usb clean
make: Entering directory '/usr/src/linux-headers-4.19.0-9-amd64'
  CLEAN   /usr/local/src/git/linux/drivers/net/usb/Module.symvers
make: Leaving directory '/usr/src/linux-headers-4.19.0-9-amd64'
bjorn@miraculix:/usr/local/src/git/linux$ make -C 
/lib/modules/4.19.0-9-amd64/build M=$(pwd)/drivers/net/usb qmi_wwan.ko
make: Entering directory '/usr/src/linux-headers-4.19.0-9-amd64'
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/qmi_wwan.o
  MODPOST 1 modules
  CC  /usr/local/src/git/linux/drivers/net/usb/qmi_wwan.mod.o
  LD [M]  /usr/local/src/git/linux/drivers/net/usb/qmi_wwan.ko
make: Leaving directory '/usr/src/linux-headers-4.19.0-9-amd64'


But this is broken for some reason with recent Debian (bullseye/sid)
kernels, based on 5.6 or 5.7 kernels.  They will always compile all
source files in the directory, even of most of them are not necessary
for the requested target:


bjorn@miraculix:/usr/local/src/git/linux$ make -C 
/lib/modules/5.7.0-1-amd64/build M=$(pwd)/drivers/net/usb clean
make: Entering directory '/usr/src/linux-headers-5.7.0-1-amd64'
  CLEAN   /usr/local/src/git/linux/drivers/net/usb/Module.symvers
make: Leaving directory '/usr/src/linux-headers-5.7.0-1-amd64'
bjorn@miraculix:/usr/local/src/git/linux$ make -C 
/lib/modules/5.7.0-1-amd64/build M=$(pwd)/drivers/net/usb qmi_wwan.ko
make: Entering directory '/usr/src/linux-headers-5.7.0-1-amd64'
  AR  /usr/local/src/git/linux/drivers/net/usb/built-in.a
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/catc.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/kaweth.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/pegasus.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/rtl8150.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/r8152.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/hso.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/lan78xx.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/asix_devices.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/asix_common.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/ax88172a.o
  LD [M]  /usr/local/src/git/linux/drivers/net/usb/asix.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/ax88179_178a.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/cdc_ether.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/cdc_eem.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/dm9601.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/sr9700.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/sr9800.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/smsc75xx.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/smsc95xx.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/gl620a.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/net1080.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/plusb.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/rndis_host.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/cdc_subset.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/zaurus.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/mcs7830.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/usbnet.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/int51x1.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/cdc-phonet.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/kalmia.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/ipheth.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/sierra_net.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/cx82310_eth.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/cdc_ncm.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/huawei_cdc_ncm.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/lg-vl600.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/qmi_wwan.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/cdc_mbim.o
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/ch9200.o
  MODPOST 1 modules
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/qmi_wwan.mod.o
  LD [M]  /usr/local/src/git/linux/drivers/net/usb/qmi_wwan.ko
make: Leaving directory '/usr/src/linux-headers-5.7.0-1-amd64'




Why is this? Am I doing something wrong here?

This is quite annoying.  Not only does it take much more time than
necessary.  It also causes the build to fail if any of the unnecessary
source files fail to build.  Which is expected with my use case,
building unmodified drivers from a different kernel version.  E.g trying
to rebuild qmi_wwan from the current net/master repo on a Debian 5.6
kernel fails because r8152.c implement new ethtool_ops fields:

bjorn@miraculix:/usr/local/src/git/linux$ make -C 
/lib/modules/5.6.0-2-amd64/build M=$(pwd)/drivers/net/usb clean
make: Entering directory '/usr/src/linux-headers-5.6.0-2-amd64'
  CLEAN