QUECTEL PCIe mhi driver

failed to build on linux kernel 6.12:

make -C “/home/yoki/others/src/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-6.12.34” ARCH=“x86” CROSS_COMPILE=“x86_64-openwrt-linux-musl-” CXXFLAGS=“-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/home/yoki/others/src/openwrt/build_dir/target-x86_64_musl/linux-x86_64/pcie_mhi-1.3.8=pcie_mhi-1.3.8 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro” M=“/home/yoki/others/src/openwrt/build_dir/target-x86_64_musl/linux-x86_64/pcie_mhi-1.3.8” modules
make[4]: Entering directory ‘/home/yoki/others/src/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-6.12.34’
CC [M] /home/yoki/others/src/openwrt/build_dir/target-x86_64_musl/linux-x86_64/pcie_mhi-1.3.8/core/mhi_init.o
CC [M] /home/yoki/others/src/openwrt/build_dir/target-x86_64_musl/linux-x86_64/pcie_mhi-1.3.8/core/mhi_main.o
/home/yoki/others/src/openwrt/build_dir/target-x86_64_musl/linux-x86_64/pcie_mhi-1.3.8/core/mhi_main.c:294:12: error: no previous prototype for ‘mhi_to_physical’ [-Werror=missing-prototypes]
294 | dma_addr_t mhi_to_physical(struct mhi_ring *ring, void *addr)
| ^~~~~~~~~~~~~~~
/home/yoki/others/src/openwrt/build_dir/target-x86_64_musl/linux-x86_64/pcie_mhi-1.3.8/core/mhi_main.c:2590:5: error: no previous prototype for ‘mhi_get_remote_time’ [-Werror=missing-prototypes]
2590 | int mhi_get_remote_time(struct mhi_device *mhi_dev,
| ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:229: /home/yoki/others/src/openwrt/build_dir/target-x86_64_musl/linux-x86_64/pcie_mhi-1.3.8/core/mhi_main.o] Error 1
make[5]: *** [/home/yoki/others/src/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-6.12.34/Makefile:1945: /home/yoki/others/src/openwrt/build_dir/target-x86_64_musl/linux-x86_64/pcie_mhi-1.3.8] Error 2
make[4]: *** [Makefile:224: __sub-make] Error 2
make[4]: Leaving directory ‘/home/yoki/others/src/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-6.12.34’
make[3]: *** [Makefile:50: /home/yoki/others/src/openwrt/build_dir/target-x86_64_musl/linux-x86_64/pcie_mhi-1.3.8/.built] Error 2
make[3]: Leaving directory ‘/home/yoki/others/src/openwrt/package/quectel_MHI’
time: package/quectel_MHI/compile#1.74#0.65#2.37
ERROR: package/quectel_MHI failed to build.
make[2]: *** [package/Makefile:183: package/quectel_MHI/compile] Error 1
make[2]: Leaving directory ‘/home/yoki/others/src/openwrt’
make[1]: *** [package/Makefile:177: /home/yoki/others/src/openwrt/staging_dir/target-x86_64_musl/stamp/.package_compile] Error 2

More errors:

yoki@Router:~/others/src/Quectel_QConnectManager_Linux$ make 
rm -rf *.o libmnl/*.o quectel-CM quectel-atc-proxy
gcc -Wall -Wextra -Werror -O1  quectel-atc-proxy.c atchannel.c at_tok.c util.c -o quectel-atc-proxy -lpthread -ldl -lrt 
gcc -Wall -Wextra -Werror -O1  main.c   util.c  device.c atc.c atchannel.c at_tok.c udhcpc.c -o quectel-CM -lpthread -ldl -lrt
In file included from /usr/include/features.h:502,
                 from /usr/include/unistd.h:25,
                 from device.c:19:
In function ‘read’,
    inlined from ‘catch_log’ at device.c:699:18:
/usr/include/x86_64-linux-gnu/bits/unistd.h:28:10: error: ‘__read_alias’ specified size between 9223372036854776097 and 18446744073709551614 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
   28 |   return __glibc_fortify (read, __nbytes, sizeof (char),
      |          ^~~~~~~~~~~~~~~
device.c: In function ‘catch_log’:
device.c:692:10: note: destination object allocated here
  692 |     char tbuff[256+32];
      |          ^~~~~
/usr/include/x86_64-linux-gnu/bits/unistd-decl.h:29:16: note: in a call to function ‘__read_alias’ declared with attribute ‘access (write_only, 2, 3)’
   29 | extern ssize_t __REDIRECT_FORTIFY (__read_alias, (int __fd, void *__buf,
      |                ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
atc.c: In function ‘atc_init’:
atc.c:100:13: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  100 |             asprintf(&cmd, "AT+QCFG=\"NAT\",%d", new_nat);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
atc.c: In function ‘requestGetIPAddress’:
atc.c:816:5: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  816 |     asprintf(&cmd, "AT+CGPADDR=%d", profile->pdp);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
atc.c: In function ‘at_netdevstatus’:
atc.c:684:5: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  684 |     asprintf(&cmd, "AT+QNETDEVSTATUS=%d", pdp);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
atc.c: In function ‘requestDeactivateDefaultPDP’:
atc.c:790:9: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  790 |         asprintf(&cmd, "AT+QNETDEVCTL=0,%d,%d", pdp, 0);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
atc.c:792:9: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  792 |         asprintf(&cmd, "AT+QNETDEVCTL=%d,0,%d", pdp, 0);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
atc.c: In function ‘requestSetupDataCall’:
atc.c:600:9: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  600 |         asprintf(&cmd, "ifconfig %s up", profile->usbnet_adapter);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
atc.c:623:13: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  623 |             asprintf(&cmd, "AT+CGACT=1,%d", pdp);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
atc.c:632:9: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  632 |         asprintf(&cmd, "AT+QNETDEVCTL=1,%d,%d", pdp, 1);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
atc.c:634:9: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  634 |         asprintf(&cmd, "AT+QNETDEVCTL=%d,1,%d", pdp, 1);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
atc.c:645:13: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  645 |             asprintf(&cmd, "AT+QNETDEVSTATUS=%d", pdp);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
atc.c: In function ‘requestGetProfile’:
atc.c:406:5: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  406 |     asprintf(&cmd, "AT+QICSGP=%d", profile->pdp);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
atc.c:412:9: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  412 |         asprintf(&cmd, "AT+QICSGP=%d,%d,\"\",\"\",\"\",0", profile->pdp, profile->iptype);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
atc.c: In function ‘requestSetProfile’:
atc.c:372:5: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  372 |     asprintf(&cmd, "AT+QICSGP=%d,%d,\"%s\",\"%s\",\"%s\",%d",
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  373 |         profile->pdp, profile->iptype, new_apn, new_user, new_pd, profile->auth);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
atc.c:378:9: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  378 |         asprintf(&cmd, "AT+CGDCONT=%d,\"%s\",\"%s\"", profile->pdp, ipStr[profile->iptype], new_apn);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
atc.c: In function ‘requestEnterSimPin’:
atc.c:338:5: error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  338 |     asprintf(&cmd, "AT+CPIN=%s", pPinCode);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:28:release] ERROR 1

Hi,@Anonymous01
Perhaps your Ubuntu version and GCC tools are too new, which results in the fact that a lot of code is not compatible with the compilation requirements of the new versions of the tools. Could you try downgrading your Ubuntu version and the versions of the tools and then give it another shot?

Hi,@Matthew_Stelmach
Sorry, I didn’t understand what you meant. Do you plan to install the PCIE mhi driver on Ubuntu 24?

Hi, did you get PCIe driver? I need to get it working on Raspberry PI 5 with OS 6.12.38-v8-16k+

Hi,@hunter
I have sent to you via email,pls check.

Hello @leon.bao , Can you share these driver?

  • Quectel_Linux_PCIE_MHI_Driver(ver1.3.8/9)
  • Quectel_Linux&Android_QMI_WWAN_Driver

Thank You.

Hi,@hideyuki
I have sent to you via private message,pls check.

Leon,
Can you also send me the latest PCIE MHI linux drivers for the RM520N-GL? Thanks in advance!

Drew

Hi, @leon.bao
I am using a home lab server plugged into a RM520N-GL and I need the latest version of the MHI driver and firmware please share with me thanks a lot and God bless you

Hi,@dreww
I have sent to you via email,pls check.

Hi,@Larry_Huang
I have sent to you via email,pls check.

@leon.bao hi, leon.bao. I checked my mailbox. Unfortunately, I did not receive the driver code. Could you please send it to me again via email or in-site message? Thanks a lot.

Hi,@dreww
I have resent it via private message. Please check and receive it.

Hi,@Larry_Huang
I have resent it via private message. Please check and receive it.

Hi @leon.bao,

Could you send me the latest version of the qmi_wwan_q driver?
What is the latest version of the Linux kernel compatible with this driver?

Thanks a lot.
Augustin

Hi,@Jayddy
I have sent to you via private message,pls check.

Thank you very much, I have received the driver.
What is the latest version of the Linux kernel compatible with this driver?

Best regards,
Augustin

Hi,@Jayddy
Please check the release notes in the file.

@leon.bao Hi Leon,
Can you send me the latest versions of quectel-cm and mhi_pcie driver?
Thanks!