Installing kernel modules for LTE modem

Hi all,

I’m currently trying to set up a Quectel EC20 LTE module to work with a TX2. I’m following the instructions in this PDF from Quectel:
https://we.tl/Wc675dItLm

I was informed by Quectel that I should use the QMI-WWAN driver. Therefore in summary I am doing the following:

  1. Downloading the kernel source files to the TX2 using the getKernelSources script here:
    GitHub - jetsonhacks/buildJetsonTX2Kernel: Build the NVIDIA Jetson TX2 Kernel on the device itself

  2. Editing (According to the instructions in the document) the files:
    [KERNEL]/drivers/usb/serial/option.c
    [KERNEL]/drivers/usb/serial/qcserial.c
    [KERNEL]/drivers/net/usb/qmi_wwan.c
    [KERNEL]/drivers/usb/serial/usb_wwan.c

  3. In the kernel config editor, enabling (to be added a module):
    USB driver for GSM and CDMA modems

  4. If I try to run the first make command from the Quectel pdf doc (sudo make -C /lib/modules/uname -r/build M=pwd/drivers/usb/serial obj-m=option.o modules) I get the message:

nvidia@tegra-ubuntu:/usr/src/kernel/kernel-4.4$ sudo make -C /lib/modules/uname -r/build M=pwd/drivers/usb/serial obj-m=option.o modules
make: Entering directory ‘/usr/src/linux-headers-4.4.38-tegra’
CC [M] /usr/src/kernel/kernel-4.4/drivers/usb/serial/option.o
scripts/basic/fixdep: 1: scripts/basic/fixdep: Syntax error: “(” unexpected
scripts/Makefile.build:267: recipe for target ‘/usr/src/kernel/kernel-4.4/drivers/usb/serial/option.o’ failed
make[1]: *** [/usr/src/kernel/kernel-4.4/drivers/usb/serial/option.o] Error 2
Makefile:1414: recipe for target ‘module/usr/src/kernel/kernel-4.4/drivers/usb/serial’ failed
make: *** [module/usr/src/kernel/kernel-4.4/drivers/usb/serial] Error 2
make: Leaving directory ‘/usr/src/linux-headers-4.4.38-tegra’

Can anyone explain why this isn’t working?

I have tried various other things - including using the makeKernel script from the JetsonHacks page above: but I’d rather walk through things one at a time to try to isolate the issue.

Cheers

Seems like you have a syntax error in a required build script. Fix the script!

Just a few things to check…don’t know if this applies to your case.

If you are building against a full source tree make sure your tree is starting with a config matching the running system (e.g., copy the “/proc/config.gz”, gunzip it, and rename it as “.config”).

Make sure any code changes were meant for a 4.x series kernel…if your source is from a 3.x series it probably won’t work.

Be sure you actually have directory ‘/usr/src/linux-headers-4.4.38-tegra’.

Yeah I spent quite a while looking for syntax errors, particularly in the .c files I modified according to the Quectel instructions. But there are no syntax errors anywhere - and furthermore I found people with similar issues elsewhere:

In the scripts that I’m using from jetsonHacks (linked in the OP) the build process actually uses a different set of commands. This is the method in the Quectel manual:

sudo make -C /lib/modules/uname -r/build M=pwd/drivers/usb/serial obj-m=option.o modules

And this is the method in the scripts from jetsonHacks:

make prepare
make modules_prepare
make -j6 Image
make modules
make modules_install

So I’m wondering - what’s the difference between these approaches?

The jetsonHacks scrips copies the config file as its first step after downloading the kernel source:

wget -N http://developer.download.nvidia.com/embedded/L4T/r28_Release_v2.0/BSP/source_release.tbz2
echo ‘Extracting kernel_src.tbz2 from source release’
tar -xvf source_release.tbz2 public_release/kernel_src.tbz2
echo ‘Expanding kernel_src.tbz2’
tar -xvf public_release/kernel_src.tbz2
rm -r public_release
cd kernel/kernel-4.4
zcat /proc/config.gz > .config

Ready to configure kernel

make xconfig

Also I do have the header files folder linux-headers-4.4.38-tegra

So I’m trying a different approach now:

  1. In the kernel config editor, enabling (to be added a module):
    -USB driver for GSM and CDMA modems
    -QMI WWAN driver for Qualcomm MSM based 3G and LTE modems

  2. Editing (According to the instructions in the Quectel document) the files:
    usr/src/kernel/kernel-4.4/drivers/usb/serial/option.c
    usr/src/kernel/kernel-4.4/drivers/usb/serial/qcserial.c
    usr/src/kernel/kernel-4.4/drivers/net/usb/qmi_wwan.c
    usr/src/kernel/kernel-4.4/drivers/usb/serial/usb_wwan.c

  3. Running makeKernel.sh which does the following:

#!/bin/bash

Builds the kernel and modules

Assumes that the .config file is available

cd /usr/src/kernel/kernel-4.4
make prepare
make modules_prepare

Make alone will build the dts files too

make -j6

make -j6 Image
make modules
make modules_install

This runs fine (unlike the make commands in my OP from the Quectel document).

I have checked that there are new object files in /usr/src/kernel/drivers and confirm that the following files are modified:
drivers/usb/serial/option.o
drivers/net/usb/qmi_wwan.o
drivers/usb/serial/usb_wwan.o

However, the file drivers/usb/serial/qcserial.o does not exist.

  1. I then run copyImage.sh, reboot and plug in the device. Running lsusb shows the device as:
    05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless Modem

This is one of the device IDs that I totally removed from the .c files according to the Qualcomm instructions, so if the modules are really being replaced I don’t see how this can be.

My next attempt involved going back into the kernel config editor, and this time also selecting the module Device Drivers>Usb support > USB serial converter suport > sub Qualcomm serial modem : since I believe that this one is linked with qcserial.c.

I then re-ran makeKernel.sh and copyImage.sh
(it ran super fast so I guess it didn’t compile very much stuff this time).
This time there are all 4 files present in the /lib/modules/4.4.38-tegra… directories.
After a reboot the device is still detected as:
05c6:9215 Qualcomm, Inc. Acer Gobi 2000 Wireless Modem

I cannot understand how removing every reference to this device from the module sources, compiling them and installing them does not have any effect.

Is there some way I can confirm that modules have been re-loaded? Is there something I should be doing to manually load a module in place of its previous version?

Thanks again for any advice.

Hi Daniel,
The files at: GitHub - jetsonhacks/buildJetsonTX2Kernel: Build the NVIDIA Jetson TX2 Kernel on the device itself have recently been updated. Please update them, to see if that helps.

I believe that lsusb returns a report from the device firmware, it does not look to the kernel for that information. In other words, you plug in the Modem, there is the ID which is the manufacturer:model, and then a string that describes the device. In this case, 0x05c6 is Qualcomm, 0x9215 is the product (the modem). Note that this does not tell you which driver is loaded for the device.

$ lsusb -t

should tell you which driver is loaded, the Bus and Device are the keys which you get from lsusb. There’s probably a more clever way to figure it out.

It is difficult to tell which module qcserial actually belongs. My initial guess would be that there is still one missing kernel config that is needed.

Does anyone know if the kernel update described here (GitHub - jetsonhacks/buildJetsonTX2Kernel: Build the NVIDIA Jetson TX2 Kernel on the device itself) would also apply to the TX1 with this build

NVIDIA Jetson TX1
L4T 28.2.0 [ JetPack 3.2 ]
Board: t210ref
Ubuntu 16.04.4 LTS
Kernel Version: 4.4.38-tegra
CUDA 9.0.252

regards, h

Hi daniel,

Are you done this process successfully?