Date
1 - 20 of 31
insmod - huawei E3372h kernel module
Zoltan Kerenyi Nagy
Hi Folks, I bitbaked a Huawei E3372h driver into the distro with this recipe file: SUMMARY = "Huawei Stick kernel module" LICENSE = "CLOSED" inherit module SRC_URI = "file://Makefile \ file://huawei_cdc_ncm.c \ " S = "${WORKDIR}" The makefile looks like this: obj-m := huawei_cdc_ncm.o SRC := $(shell pwd) all: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install clean: rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c rm -f Module.markers Module.symvers modules.order rm -rf .tmp_versions Modules.symvers The source file is the one that matches the kernel: I included this into the conf file: KERNEL_MODULE_AUTOLOAD
+= "lte"KERNEL_MODULE_PROBECONF += "lte"huawei_cdc_ncm = "options lte
iProduct=E3372h iManufacturer=Huawei" Bitbake runs without error, however when I insert the SD card into the hardware ( barix ipam 400) and boot the hardware this is the error message: root@barix-ipam400:~# insmod /lib/modules/4.10.0/extra/huawei_cdc_ncm.ko insmod: can't insert '/lib/modules/4.10.0/extra/huawei_cdc_ncm.ko': unknown symbol in module, or unknown parameter To
me it looks like that there was an error during the bitbake, or the
header files included in the driver doesn't match the kernel. Do you have any idea how to procede? Thanks, -- Zolee |
|
Zoran
Hello Zoltan,
root@barix-ipam400:~# insmod /lib/modules/4.10.0/extra/huawei_cdc_ncm.koPlease, try to set Kconfig (obj-y := huawei_cdc_ncm.o) to y, I guess 99.9% that the kernel compilation (actually, driver compilation) will pass. I think YOCTO (recipe) behaves perfectly correctly. Other approach: try to compile the same module with Makefile above on the target. (my two cent thoughts) Zoran _______ On Thu, Jan 7, 2021 at 2:46 PM Zoltan Kerenyi Nagy <kerenyi.nagy.zoltan@...> wrote:
|
|
Zoltan Kerenyi Nagy
Hi Zoran, Thanks, I modified the Makefile: obj-m := huawei_cdc_ncm.o Kconfig (obj-y := huawei_cdc_ncm.o) SRC := $(shell pwd) all: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install: $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install clean: rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c rm -f Module.markers Module.symvers modules.order rm -rf .tmp_versions Modules.symvers but this is the error: ERROR: huawei-1.1-r0 do_configure: oe_runmake failed ERROR: huawei-1.1-r0 do_configure: Function failed: do_configure (log file is located at /home/kerenyiz/oe-core/build/tmp-glibc/work/barix_ipam400-oe-linux-gnueabi/huawei/1.1-r0/temp/log.do_configure.4488) ERROR: Logfile of failure stored in: /home/kerenyiz/oe-core/build/tmp-glibc/work/barix_ipam400-oe-linux-gnueabi/huawei/1.1-r0/temp/log.do_configure.4488 Log data follows: | DEBUG: Executing shell function do_configure | NOTE: make KERNEL_SRC=/home/kerenyiz/oe-core/build/tmp-glibc/work-shared/barix-ipam400/kernel-source clean | ERROR: oe_runmake failed | Makefile:2: *** empty variable name. Stop. | ERROR: Function failed: do_configure (log file is located at /home/kerenyiz/oe-core/build/tmp-glibc/work/barix_ipam400-oe-linux-gnueabi/huawei/1.1-r0/temp/log.do_configure.4488) ERROR: Task (/home/kerenyiz/oe-core/build/../stuff/meta-barix-sdk/recipes-z/kernel-modules/huawei/huawei_1.1.bb:do_configure) failed with exit code '1' NOTE: Tasks Summary: Attempted 3880 tasks of which 3873 didn't need to be rerun and 1 failed. On Thu, 7 Jan 2021 at 16:03, Zoran Stojsavljevic <zoran.stojsavljevic@...> wrote: Hello Zoltan, --
Zolee |
|
Zoran
No, no... I did not mean in the makefile to change m to y.
Please, maybe you can try to set your makefile to lookalike as these ones: https://github.com/ZoranStojsavljevic/mikrobus/blob/mikrobusv2/Makefile https://github.com/ZoranStojsavljevic/mikrobus/blob/mikrobusv2-debug/Makefile Zoran _______ On Thu, Jan 7, 2021 at 4:17 PM Zoltan Kerenyi Nagy <kerenyi.nagy.zoltan@...> wrote:
|
|
Zoran
If I think more... For driver development the Out Of (OOT) Tree driver
is a must, and so far the most efficient way is to have native tool environment presence on the target, so the quick recompilation of the module is a must/should be achieved... It is a pain doing this on the host using cross compilation, or even building it to the kernel. Once the driver is stable, then it should be built-in with Y in the kernel, changing the YOCTO kernel defconfig (not the topic for this problem, there is a good explanation how to do that in YOCTO manuals). If the driver is out of shelf, it should be recompiled as built-in the kernel. There are differences between having an OOT driver versus a built-in driver. Since some variables and functions are exported in .c files, and not propagated into related .h files. And then this makes some confusion while having OOT drivers. Zoran _______ On Thu, Jan 7, 2021 at 4:27 PM Zoran via lists.yoctoproject.org <zoran.stojsavljevic=gmail.com@...> wrote:
|
|
Zoran
Since some variables and functions are exported in .c files, and notQuite an opposite. It must be defined to be exported, and to appear in Module.symvers . If it is NOT defined as exported (EXPORT_SYMBOL, EXPORT_SYMBOL_GPL), it will behave as from your initial post, if the driver is defined as a module. The example for this behaviour is here: https://github.com/ZoranStojsavljevic/mikrobus/blob/mikrobusv2-debug/mikrobus_core.c#L447 Symbol regulator_register_always_on (it is NOT exported at all, neither in include/linux/regulator/fixed.h, neither in drivers/regulator/fixed-helper.c). So the mikrobus driver, being a module, produces such an error: unknown symbol in module, or unknown parameter . _______ Sorry for the confusion. :( Zoran _______ On Thu, Jan 7, 2021 at 6:55 PM Zoltan Kerenyi Nagy <kerenyi.nagy.zoltan@...> wrote:
|
|
Zoltan Kerenyi Nagy
Hi,
Makefile: huawei_cdc_ncm-y := huawei_cdc_ncm.oobj-m += huawei_cdc_ncm.oKDIR ?= /lib/modules/`uname -r`/buildall:make -C $(KDIR) M=$(PWD) modulesclean:make -C $(KDIR) M=$(PWD) cleaninstall:cp *.ko /lib/modules/$(shell uname -r)/kernel/drivers/misc/depmod -aThis one doesnt work: DEBUG: Executing shell function do_compileNOTE: make -j 8 KERNEL_SRC=/home/kerenyiz/oe-core/build/tmp-glibc/work-shared/barix-ipam400/kernel-source KERNEL_PATH=/home/kerenyiz/oe-core/build/tmp-glibc/work-shared/barix-ipam400/kernel-source KERNEL_VERSION=4.10.0 CC=arm-oe-linux-gnueabi-gcc -fuse-ld=bfd LD=arm-oe-linux-gnueabi-ld.bfd AR=arm-oe-linux-gnueabi-ar O=/home/kerenyiz/oe-core/build/tmp-glibc/work-shared/barix-ipam400/kernel-build-artifacts KBUILD_EXTRA_SYMBOLS=ERROR: oe_runmake failedmake -C /lib/modules/`uname -r`/build M=/home/kerenyiz/oe-core/build/tmp-glibc/work/barix_ipam400-oe-linux-gnueabi/huawei/1.1-r0 modulesmake[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.make[1]: Entering directory '/usr/src/linux-headers-4.15.0-88-generic'make[2]: Entering directory '/home/kerenyiz/oe-core/build/tmp-glibc/work-shared/barix-ipam400/kernel-build-artifacts'make[3]: Circular /home/kerenyiz/oe-core/build/tmp-glibc/work/barix_ipam400-oe-linux-gnueabi/huawei/1.1-r0/huawei_cdc_ncm.o <- /home/kerenyiz/oe-core/build/tmp-glibc/work/barix_ipam400-oe-linux-gnueabi/huawei/1.1-r0/huawei_cdc_ncm.o dependency dropped.LD [M] /home/kerenyiz/oe-core/build/tmp-glibc/work/barix_ipam400-oe-linux-gnueabi/huawei/1.1-r0/huawei_cdc_ncm.oarm-oe-linux-gnueabi-ld.bfd: no input files/usr/src/linux-headers-4.15.0-88-generic/scripts/Makefile.build:578: recipe for target '/home/kerenyiz/oe-core/build/tmp-glibc/work/barix_ipam400-oe-linux-gnueabi/huawei/1.1-r0/huawei_cdc_ncm.o' failedmake[3]: *** [/home/kerenyiz/oe-core/build/tmp-glibc/work/barix_ipam400-oe-linux-gnueabi/huawei/1.1-r0/huawei_cdc_ncm.o] Error 1/usr/src/linux-headers-4.15.0-88-generic/Makefile:1577: recipe for target '_module_/home/kerenyiz/oe-core/build/tmp-glibc/work/barix_ipam400-oe-linux-gnueabi/huawei/1.1-r0' failedmake[2]: *** [_module_/home/kerenyiz/oe-core/build/tmp-glibc/work/barix_ipam400-oe-linux-gnueabi/huawei/1.1-r0] Error 2make[2]: Leaving directory '/home/kerenyiz/oe-core/build/tmp-glibc/work-shared/barix-ipam400/kernel-build-artifacts'Makefile:146: recipe for target 'sub-make' failedmake[1]: *** [sub-make] Error 2make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-88-generic'Makefile:25: recipe for target 'all' failedmake: *** [all] Error 2ERROR: F--Zolee |
|
Zoltan Kerenyi Nagy
Hi,
I managed to bitbake with these: http://paste.ubuntu.com/p/4W2525MQDj/ http://paste.ubuntu.com/p/VT3zyhy7h2/ I'm very curious how it behaves on the hardware -- Zolee |
|
Zoltan Kerenyi Nagy
No success :-(
insmod /lib/modules/4.10.0/extra/huawei_cdc_ncm.ko insmod: can't insert '/lib/modules/4.10.0/extra/huawei_cdc_ncm.ko': unknown symbol in module, or unknown parameter -- Zolee |
|
Zoran
> insmod /lib/modules/4.10.0/extra/huawei_cdc_ncm.ko > insmod: can't insert '/lib/modules/4.10.0/extra/huawei_cdc_ncm.ko': unknown symbol in module, or unknown parameter On my target (Pocket Bone): debian@arm:/lib/modules/5.8.18-bone24/kernel$ find . -name huawei_cdc_ncm* ./drivers/net/usb/huawei_cdc_ncm.ko.xz debian@arm:/lib/modules/5.8.18-bone24/kernel$ cd ./drivers/net/usb/ debian@arm:/lib/modules/5.8.18-bone24/kernel/drivers/net/sudo insmod huawei_cdc_ncm.ko.xz [ 6554.826591] huawei_cdc_ncm: Unknown symbol cdc_ncm_tx_fixup (err -2) [ 6554.833115] huawei_cdc_ncm: Unknown symbol cdc_ncm_bind_common (err -2) [ 6554.841745] huawei_cdc_ncm: Unknown symbol usb_cdc_wdm_register (err -2) [ 6554.849680] huawei_cdc_ncm: Unknown symbol cdc_ncm_unbind (err -2) [ 6554.857042] huawei_cdc_ncm: Unknown symbol cdc_ncm_rx_fixup (err -2) insmod: ERROR: could not insert module huawei_cdc_ncm.ko.xz: Unknown symbol in module debian@arm:/lib/modules/5.8.18-bone24/kernel/drivers/net/usb$ uname -a Linux arm 5.8.18-bone24 #1 PREEMPT Sun Dec 13 19:15:04 CET 2020 armv7l GNU/Linux debian@arm:/lib/modules/5.8.18-bone24/kernel/drivers/net/usb$ cat /etc/debian_version 10.7 debian@arm:/lib/modules/5.8.18-bone24/kernel/drivers/net/usb$ Good Luck! Zoran _______ On Fri, Jan 8, 2021 at 12:22 PM Zoltan Kerenyi Nagy <kerenyi.nagy.zoltan@...> wrote: No success :-( |
|
Zoltan Kerenyi Nagy
Does it mean that it will never ever work?
Could you please try this one? This might match your kernel version: https://elixir.bootlin.com/linux/v5.8.18/source/drivers/net/usb/huawei_cdc_ncm.c -- Zolee |
|
Zoltan Kerenyi Nagy
I experimented with the latest and greatest source, this is my log during bitbake:
http://paste.ubuntu.com/p/R5PjtrtVYn/ Thank you for your efforts! -- Zolee |
|
Zoran
> Does it mean that it will never ever work? > Could you please try this one? This might match your kernel version: > https://elixir.bootlin.com/linux/v5.8.18/source/drivers/net/usb/huawei_cdc_ncm.c > > Zolee [vuser@fedora33-ssd usb]$ kdiff3 huawei_cdc_ncm_5.8.18.c huawei_cdc_ncm.c org.kde.kdiff3: "Loading A: /home/vuser/projects/kernel.bb/bb-kernel-5.8.18-bone24/KERNEL/drivers/net/usb/huawei_cdc_ncm_5.8.18.c""/proc/1715042/root" org.kde.kdiff3: Loading B: "/home/vuser/projects/kernel.bb/bb-kernel-5.8.18-bone24/KERNEL/drivers/net/usb/huawei_cdc_ncm.c" [vuser@fedora33-ssd usb]$ diff huawei_cdc_ncm_5.8.18.c huawei_cdc_ncm.c [vuser@fedora33-ssd usb]$ diff -c huawei_cdc_ncm_5.8.18.c huawei_cdc_ncm.c [vuser@fedora33-ssd usb]$ diff -s huawei_cdc_ncm_5.8.18.c huawei_cdc_ncm.c Files huawei_cdc_ncm_5.8.18.c and huawei_cdc_ncm.c are identical [vuser@fedora33-ssd usb]$ This is the same modul. You need to try to built-in this one in the kernel. Obviously, you need to load some basic module, this one is dependent upon (my best guess). This one is missing. Maybe this one! $ cat config-5.8.18-bone24 | grep HUAWEI # CONFIG_NET_VENDOR_HUAWEI is not set CONFIG_USB_NET_HUAWEI_CDC_NCM=m Zee _______ On Fri, Jan 8, 2021 at 1:29 PM Zoltan Kerenyi Nagy <kerenyi.nagy.zoltan@...> wrote: Does it mean that it will never ever work? |
|
Zoran
Even better: debian@arm:/lib/modules/5.8.18-bone24/kernel/drivers/net/usb$ lsmod Module Size Used by huawei_cdc_ncm 16384 0 cdc_wdm 24576 1 huawei_cdc_ncm cdc_ncm 32768 1 huawei_cdc_ncm spidev 20480 0 evdev 20480 1 usb_f_acm 20480 2 u_serial 24576 3 usb_f_acm usb_f_ncm 24576 2 usb_f_rndis 24576 4 u_ether 24576 2 usb_f_ncm,usb_f_rndis libcomposite 49152 16 usb_f_acm,usb_f_ncm,usb_f_rndis 8021q 24576 0 garp 16384 1 8021q stp 16384 1 garp mrp 16384 1 8021q llc 16384 2 garp,stp iptable_nat 16384 0 nf_nat 28672 1 iptable_nat nf_conntrack 98304 1 nf_nat nf_defrag_ipv6 20480 1 nf_conntrack nf_defrag_ipv4 16384 1 nf_conntrack iptable_mangle 16384 0 iptable_filter 16384 0 mikrobus_test 16384 1 mikrobus 32768 1 mikrobus_test ip_tables 24576 3 iptable_mangle,iptable_filter,iptable_nat x_tables 24576 3 iptable_mangle,ip_tables,iptable_filter debian@arm:/lib/modules/5.8.18-bone24/kernel/drivers/net/usb$ Zolee, U need (based upon this lsmod on my target) to solve the problem (homework for you). ( U owe me double Glenmorangie on rocks! ) Zee _______ On Fri, Jan 8, 2021 at 1:49 PM Zoran via lists.yoctoproject.org <zoran.stojsavljevic=gmail.com@...> wrote:
|
|
Zoltan Kerenyi Nagy
Hi, Im doing this:
KERNEL_MODULE_AUTOLOAD += "wmc_device_managment"KERNEL_MODULE_PROBECONF += "wmc_device"cdc_wdm = "options wmc_device iProduct=USB_CDC_WCM_Device_Management iManufacturer=WMC"KERNEL_MODULE_AUTOLOAD += "lte"KERNEL_MODULE_PROBECONF += "lte"huawei_cdc_ncm = "options lte iProduct=E3372h iManufacturer=Huawei"
--Zolee |
|
Zoltan Kerenyi Nagy
I managed to bitbake without errors/warning the 2 additional modules, however I cannot load those modules manually on the device:
http://paste.ubuntu.com/p/My4x5j3t4R/ Do you you have any idea? -- Zolee |
|
Zoltan Kerenyi Nagy
Intrestingly modprobe gives me a different error than insmod:
To me this means that it's gonna be a Yocto issue during bitbake. My testing kernel module (hello word) bitbakes, and can be loaded and unloaded on the hardware root@barix-ipam400:~# modprobe /lib/modules/4.10.0/extra/cdc-ncm.komodprobe: module /lib/modules/4.10.0/extra/cdc-ncm.ko not found in modules.deproot@barix-ipam400:~#root@barix-ipam400:~# modprobe /lib/modules/4.10.0/extra/cdc-wdm.komodprobe: module /lib/modules/4.10.0/extra/cdc-wdm.ko not found in modules.deproot@barix-ipam400:~#root@barix-ipam400:~# modprobe /lib/modules/4.10.0/extra/hhello.ko huawei_cdc_ncm.koroot@barix-ipam400:~# modprobe /lib/modules/4.10.0/extra/huawei_cdc_ncm.komodprobe: module /lib/modules/4.10.0/extra/huawei_cdc_ncm.ko not found in modules.deproot@barix-ipam400:~#-- Zolee |
|
Zoltan Kerenyi Nagy
If I make a symbolic link for modprobe, the message is the same like insmod:
root@barix-ipam400:~# ln -s /lib/modules/4.10.0/extra/cdc-ncm.ko /lib/modules/4.10.0/root@barix-ipam400:~# modprobe cdc_ncm.komodprobe: can't load module cdc_wdm (extra/cdc-wdm.ko): invalid module format-- Zolee |
|
Zoltan Kerenyi Nagy
Hi,
I contacted the kernel module (cdc_ncm) developper, and he suggested to change/experiment the kernel module load order. I thought if I specify this way: KERNEL_MODULE_AUTOLOAD += "ncm_driver"KERNEL_MODULE_PROBECONF += "ncm_driver"cdc_ncm = "options ncm_driver iProduct=USB_Host_Driver_for_Network_Control_Model iManufacturer=NCM"KERNEL_MODULE_AUTOLOAD += "wmc_device_managment"KERNEL_MODULE_PROBECONF += "wmc_device"cdc_wdm = "options wmc_device iProduct=USB_CDC_WCM_Device_Management iManufacturer=WMC"KERNEL_MODULE_AUTOLOAD += "lte"KERNEL_MODULE_PROBECONF += "lte"huawei_cdc_ncm = "options lte iProduct=E3372h iManufacturer=Huawei"Than this means the order of loading too. Is there any additional feature in Yocto that can interfere and set the exact kernel module loading order? Thanks, -- Zolee |
|
Zoran
> KERNEL_MODULE_AUTOLOAD += "ncm_driver"KERNEL_MODULE_PROBECONF > += "ncm_driver"cdc_ncm = "options ncm_driver iProduct= > USB_Host_Driver_for_Network_Control_Model iManufacturer=NCM" > KERNEL_MODULE_AUTOLOAD += "wmc_device_managment" > KERNEL_MODULE_PROBECONF += "wmc_device"cdc_wdm = "options wmc_device > iProduct=USB_CDC_WCM_Device_Management iManufacturer=WMC" > KERNEL_MODULE_AUTOLOAD += "lte"KERNEL_MODULE_PROBECONF += > "lte"huawei_cdc_ncm = "options lte iProduct=E3372h iManufacturer=Huawei" debian@arm:~$ cat /etc/modules # /etc/modules: kernel modules to load at boot time. # # This file contains the names of kernel modules that should be loaded # at boot time, one per line. Lines beginning with "#" are ignored. cdc_ncm cdc_wdm huawei_cdc_ncmYou need to, using YOCTO recipes, to modify /etc/modules file to look as shown above, while bitbaking the target. Zoran _______ On Sun, Jan 17, 2021 at 1:34 PM Zoltan Kerenyi Nagy <kerenyi.nagy.zoltan@...> wrote: Hi, |
|