Kernel Newbies archive on lore.kernel.org
 help / color / Atom feed
* Kbuild support for rebuilding a single driver gone?
@ 2020-07-07 12:22 Bjørn Mork
  2020-07-07 13:25 ` Greg KH
  2020-07-07 20:48 ` Valdis Klētnieks
  0 siblings, 2 replies; 5+ messages in thread
From: Bjørn Mork @ 2020-07-07 12:22 UTC (permalink / raw)
  To: kernelnewbies

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   /usr/local/src/git/linux/drivers/net/usb/Module.symvers
make: Leaving directory '/usr/src/linux-headers-5.6.0-2-amd64'
bjorn@miraculix:/usr/local/src/git/linux$ make -C /lib/modules/5.6.0-2-amd64/build M=$(pwd)/drivers/net/usb qmi_wwan.ko
make: Entering directory '/usr/src/linux-headers-5.6.0-2-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
/usr/local/src/git/linux/drivers/net/usb/r8152.c: In function ‘r8152_tx_csum’:
/usr/local/src/git/linux/drivers/net/usb/r8152.c:2004:4: error: implicit declaration of function ‘tcp_v6_gso_csum_prep’ [-Werror=implicit-function-declaration]
 2004 |    tcp_v6_gso_csum_prep(skb);
      |    ^~~~~~~~~~~~~~~~~~~~
/usr/local/src/git/linux/drivers/net/usb/r8152.c: At top level:
/usr/local/src/git/linux/drivers/net/usb/r8152.c:6360:3: error: ‘const struct ethtool_ops’ has no member named ‘supported_coalesce_params’
 6360 |  .supported_coalesce_params = ETHTOOL_COALESCE_USECS,
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/git/linux/drivers/net/usb/r8152.c:6360:31: error: ‘ETHTOOL_COALESCE_USECS’ undeclared here (not in a function); did you mean ‘ETHTOOL_SCOALESCE’?
 6360 |  .supported_coalesce_params = ETHTOOL_COALESCE_USECS,
      |                               ^~~~~~~~~~~~~~~~~~~~~~
      |                               ETHTOOL_SCOALESCE
cc1: some warnings being treated as errors
make[2]: *** [/usr/src/linux-headers-5.6.0-2-common/scripts/Makefile.build:273: /usr/local/src/git/linux/drivers/net/usb/r8152.o] Error 1
make[1]: *** [/usr/src/linux-headers-5.6.0-2-common/Makefile:1704: /usr/local/src/git/linux/drivers/net/usb] Error 2
make: *** [/usr/src/linux-headers-5.6.0-2-common/Makefile:180: sub-make] Error 2
make: Leaving directory '/usr/src/linux-headers-5.6.0-2-amd64'



This is obviously completely irrelevent for the qmi_wwan build.  How to
I get back the old dependency based building?



Bjørn

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Kbuild support for rebuilding a single driver gone?
  2020-07-07 12:22 Kbuild support for rebuilding a single driver gone? Bjørn Mork
@ 2020-07-07 13:25 ` Greg KH
  2020-07-07 13:52   ` Bjørn Mork
  2020-07-07 20:48 ` Valdis Klētnieks
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2020-07-07 13:25 UTC (permalink / raw)
  To: Bjørn Mork; +Cc: kernelnewbies

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:

<snip>

Why not ask on the kbuild mailing list?


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Kbuild support for rebuilding a single driver gone?
  2020-07-07 13:25 ` Greg KH
@ 2020-07-07 13:52   ` Bjørn Mork
  0 siblings, 0 replies; 5+ messages in thread
From: Bjørn Mork @ 2020-07-07 13:52 UTC (permalink / raw)
  To: Greg KH; +Cc: kernelnewbies

Greg KH <greg@kroah.com> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Kbuild support for rebuilding a single driver gone?
  2020-07-07 12:22 Kbuild support for rebuilding a single driver gone? Bjørn Mork
  2020-07-07 13:25 ` Greg KH
@ 2020-07-07 20:48 ` Valdis Klētnieks
  2020-07-08  7:17   ` Bjørn Mork
  1 sibling, 1 reply; 5+ messages in thread
From: Valdis Klētnieks @ 2020-07-07 20:48 UTC (permalink / raw)
  To: Bj�rn Mork; +Cc: kernelnewbies

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1: Type: text/plain; charset=utf-8, Size: 738 bytes --]

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

[-- Attachment #1.2: Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Kbuild support for rebuilding a single driver gone?
  2020-07-07 20:48 ` Valdis Klētnieks
@ 2020-07-08  7:17   ` Bjørn Mork
  0 siblings, 0 replies; 5+ messages in thread
From: Bjørn Mork @ 2020-07-08  7:17 UTC (permalink / raw)
  To: Valdis Klētnieks; +Cc: kernelnewbies

"Valdis Klētnieks" <valdis.kletnieks@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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07 12:22 Kbuild support for rebuilding a single driver gone? Bjørn Mork
2020-07-07 13:25 ` Greg KH
2020-07-07 13:52   ` Bjørn Mork
2020-07-07 20:48 ` Valdis Klētnieks
2020-07-08  7:17   ` Bjørn Mork

Kernel Newbies archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org
	public-inbox-index kernelnewbies

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git