Kbuild support for rebuilding a single driver gone?

Bjørn Mork bjorn at mork.no
Tue Jul 7 08:22:42 EDT 2020


I have "always" tested simple patches by rebuilding just the affected
driver on whatever kernel I happen to run.  Like this:

bjorn at 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 at 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 at 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 at 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 at 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 at 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



More information about the Kernelnewbies mailing list