Installing 4G module drivers


I just installed OpenWRT on a new x86 machine, and I am trying to install some drivers I got from Quectel for the module EM160R-GL to work in PCIe mode.

I installed make, but when I run the command make or make install I get:

root@OpenWrt:~/pcie# make
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/4.14.167/build M=/root/pcie clean
make[1]: *** /lib/modules/4.14.167/build: No such file or directory.  Stop.
make: *** [Makefile:29: clean] Error 2

I am not sure why this isn't working, am I missing some package I should have installed?

The driver code is here:

Openwrt isn't made for compiling, nor are you supposed to use root as user when compiling.

4.14.167 kernel, which openwrt version did you install?

Thanks for the reply, I installed openwrt-19.07.1-x86-64-combined-squashfs.

What would you suggest be my best approach to get his driver working?

A Linux dist, some however work better than others.

I tried Ubuntu and Debian, but both had major issues once the driver was installed, the systems were not able to boot anymore.

I looked deeper into the driver and it seems it was originally written to work on OpenWRT, as are the examples in the documentation run on OpenWRT.

Do you know did he get it to run on OpenWRT?

Most hw vendors use older versions of openwrt than 19.07.

Or does it specifically say it's supposed to run on 19.07?

What happens in you try to modprobe your module?

There's a bunch of threads about this module here, search for em160r.

Actually, it doesn't say anything about the version, I will try older versions, thanks.

Unfourtently, all the topics discuss how to get it to work in USB, which I was already able to do quite easily, I am trying to get it to work in PCIe mode, for which I did not find even a single piece of information online.

Are you sure it works in pcie mode?

Is it detected in dmesg, and listed by lspci?

It's listed as supported on the goldenorb rooter firmware:

They do have x86 firmware versions, so you could try this and then work out if you can make it back to official openwrt.

1 Like

Not in PCIe mode, it works in USB mode, and yes I am 100% sure, it is listed in lsusb, it brings up an interface, and I can ping the internet.

Thanks, I am almost sure that too is the USB version, not the PCIe version, but I will give it a try!
I can find any x86 images on their website, can you please point me in the right direction?

Link above for x86 and x86_64 uefi and generic versions.

Hopefully it works in pcie mbim mode as my em12g does.

1 Like

Those instructions assume you have built a custom image and have /lib/modules/kernelversionhere/build pointing to the kernel's build directory/headers. OpenWRT is meant for resource-constrained embedded devices, so it doesn't ship with the kernel's sources or headers.

If you want it compiled, you'll need to build a complete custom image.

That is amazing news to hear that it works for you on em12, they are very similar modems, so I have some hope now.

I installed rooter, and the modem is detected in USB mode by default, but when I issue AT+QCFG="data_interface",1,0 to turn the modem into PCIe mode, I get an unknown device:
06:00.0 Unassigned class [ff00]: Device 1eac:1002 (rev ff).

Did you take any special steps or did it work out of the box for you?

Colour me confused, but according to @Dairyman there is no support for any PCI modem in ROOter (yet):

I would not fight with any code from Quectel (or any other vendor) unless they provide

  1. working code, and
  2. support

That's the only valid reasons to ever consider using out-of-tree code IMHO. If you don't get both, then it's just not worth the effort.

The PCIe EM160R-GL is supported in Linux mainline since commit ac4bf60bbaa0 ("bus: mhi: pci_generic: Introduce quectel EM1XXGR-L support"). This commit is in v5.13 and later. The drivers are also available as a package in OpenWrt master (for targets with v5.15 support). You don't need to use any Quectel code.

If you need this on a target where v5.15 isn't yet available, then you have two options which both seems a lot easier than getting some quectel driver to build on a 5 year old kernel:

  1. move your target to v5.15, or
  2. backport the drivers to v5.10

@bmork Thanks for the detailed response!

Hmm, that is weird, since I did try it on Ubuntu 21.10 which I believe is v5.13 (maybe v5.14) and had the exact same issue.

I am sorry, this may be a noob question, do you mean I need to manually install the latest OpenWrt version and then upgrade the kernel to v5.15 and then install the package using opkg?

Can you please point me to the package name/repo?

Thanks a lot!

Maybe there is something else wrong too? Do you see the modem with lspci? If it doesn't show up on the bus, then there is nothing a driver can do.

See package/kernel/linux/modules/ in the base repo:

define KernelPackage/mhi-bus
  TITLE:=MHI bus
  AUTOLOAD:=$(call AutoProbe,mhi)

define KernelPackage/mhi-bus/description
  Kernel module for the Qualcomm MHI bus.

$(eval $(call KernelPackage,mhi-bus))

define KernelPackage/mhi-pci-generic
  TITLE:=MHI PCI controller driver
  DEPENDS:=@LINUX_5_15 +kmod-mhi-bus
  AUTOLOAD:=$(call AutoProbe,mhi_pci_generic)

define KernelPackage/mhi-pci-generic/description
  Kernel module for the MHI PCI controller driver.

$(eval $(call KernelPackage,mhi-pci-generic))