EM7565: Cross compiling GobiSerial for Raspberry Pi 3 B

I have cross compiled the GobiNet and GobiSerial drivers downloaded from the below link:

https://source.sierrawireless.com/resources/airprime/software/usb-drivers-linux-qmi-software-s2,-d-,39n2,-d-,60/#sthash.rDSgv5OT.dpbs

I can insmod the GobiNet.ko into the Raspberry Pi (running NOOBS_v3_2_1 which comes with Linux Kernel version 4.19.75-v7+):

pi@raspberrypi:~ $ dmesg
[ 4782.266814] GobiNet: 2019-11-22/SWI_2.60
[ 4782.267275] usbcore: registered new interface driver GobiNet

I have also been able to cross compile the GobiSerial. However, when I try to insmod the GobiSerial.ko I get the below error:
pi@raspberrypi:~ sudo insmod GobiSerial.ko **insmod: ERROR: could not insert module GobiSerial.ko: Unknown symbol in module** pi@raspberrypi:~ dmesg

[ 5234.123095] GobiSerial: Unknown symbol usb_serial_generic_open (err -2)
[ 5234.123156] GobiSerial: Unknown symbol usb_serial_suspend (err -2)
[ 5234.123334] GobiSerial: Unknown symbol usb_serial_generic_resume (err -2)
[ 5234.123382] GobiSerial: Unknown symbol usb_serial_deregister_drivers (err -2)
[ 5234.123498] GobiSerial: Unknown symbol usb_serial_generic_write (err -2)
[ 5234.123540] GobiSerial: Unknown symbol usb_serial_register_drivers (err -2)

I had to customize the Gobi driver Makefiles (attached for your reference).

My Pi uses the below kernel:
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU/Linux

I am using the same Kernel source files for cross compilation of the drivers.
The kernel source can be found as in below:

From the above, I am using one released on the 24th Sept 2019 which is exactly the same as in my pi at desk.
My reading of the original Gobi driver Makefiles indicates the downloaded Gobi drivers were written and built using linux-rpi-3.6 kernel whereas I am trying to insmod it into a rpi-4.19.75-v7 kernel and I think some of the linux APIs have been deprecated since then and hence the problem.

I would like to know your comments on this, ideally, if the same driver is available in the newer kernel? Or any other workaround.

What I found is that the GobiSerial driver module is dependent on kernel driver usbserial. In a standard RPI (NOOBS) distribution kernel the usbserial is not inserted by default. Based on this hypothesis, I did a grep on the Kernel symbols and tried to ceck the missing symbols, but couldn’t see any:
pi@raspberrypi:~ cat /proc/kallsyms | grep -i "usb_serial_generic_open" pi@raspberrypi:~

Nothing was returned from the above command. Clearly the symbols are missing. Then I noticed when we insert the device into the RPI usb slot, the usbserial driver is dynamically inserted for the first time into the running linux kernel and then after it stays there.

So following this observation, next I inserted the device into the USB slot of the RPI. Noticed the dmesg:

[ 261.805832] usbserial: USB Serial support registered for generic
[ 261.806590] usbcore: registered new interface driver cdc_wdm
[ 261.814689] usbcore: registered new interface driver qcserial
[ 261.814756] usbserial: USB Serial support registered for Qualcomm USB modem

and did a grep again:

pi@raspberrypi:~ $ cat /proc/kallsyms | grep -i “usb_serial_generic_open”
00000000 r __ksymtab_usb_serial_generic_open [usbserial]
00000000 r __kstrtab_usb_serial_generic_open [usbserial]
00000000 t usb_serial_generic_open [usbserial]

Now, tried insmod-ing the GobiSerial again and it worked this time. So the key is to have the device attached to the RPI and then try to insmod the Gobi drivers.

pi@raspberrypi:~ sudo insmod GobiSerial.ko pi@raspberrypi:~ dmesg

[ 326.647915] usbserial: USB Serial support registered for GobiSerial
[ 326.647943] GobiSerial: 2019-11-22/SWI_2.39:GobiSerial

Soon I realized that attaching the device to the RPI hw is actually insmod-ing the qcserial and the qmi_wwan kernel modules which are Qualcomm drivers. As per the release notes these drivers should be blacklisted in:
/etc/modprobe.d/blacklist-modem.conf .

pi@raspberrypi:~ $ cat /etc/modprobe.d/blacklist-modem.conf
blacklist qcserial
blacklist qmi_wwan

Once I do that and restart the system my resolution to the problem stops working. Actually qcserial driver is loading the usbserial and once you take the qcserial out of the equation, it all stops working again.

So finally what I did was to:
sudo insmod /lib/modules/4.19.75-v7+/kernel/drivers/usb/serial/usbserial.ko

and then

sudo insmod GobiSerial.ko

and it works fine.

I wast wanted to pass by someone who understands the Gobi drivers better than me. Is this how it should be? Obviously I can find a way to automate the insertion of the usbserial and the GobiSerial but otherwise is this how it should work?

Thanks for your time in sorting this out.

Thanks and regards,
Vivek

@vivek.bhadra,

Generically speaking everything looks fine.

So GobiSerial does require the usbserial kernel module as well. After copying GobiSerial.ko to /lib/modules/4.19.75-v7+/kernel/drivers/usb/serial/, the developer needs to run “depmod” on the CLI to update the modules dependence. Otherwise modprobe GobiSerial might not load usbserial automatically.

Note: You should do “modprobe usbserial” before manual insert GobiSerial module.

Regards

Matt

1 Like