.ko file not being compiled after adding Kernel Package

I'm trying to add support for the Terratec Cinergy TC2 DVB-T/C USB stick, so that I can use it in TVHeadend, by adding the kernel modules.

I've created the following kernel package configuration:

define KernelPackage/terratec-tc2
  SUBMENU:=$(VIDEO_MENU)
  TITLE:=terratec tc2 support
  DEPENDS:=+kmod-i2c-mux +kmod-input-core +kmod-video-core +kmod-nls-base +kmod-regmap-i2c +kmod-usb-core +kmod-video-videobuf2 +kmod-video-uvc
  KCONFIG:= \
	CONFIG_MEDIA_TUNER_SI2157 \
	CONFIG_DVB_SI2168 \
	CONFIG_DVB_USB_AF9035 \
	CONFIG_DVB_USB_V2 \
	CONFIG_DVB_CORE \
	CONFIG_RC_CORE
  FILES:= \
	$(LINUX_DIR)/drivers/media/tuners/si2157.ko \
	$(LINUX_DIR)/drivers/media/dvb-frontends/si2168.ko \
	$(LINUX_DIR)/drivers/media/usb/dvb-usb-v2/dvb-usb-af9035.ko \
	$(LINUX_DIR)/drivers/media/usb/dvb-usb-v2/dvb_usb_v2.ko \
	$(LINUX_DIR)/drivers/media/dvb-core/dvb-core.ko \
	$(LINUX_DIR)/drivers/media/rc/rc-core.ko
  AUTOLOAD:=$(call AutoProbe,rc-core dvb-core dvb_usb_v2 dvb-usb-af9035 si2168 si2157)
endef

define KernelPackage/terratec-tc2/description
 Kernel modules for Terratec TC2
endef

$(eval $(call KernelPackage,terratec-tc2)) 

(See commit here

I enabled the package using make menuconfig. When compiling however, I get the following error:

make[2]: Entering directory '/media/brouwer/data_volume/personal/repositories/openwrt/package/kernel/linux'
ERROR: module '/media/brouwer/data_volume/personal/repositories/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/linux-5.4.34/drivers/media/tuners/si2157.ko' is missing.
modules/video.mk:1054: recipe for target '/media/brouwer/data_volume/personal/repositories/openwrt/bin/targets/ramips/mt7621/packages/kmod-terratec-tc2_5.4.34-1_mipsel_24kc.ipk' failed
make[2]: *** [/media/brouwer/data_volume/personal/repositories/openwrt/bin/targets/ramips/mt7621/packages/kmod-terratec-tc2_5.4.34-1_mipsel_24kc.ipk] Error 1

It seems like none of the .ko files of the newly added package, are being compiled in the linux compile.

I've already tried rebuilding after a make distclean, to no avail.

I've checked/noted the following:

  1. I've checked the Kconfig dependencies for the 'CONFIG_MEDIA_TUNER_SI2157' here: https://github.com/torvalds/linux/blob/6f0d349d922ba44e4348a17a78ea51b7135965b1/drivers/media/tuners/Kconfig#L251 . These are CONFIG_MEDIA_SUPPORT and CONFIG_I2C, which should be convered by the kmod-video-core and kmod-i2c-mux packages in the dependencies of my kernel package.
  2. After the make target/linux/compile, I've checked the .config file in '/media/brouwer/data_volume/personal/repositories/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/linux-5.4.34', but the 'CONFIG_MEDIA_TUNER_SI2157' doesn't seem to be added here, hence why it's probably not compiled. Note: It's properly set in .config.old, so it's there initially, but during the build process, the .config get's updated, and it gets removed somehow

Does anyone have an idea why the 'CONFIG_MEDIA_TUNER_SI2157' does not end-up in the linux .config, and the kernel module is not built?

I think I have the same problem but with the quantenna driver (qtnfmac)? I'm not sure my config is right. but at the end the *.ko file is also missing and "empty packages" will be build.

maybe it has the same cause? if not please ignore ...

no relocatable entry for qtnfmac:

rstrip.sh: /home/user/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/packages/ipkg-arm_cortex-a15_neon-vfpv4/kmod-net-rtl8192su/lib/modules/5.4.35/r8712u.ko: relocatable
Packaged contents of /home/user/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/packages/ipkg-arm_cortex-a15_neon-vfpv4/kmod-net-rtl8192su into /home/user/openwrt/bin/targets/ipq806x/generic/packages/kmod-net-rtl8192su_5.4.35-1_arm_cortex-a15_neon-vfpv4.ipk
Packaged contents of /home/user/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/packages/ipkg-arm_cortex-a15_neon-vfpv4/kmod-qtnfmac into /home/user/openwrt/bin/targets/ipq806x/generic/packages/kmod-qtnfmac_5.4.35-1_arm_cortex-a15_neon-vfpv4.ipk
rstrip.sh: /home/user/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/packages/ipkg-arm_cortex-a15_neon-vfpv4/kmod-ieee802154/lib/modules/5.4.35/ieee802154.ko: relocatable
rstrip.sh: /home/user/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/packages/ipkg-arm_cortex-a15_neon-vfpv4/kmod-ieee802154/lib/modules/5.4.35/ieee802154_socket.ko: relocatable
Packaged contents of /home/user/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/packages/ipkg-arm_cortex-a15_neon-vfpv4/kmod-ieee802154 into /home/user/openwrt/bin/targets/ipq806x/generic/packages/kmod-ieee802154_5.4.35-1_arm_cortex-a15_neon-vfpv4.ipk

...

generating empty package entry:

SHELL= flock /home/user/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/user/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/packages/.pkgdir/kmod-net-rtl8192su/. /home/user/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/root-ipq806x/'
touch /home/user/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/root-ipq806x/stamp/.kmod-net-rtl8192su_installed
WARNING: kmod-qtnfmac is not available in the kernel config - generating empty package <================================================================ look here 
mkdir -p /home/user/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/root-ipq806x/stamp

SHELL= flock /home/user/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/user/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/packages/.pkgdir/kmod-qtnfmac/. /home/user/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/root-ipq806x/'
touch /home/user/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/root-ipq806x/stamp/.kmod-qtnfmac_installed
echo "kmod-qtnfmac" >> /home/user/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/pkginfo/linux.default.install
mkdir -p /home/user/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/root-ipq806x/stamp

SHELL= flock /home/user/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/user/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/packages/.pkgdir/kmod-ieee802154/. /home/user/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/root-ipq806x/'
touch /home/user/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/root-ipq806x/stamp/.kmod-ieee802154_installed
mkdir -p /home/user/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/root-ipq806x/stamp

(Have more infos here in the post in the section "to 2:" Large flash and qtnfmac driver for R7500v1 )

greetings

Did anyone found out whats going on with the .ko files missing? This is happening with any package I'm trying to build.

I resolved a similar problem with:

make defconfig clean
make target/linux/compile
make package/kernel/linux/compile

See also: https://openwrt.org/docs/guide-developer/single.package#kernel_modules

2 Likes

Did anybody solve this issue ? I'm having the same problem, migrating from an older OpenWRT to the current one. On the older one all works, I can compile the driver. On the current one I hit the described problem. Cleaning all and rebuilding did not fix the problem. In fact to be sure I copied an existing driver from packages/kernel , and changed in it's makefile the package name and all references to it, and does not build with the same message. The original one however builds. I search on all files maybe missing some additional setting, can not find anything to explain why I can only build the existing packages/kernel drivers but I can not add a new one.

I tried vgaetera sugestion, did not work, I even started all clean, rebuild everything same problem, it fails when it reaches the new driver. To be sure, for testing I just used the default OpenWrt only with the board selection, no other packages or other changes, except the new driver which is identical with an existing one just name changed, and it fails.

It almost looks like the system does not allow adding extra drivers, there is any setting which blocks this which I'm not aware ? Followed the documentation, does not mention anything. Moving the driver from packages/kernel to packages/ does not change anything, it looks like it builds but there is no .ko file and the build fails at that point.

If your out of tree kernel module no longer builds, you'll have to debug and fix it for the new kernel - that's not an issue with OpenWrt, but with your own kernel module.

Thanks. I'm looking at it. It looks like my driver does not really build. It has a bunch of warnings (not my driver, was done years ago by somebody else) which are now treated as errors. Probably some compiler option had changed. Looking how to overwrite the option for that specific driver.