20240502给NanoPi的NEO core开发板编译移远的4G模块的上网程序quectel-CM

20240502给NanoPi的NEO core开发板编译移远的4G模块的上网程序quectel-CM
2024/5/2 16:29


1、默认编译为AMD64/INTEL的x64架构的可执行文件:
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ unzip Quectel_QConnectManager_Linux_V1.6.5.1.zip 
Archive:  Quectel_QConnectManager_Linux_V1.6.5.1.zip


rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~$ cd quectel-CM/
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ ll
total 896
drwxrwxr-x  4 rootroot rootroot   4096 1月  22 11:06 ./
drwxr-xr-x 40 rootroot rootroot   4096 5月   2 16:02 ../
-rw-rw-r--  1 rootroot rootroot  33837 1月  15 10:21 atc.c
-rw-rw-r--  1 rootroot rootroot  25544 1月  15 10:21 atchannel.c
-rw-rw-r--  1 rootroot rootroot   5124 1月  15 10:21 atchannel.h
-rw-rw-r--  1 rootroot rootroot   5612 1月  15 10:21 at_tok.c
-rw-rw-r--  1 rootroot rootroot   1072 1月  15 10:21 at_tok.h
-rw-rw-r--  1 rootroot rootroot   1237 1月  15 10:21 CMakeLists.txt
-rw-rw-r--  1 rootroot rootroot   1408 1月  15 10:21 configure.ac
-rw-rw-r--  1 rootroot rootroot   1293 1月  15 10:21 default.script
-rw-rw-r--  1 rootroot rootroot   1221 1月  15 10:21 default.script_ip
-rw-rw-r--  1 rootroot rootroot  22875 1月  15 10:21 device.c
-rw-rw-r--  1 rootroot rootroot  40995 1月  15 10:21 ethtool-copy.h
-rw-rw-r--  1 rootroot rootroot   8678 1月  15 10:21 GobiNetCM.c
drwxrwxr-x  3 rootroot rootroot   4096 1月  15 10:21 log/
-rw-rw-r--  1 rootroot rootroot  36466 1月  22 11:00 main.c
-rw-rw-r--  1 rootroot rootroot   1706 1月  22 11:06 Makefile
-rw-rw-r--  1 rootroot rootroot    639 1月  15 10:21 Makefile.am
-rw-rw-r--  1 rootroot rootroot  90446 1月  15 10:21 mbim-cm.c
-rw-rw-r--  1 rootroot rootroot    449 1月  15 10:21 NOTICE
drwxrwxr-x  2 rootroot rootroot   4096 1月  22 11:07 out/
-rw-rw-r--  1 rootroot rootroot  14221 1月  15 10:21 QCQCTL.h
-rw-rw-r--  1 rootroot rootroot   9495 1月  15 10:21 QCQMI.h
-rw-rw-r--  1 rootroot rootroot  22506 1月  15 10:21 QCQMUX.c
-rw-rw-r--  1 rootroot rootroot 140524 1月  15 10:21 QCQMUX.h
-rw-rw-r--  1 rootroot rootroot   1498 1月  15 10:21 qendian.h
-rw-rw-r--  1 rootroot rootroot    896 1月  15 10:21 qlist.h
-rw-rw-r--  1 rootroot rootroot  15291 1月  15 10:21 qmap_bridge_mode.c
-rw-rw-r--  1 rootroot rootroot 121844 1月  15 10:21 QMIThread.c
-rw-rw-r--  1 rootroot rootroot  13521 1月  15 10:21 QMIThread.h
-rw-rw-r--  1 rootroot rootroot  16988 1月  15 10:21 QmiWwanCM.c
-rw-rw-r--  1 rootroot rootroot  19416 1月  15 10:21 qrtr.c
-rw-rw-r--  1 rootroot rootroot   1256 1月  15 10:21 qrtr.h
-rw-rw-r--  1 rootroot rootroot  15971 1月  15 10:21 quectel-atc-proxy.c
-rw-rw-r--  1 rootroot rootroot  13989 1月  15 10:21 quectel-mbim-proxy.c
-rw-rw-r--  1 rootroot rootroot  24012 1月  15 10:21 quectel-qmi-proxy.c
-rw-rw-r--  1 rootroot rootroot  30664 1月  15 10:21 quectel-qrtr-proxy.c
-rw-rw-r--  1 rootroot rootroot   9350 1月  22 11:06 ReleaseNote.txt
-rw-rw-r--  1 rootroot rootroot   9974 1月  15 10:21 rmnetctl.c
-rw-rw-r--  1 rootroot rootroot  23841 1月  15 10:21 udhcpc.c
-rw-rw-r--  1 rootroot rootroot   5472 1月  15 10:21 udhcpc_netlink.c
-rw-rw-r--  1 rootroot rootroot   4065 1月  15 10:21 udhcpc_script.c
-rw-rw-r--  1 rootroot rootroot  10201 1月  15 10:21 util.c
-rw-rw-r--  1 rootroot rootroot   1285 1月  15 10:21 util.h
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ cd out/
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM/out$ ll
total 8
drwxrwxr-x 2 rootroot rootroot 4096 1月  22 11:07 ./
drwxrwxr-x 4 rootroot rootroot 4096 1月  22 11:06 ../
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM/out$ cd ..
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ ll
total 896
drwxrwxr-x  4 rootroot rootroot   4096 1月  22 11:06 ./
drwxr-xr-x 40 rootroot rootroot   4096 5月   2 16:02 ../
-rw-rw-r--  1 rootroot rootroot  33837 1月  15 10:21 atc.c
-rw-rw-r--  1 rootroot rootroot  25544 1月  15 10:21 atchannel.c
-rw-rw-r--  1 rootroot rootroot   5124 1月  15 10:21 atchannel.h
-rw-rw-r--  1 rootroot rootroot   5612 1月  15 10:21 at_tok.c
-rw-rw-r--  1 rootroot rootroot   1072 1月  15 10:21 at_tok.h
-rw-rw-r--  1 rootroot rootroot   1237 1月  15 10:21 CMakeLists.txt
-rw-rw-r--  1 rootroot rootroot   1408 1月  15 10:21 configure.ac
-rw-rw-r--  1 rootroot rootroot   1293 1月  15 10:21 default.script
-rw-rw-r--  1 rootroot rootroot   1221 1月  15 10:21 default.script_ip
-rw-rw-r--  1 rootroot rootroot  22875 1月  15 10:21 device.c
-rw-rw-r--  1 rootroot rootroot  40995 1月  15 10:21 ethtool-copy.h
-rw-rw-r--  1 rootroot rootroot   8678 1月  15 10:21 GobiNetCM.c
drwxrwxr-x  3 rootroot rootroot   4096 1月  15 10:21 log/
-rw-rw-r--  1 rootroot rootroot  36466 1月  22 11:00 main.c
-rw-rw-r--  1 rootroot rootroot   1706 1月  22 11:06 Makefile
-rw-rw-r--  1 rootroot rootroot    639 1月  15 10:21 Makefile.am
-rw-rw-r--  1 rootroot rootroot  90446 1月  15 10:21 mbim-cm.c
-rw-rw-r--  1 rootroot rootroot    449 1月  15 10:21 NOTICE
drwxrwxr-x  2 rootroot rootroot   4096 1月  22 11:07 out/
-rw-rw-r--  1 rootroot rootroot  14221 1月  15 10:21 QCQCTL.h
-rw-rw-r--  1 rootroot rootroot   9495 1月  15 10:21 QCQMI.h
-rw-rw-r--  1 rootroot rootroot  22506 1月  15 10:21 QCQMUX.c
-rw-rw-r--  1 rootroot rootroot 140524 1月  15 10:21 QCQMUX.h
-rw-rw-r--  1 rootroot rootroot   1498 1月  15 10:21 qendian.h
-rw-rw-r--  1 rootroot rootroot    896 1月  15 10:21 qlist.h
-rw-rw-r--  1 rootroot rootroot  15291 1月  15 10:21 qmap_bridge_mode.c
-rw-rw-r--  1 rootroot rootroot 121844 1月  15 10:21 QMIThread.c
-rw-rw-r--  1 rootroot rootroot  13521 1月  15 10:21 QMIThread.h
-rw-rw-r--  1 rootroot rootroot  16988 1月  15 10:21 QmiWwanCM.c
-rw-rw-r--  1 rootroot rootroot  19416 1月  15 10:21 qrtr.c
-rw-rw-r--  1 rootroot rootroot   1256 1月  15 10:21 qrtr.h
-rw-rw-r--  1 rootroot rootroot  15971 1月  15 10:21 quectel-atc-proxy.c
-rw-rw-r--  1 rootroot rootroot  13989 1月  15 10:21 quectel-mbim-proxy.c
-rw-rw-r--  1 rootroot rootroot  24012 1月  15 10:21 quectel-qmi-proxy.c
-rw-rw-r--  1 rootroot rootroot  30664 1月  15 10:21 quectel-qrtr-proxy.c
-rw-rw-r--  1 rootroot rootroot   9350 1月  22 11:06 ReleaseNote.txt
-rw-rw-r--  1 rootroot rootroot   9974 1月  15 10:21 rmnetctl.c
-rw-rw-r--  1 rootroot rootroot  23841 1月  15 10:21 udhcpc.c
-rw-rw-r--  1 rootroot rootroot   5472 1月  15 10:21 udhcpc_netlink.c
-rw-rw-r--  1 rootroot rootroot   4065 1月  15 10:21 udhcpc_script.c
-rw-rw-r--  1 rootroot rootroot  10201 1月  15 10:21 util.c
-rw-rw-r--  1 rootroot rootroot   1285 1月  15 10:21 util.h
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ make -j8
cd out/; rm -rf *.o libmnl/*.o quectel-CM quectel-qmi-proxy quectel-mbim-proxy quectel-atc-proxy
gcc -Wall -Wextra -Werror -O1  quectel-qmi-proxy.c -o out/quectel-qmi-proxy -lpthread -ldl -lrt 
gcc -Wall -Wextra -Werror -O1  quectel-mbim-proxy.c -o out/quectel-mbim-proxy -lpthread -ldl -lrt 
gcc -Wall -Wextra -Werror -O1  quectel-atc-proxy.c atchannel.c at_tok.c util.c -o out/quectel-atc-proxy -lpthread -ldl -lrt 
gcc -Wall -Wextra -Werror -O1  QmiWwanCM.c GobiNetCM.c main.c QCQMUX.c QMIThread.c util.c qmap_bridge_mode.c mbim-cm.c device.c atc.c atchannel.c at_tok.c udhcpc.c -o out/quectel-CM -lpthread -ldl -lrt

rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ ll
total 896
drwxrwxr-x  4 rootroot rootroot   4096 1月  22 11:06 ./
drwxr-xr-x 40 rootroot rootroot   4096 5月   2 16:02 ../
-rw-rw-r--  1 rootroot rootroot  33837 1月  15 10:21 atc.c
-rw-rw-r--  1 rootroot rootroot  25544 1月  15 10:21 atchannel.c
-rw-rw-r--  1 rootroot rootroot   5124 1月  15 10:21 atchannel.h
-rw-rw-r--  1 rootroot rootroot   5612 1月  15 10:21 at_tok.c
-rw-rw-r--  1 rootroot rootroot   1072 1月  15 10:21 at_tok.h
-rw-rw-r--  1 rootroot rootroot   1237 1月  15 10:21 CMakeLists.txt
-rw-rw-r--  1 rootroot rootroot   1408 1月  15 10:21 configure.ac
-rw-rw-r--  1 rootroot rootroot   1293 1月  15 10:21 default.script
-rw-rw-r--  1 rootroot rootroot   1221 1月  15 10:21 default.script_ip
-rw-rw-r--  1 rootroot rootroot  22875 1月  15 10:21 device.c
-rw-rw-r--  1 rootroot rootroot  40995 1月  15 10:21 ethtool-copy.h
-rw-rw-r--  1 rootroot rootroot   8678 1月  15 10:21 GobiNetCM.c
drwxrwxr-x  3 rootroot rootroot   4096 1月  15 10:21 log/
-rw-rw-r--  1 rootroot rootroot  36466 1月  22 11:00 main.c
-rw-rw-r--  1 rootroot rootroot   1706 1月  22 11:06 Makefile
-rw-rw-r--  1 rootroot rootroot    639 1月  15 10:21 Makefile.am
-rw-rw-r--  1 rootroot rootroot  90446 1月  15 10:21 mbim-cm.c
-rw-rw-r--  1 rootroot rootroot    449 1月  15 10:21 NOTICE
drwxrwxr-x  2 rootroot rootroot   4096 5月   2 16:02 out/
-rw-rw-r--  1 rootroot rootroot  14221 1月  15 10:21 QCQCTL.h
-rw-rw-r--  1 rootroot rootroot   9495 1月  15 10:21 QCQMI.h
-rw-rw-r--  1 rootroot rootroot  22506 1月  15 10:21 QCQMUX.c
-rw-rw-r--  1 rootroot rootroot 140524 1月  15 10:21 QCQMUX.h
-rw-rw-r--  1 rootroot rootroot   1498 1月  15 10:21 qendian.h
-rw-rw-r--  1 rootroot rootroot    896 1月  15 10:21 qlist.h
-rw-rw-r--  1 rootroot rootroot  15291 1月  15 10:21 qmap_bridge_mode.c
-rw-rw-r--  1 rootroot rootroot 121844 1月  15 10:21 QMIThread.c
-rw-rw-r--  1 rootroot rootroot  13521 1月  15 10:21 QMIThread.h
-rw-rw-r--  1 rootroot rootroot  16988 1月  15 10:21 QmiWwanCM.c
-rw-rw-r--  1 rootroot rootroot  19416 1月  15 10:21 qrtr.c
-rw-rw-r--  1 rootroot rootroot   1256 1月  15 10:21 qrtr.h
-rw-rw-r--  1 rootroot rootroot  15971 1月  15 10:21 quectel-atc-proxy.c
-rw-rw-r--  1 rootroot rootroot  13989 1月  15 10:21 quectel-mbim-proxy.c
-rw-rw-r--  1 rootroot rootroot  24012 1月  15 10:21 quectel-qmi-proxy.c
-rw-rw-r--  1 rootroot rootroot  30664 1月  15 10:21 quectel-qrtr-proxy.c
-rw-rw-r--  1 rootroot rootroot   9350 1月  22 11:06 ReleaseNote.txt
-rw-rw-r--  1 rootroot rootroot   9974 1月  15 10:21 rmnetctl.c
-rw-rw-r--  1 rootroot rootroot  23841 1月  15 10:21 udhcpc.c
-rw-rw-r--  1 rootroot rootroot   5472 1月  15 10:21 udhcpc_netlink.c
-rw-rw-r--  1 rootroot rootroot   4065 1月  15 10:21 udhcpc_script.c
-rw-rw-r--  1 rootroot rootroot  10201 1月  15 10:21 util.c
-rw-rw-r--  1 rootroot rootroot   1285 1月  15 10:21 util.h
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ cd out/
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM/out$ ll
total 328
drwxrwxr-x 2 rootroot rootroot   4096 5月   2 16:02 ./
drwxrwxr-x 4 rootroot rootroot   4096 1月  22 11:06 ../
-rwxrwxr-x 1 rootroot rootroot  48320 5月   2 16:02 quectel-atc-proxy*
-rwxrwxr-x 1 rootroot rootroot 228816 5月   2 16:02 quectel-CM*
-rwxrwxr-x 1 rootroot rootroot  22368 5月   2 16:02 quectel-mbim-proxy*
-rwxrwxr-x 1 rootroot rootroot  23336 5月   2 16:02 quectel-qmi-proxy*
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM/out$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM/out$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM/out$ file quectel-CM 
quectel-CM: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=89b0fca80e86f63fb1ee4f9d807584499c0a1aca, for GNU/Linux 3.2.0, not stripped
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM/out$ 

rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM/out$ ll
total 328
drwxrwxr-x 2 rootroot rootroot   4096 5月   2 16:02 ./
drwxrwxr-x 4 rootroot rootroot   4096 1月  22 11:06 ../
-rwxrwxr-x 1 rootroot rootroot  48320 5月   2 16:02 quectel-atc-proxy*
-rwxrwxr-x 1 rootroot rootroot 228816 5月   2 16:02 quectel-CM*
-rwxrwxr-x 1 rootroot rootroot  22368 5月   2 16:02 quectel-mbim-proxy*
-rwxrwxr-x 1 rootroot rootroot  23336 5月   2 16:02 quectel-qmi-proxy*
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM/out$ cd ..
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ mv out/ x64_out/
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 


2、修改Makefile为ARM32架构:
Z:\quectel-CM\Makefile

ifneq ($(CROSS_COMPILE),)
CROSS-COMPILE:=$(CROSS_COMPILE)
endif
#CROSS-COMPILE:=/workspace/buildroot/buildroot-qemu_mips_malta_defconfig/output/host/usr/bin/mips-buildroot-linux-uclibc-
#CROSS-COMPILE:=/workspace/buildroot/buildroot-qemu_arm_vexpress_defconfig/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-
#CROSS-COMPILE:=/workspace/buildroot-git/qemu_mips64_malta/output/host/usr/bin/mips-gnu-linux-
ifeq ($(CC),cc)
CC:=$(CROSS-COMPILE)gcc
endif

LD:=$(CROSS-COMPILE)ld

修改为:

ifneq ($(CROSS_COMPILE),)
CROSS-COMPILE:=$(CROSS_COMPILE)
endif
#CROSS-COMPILE:=/workspace/buildroot/buildroot-qemu_mips_malta_defconfig/output/host/usr/bin/mips-buildroot-linux-uclibc-
#CROSS-COMPILE:=/workspace/buildroot/buildroot-qemu_arm_vexpress_defconfig/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-
#CROSS-COMPILE:=/workspace/buildroot-git/qemu_mips64_malta/output/host/usr/bin/mips-gnu-linux-
CROSS-COMPILE:=/opt/FriendlyARM/toolchain/4.9.3/bin/arm-none-linux-gnueabihf-
##ifeq ($(CC),cc)
##CC:=$(CROSS-COMPILE)gcc
##endif
CC:=/opt/FriendlyARM/toolchain/4.9.3/bin/arm-none-linux-gnueabihf-gcc

LD:=$(CROSS-COMPILE)ld


ifneq ($(CROSS_COMPILE),)
CROSS-COMPILE:=$(CROSS_COMPILE)
endif
#CROSS-COMPILE:=/workspace/buildroot/buildroot-qemu_mips_malta_defconfig/output/host/usr/bin/mips-buildroot-linux-uclibc-
#CROSS-COMPILE:=/workspace/buildroot/buildroot-qemu_arm_vexpress_defconfig/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-
#CROSS-COMPILE:=/workspace/buildroot-git/qemu_mips64_malta/output/host/usr/bin/mips-gnu-linux-

CROSS-COMPILE:=/opt/FriendlyARM/toolchain/4.9.3/bin/arm-none-linux-gnueabihf-
##ifeq ($(CC),cc)
##CC:=$(CROSS-COMPILE)gcc
##endif
CC:=/opt/FriendlyARM/toolchain/4.9.3/bin/arm-none-linux-gnueabihf-gcc

LD:=$(CROSS-COMPILE)ld

QL_CM_SRC=QmiWwanCM.c GobiNetCM.c main.c QCQMUX.c QMIThread.c util.c qmap_bridge_mode.c mbim-cm.c device.c
QL_CM_SRC+=atc.c atchannel.c at_tok.c
#QL_CM_SRC+=qrtr.c rmnetctl.c
ifeq (1,1)
QL_CM_DHCP=udhcpc.c
else
LIBMNL=libmnl/ifutils.c libmnl/attr.c libmnl/callback.c libmnl/nlmsg.c libmnl/socket.c
DHCP=libmnl/dhcp/dhcpclient.c libmnl/dhcp/dhcpmsg.c libmnl/dhcp/packet.c
QL_CM_DHCP=udhcpc_netlink.c
QL_CM_DHCP+=${LIBMNL}
endif

CFLAGS += -Wall -Wextra -Werror -O1 #-s
LDFLAGS += -lpthread -ldl -lrt

release: clean qmi-proxy mbim-proxy atc-proxy #qrtr-proxy
    $(CC) ${CFLAGS} ${QL_CM_SRC} ${QL_CM_DHCP} -o out/quectel-CM ${LDFLAGS}

debug: clean
    $(CC) ${CFLAGS} -g -DCM_DEBUG ${QL_CM_SRC} ${QL_CM_DHCP} -o out/quectel-CM -lpthread -ldl -lrt

qmi-proxy:
    $(CC) ${CFLAGS} quectel-qmi-proxy.c -o out/quectel-qmi-proxy ${LDFLAGS} 

mbim-proxy:
    $(CC) ${CFLAGS} quectel-mbim-proxy.c -o out/quectel-mbim-proxy ${LDFLAGS} 

qrtr-proxy:
    $(CC) ${CFLAGS} quectel-qrtr-proxy.c -o out/quectel-qrtr-proxy ${LDFLAGS} 

atc-proxy:
    $(CC) ${CFLAGS} quectel-atc-proxy.c atchannel.c at_tok.c util.c -o out/quectel-atc-proxy ${LDFLAGS} 

clean:
    cd out/; rm -rf *.o libmnl/*.o quectel-CM quectel-qmi-proxy quectel-mbim-proxy quectel-atc-proxy


rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ make -j8
cd out/; rm -rf *.o libmnl/*.o quectel-CM quectel-qmi-proxy quectel-mbim-proxy quectel-atc-proxy
/opt/FriendlyARM/toolchain/4.9.3/bin/arm-none-linux-gnueabihf-gcc -Wall -Wextra -Werror -O1  quectel-qmi-proxy.c -o out/quectel-qmi-proxy -lpthread -ldl -lrt 
/opt/FriendlyARM/toolchain/4.9.3/bin/arm-none-linux-gnueabihf-gcc -Wall -Wextra -Werror -O1  quectel-mbim-proxy.c -o out/quectel-mbim-proxy -lpthread -ldl -lrt 
/opt/FriendlyARM/toolchain/4.9.3/bin/arm-none-linux-gnueabihf-gcc -Wall -Wextra -Werror -O1  quectel-atc-proxy.c atchannel.c at_tok.c util.c -o out/quectel-atc-proxy -lpthread -ldl -lrt 
/opt/FriendlyARM/toolchain/4.9.3/bin/arm-none-linux-gnueabihf-gcc -Wall -Wextra -Werror -O1  QmiWwanCM.c GobiNetCM.c main.c QCQMUX.c QMIThread.c util.c qmap_bridge_mode.c mbim-cm.c device.c atc.c atchannel.c at_tok.c udhcpc.c -o out/quectel-CM -lpthread -ldl -lrt

QMIThread.c: In function ‘requestGetProfile’:
QMIThread.c:2100:9: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
         for(int i=0; i<profile_num; i++)
         ^
QMIThread.c:2100:9: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
QMIThread.c:2111:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
     for(int i=0; i<profile_num; i++)
     ^
make: *** [Makefile:32: release] Error 1

rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 


Z:\quectel-CM\QMIThread.c
static int requestGetProfile(PROFILE_T *profile) {
    PQCQMIMSG pRequest;
    PQCQMIMSG pResponse;
    PQMUX_MSG pMUXMsg;
    int err;
    PQMIWDS_APNNAME pApnName;
    PQMIWDS_USERNAME pUserName;
    PQMIWDS_PASSWD pPassWd;
    PQMIWDS_AUTH_PREFERENCE pAuthPref;
    PQMIWDS_IPTYPE pIpType;
    PQMIWDS_PDPCONTEXT pPdpContext;
    PQMIWDS_PROFILELIST pProfileList;
    
    const char *ipStr[] = {"IPV4", "NULL", "IPV6", "IPV4V6"};

    profile->old_apn[0] = profile->old_user[0] = profile->old_password[0] = '\0';
    profile->old_auth = 0;
    profile->old_iptype = 0;
    if (profile->enable_ipv4 && profile->enable_ipv6)
        profile->iptype = 3;
    else if (profile->enable_ipv6)
        profile->iptype = 2;
    else
        profile->iptype = 0;

    if (!profile->pdp)
        return 0;

_re_check:
    pRequest = ComposeQMUXMsg(QMUX_TYPE_WDS, QMIWDS_GET_PROFILE_LIST_REQ, WdsGetProfileListReqSend, profile);
    err = QmiThreadSendQMI(pRequest, &pResponse);s_pResponse = malloc(le16_to_cpu(pResponse->QMIHdr.Length) + 1);
    qmi_rsp_check_and_return();
    
    pProfileList = (PQMIWDS_PROFILELIST)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x01);
    uint8 profile_indexs[42] = {0};
    uint8 profile_num = pProfileList->ProfileList[0];
    if(profile_num >= 1)
    {
        uint8 j = 0;
        uint8 k = 2;
        for(int i=0; i<profile_num; i++)
        {
            profile_indexs[j++] = pProfileList->ProfileList[k];
            if(pProfileList->ProfileList[++k] == 0)
                k+=2;
            else
                k+=2+pProfileList->ProfileList[k];
        }
    }
    free(pResponse);
    
    for(int i=0; i<profile_num; i++)
    {
        profile->profile_index = profile_indexs[i];
        
        pRequest = ComposeQMUXMsg(QMUX_TYPE_WDS, QMIWDS_GET_PROFILE_SETTINGS_REQ, WdsGetProfileSettingsReqSend, profile);
        err = QmiThreadSendQMI(pRequest, &pResponse);
        qmi_rsp_check_and_return();
        
        pPdpContext = (PQMIWDS_PDPCONTEXT)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x25);
        if(pPdpContext->pdp_context == profile->pdp)
            break;
        else
            free(pResponse);

        if(i == profile_num-1)
        {
            pRequest = ComposeQMUXMsg(QMUX_TYPE_WDS, QMIWDS_CREATE_PROFILE_REQ, WdsCreateProfileSettingsReqSend, profile);
            err = QmiThreadSendQMI(pRequest, &pResponse);
            qmi_rsp_check_and_return();
            free(pResponse);
            goto _re_check;
        }
    }
    

    pApnName = (PQMIWDS_APNNAME)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x14);
    pUserName = (PQMIWDS_USERNAME)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x1B);
    pPassWd = (PQMIWDS_PASSWD)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x1C);
    pAuthPref = (PQMIWDS_AUTH_PREFERENCE)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x1D);
    pIpType = (PQMIWDS_IPTYPE)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x11);

    if (pApnName/* && le16_to_cpu(pApnName->TLVLength)*/)
        uchar2char(profile->old_apn, sizeof(profile->old_apn), &pApnName->ApnName, le16_to_cpu(pApnName->TLVLength));
    if (pUserName/*  && pUserName->UserName*/)
        uchar2char(profile->old_user, sizeof(profile->old_user), &pUserName->UserName, le16_to_cpu(pUserName->TLVLength));
    if (pPassWd/*  && le16_to_cpu(pPassWd->TLVLength)*/)
        uchar2char(profile->old_password, sizeof(profile->old_password), &pPassWd->Passwd, le16_to_cpu(pPassWd->TLVLength));
    if (pAuthPref/*  && le16_to_cpu(pAuthPref->TLVLength)*/) {
        profile->old_auth = pAuthPref->AuthPreference;
    }
    if (pIpType) {
        profile->old_iptype = pIpType->IPType;
    }

    dbg_time("%s[pdp:%d index:%d] %s/%s/%s/%d/%s", __func__, profile->pdp, profile->profile_index, profile->old_apn, profile->old_user, profile->old_password, profile->old_auth, ipStr[profile->old_iptype]);

    free(pResponse);
    return 0;
}
#endif


修改为:
static int requestGetProfile(PROFILE_T *profile) {
    PQCQMIMSG pRequest;
    PQCQMIMSG pResponse;
    PQMUX_MSG pMUXMsg;
    int err;
    PQMIWDS_APNNAME pApnName;
    PQMIWDS_USERNAME pUserName;
    PQMIWDS_PASSWD pPassWd;
    PQMIWDS_AUTH_PREFERENCE pAuthPref;
    PQMIWDS_IPTYPE pIpType;
    PQMIWDS_PDPCONTEXT pPdpContext;
    PQMIWDS_PROFILELIST pProfileList;
    
    const char *ipStr[] = {"IPV4", "NULL", "IPV6", "IPV4V6"};

    profile->old_apn[0] = profile->old_user[0] = profile->old_password[0] = '\0';
    profile->old_auth = 0;
    profile->old_iptype = 0;
    if (profile->enable_ipv4 && profile->enable_ipv6)
        profile->iptype = 3;
    else if (profile->enable_ipv6)
        profile->iptype = 2;
    else
        profile->iptype = 0;

    if (!profile->pdp)
        return 0;

_re_check:
    pRequest = ComposeQMUXMsg(QMUX_TYPE_WDS, QMIWDS_GET_PROFILE_LIST_REQ, WdsGetProfileListReqSend, profile);
    err = QmiThreadSendQMI(pRequest, &pResponse);s_pResponse = malloc(le16_to_cpu(pResponse->QMIHdr.Length) + 1);
    qmi_rsp_check_and_return();
    
    pProfileList = (PQMIWDS_PROFILELIST)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x01);
    uint8 profile_indexs[42] = {0};
    uint8 profile_num = pProfileList->ProfileList[0];
    if(profile_num >= 1)
    {
        uint8 j = 0;
        uint8 k = 2;
        //for(int i=0; i<profile_num; i++)
        int i;
        for(i=0; i<profile_num; i++)

        {
            profile_indexs[j++] = pProfileList->ProfileList[k];
            if(pProfileList->ProfileList[++k] == 0)
                k+=2;
            else
                k+=2+pProfileList->ProfileList[k];
        }
    }
    free(pResponse);
    
    //for(int i=0; i<profile_num; i++)
    int i;
    for(i=0; i<profile_num; i++)

    {
        profile->profile_index = profile_indexs[i];
        
        pRequest = ComposeQMUXMsg(QMUX_TYPE_WDS, QMIWDS_GET_PROFILE_SETTINGS_REQ, WdsGetProfileSettingsReqSend, profile);
        err = QmiThreadSendQMI(pRequest, &pResponse);
        qmi_rsp_check_and_return();
        
        pPdpContext = (PQMIWDS_PDPCONTEXT)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x25);
        if(pPdpContext->pdp_context == profile->pdp)
            break;
        else
            free(pResponse);

        if(i == profile_num-1)
        {
            pRequest = ComposeQMUXMsg(QMUX_TYPE_WDS, QMIWDS_CREATE_PROFILE_REQ, WdsCreateProfileSettingsReqSend, profile);
            err = QmiThreadSendQMI(pRequest, &pResponse);
            qmi_rsp_check_and_return();
            free(pResponse);
            goto _re_check;
        }
    }
    

    pApnName = (PQMIWDS_APNNAME)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x14);
    pUserName = (PQMIWDS_USERNAME)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x1B);
    pPassWd = (PQMIWDS_PASSWD)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x1C);
    pAuthPref = (PQMIWDS_AUTH_PREFERENCE)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x1D);
    pIpType = (PQMIWDS_IPTYPE)GetTLV(&pResponse->MUXMsg.QMUXMsgHdr, 0x11);

    if (pApnName/* && le16_to_cpu(pApnName->TLVLength)*/)
        uchar2char(profile->old_apn, sizeof(profile->old_apn), &pApnName->ApnName, le16_to_cpu(pApnName->TLVLength));
    if (pUserName/*  && pUserName->UserName*/)
        uchar2char(profile->old_user, sizeof(profile->old_user), &pUserName->UserName, le16_to_cpu(pUserName->TLVLength));
    if (pPassWd/*  && le16_to_cpu(pPassWd->TLVLength)*/)
        uchar2char(profile->old_password, sizeof(profile->old_password), &pPassWd->Passwd, le16_to_cpu(pPassWd->TLVLength));
    if (pAuthPref/*  && le16_to_cpu(pAuthPref->TLVLength)*/) {
        profile->old_auth = pAuthPref->AuthPreference;
    }
    if (pIpType) {
        profile->old_iptype = pIpType->IPType;
    }

    dbg_time("%s[pdp:%d index:%d] %s/%s/%s/%d/%s", __func__, profile->pdp, profile->profile_index, profile->old_apn, profile->old_user, profile->old_password, profile->old_auth, ipStr[profile->old_iptype]);

    free(pResponse);
    return 0;
}
#endif


rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ make -j8
cd out/; rm -rf *.o libmnl/*.o quectel-CM quectel-qmi-proxy quectel-mbim-proxy quectel-atc-proxy
/opt/FriendlyARM/toolchain/4.9.3/bin/arm-none-linux-gnueabihf-gcc -Wall -Wextra -Werror -O1  quectel-qmi-proxy.c -o out/quectel-qmi-proxy -lpthread -ldl -lrt 
/opt/FriendlyARM/toolchain/4.9.3/bin/arm-none-linux-gnueabihf-gcc -Wall -Wextra -Werror -O1  quectel-mbim-proxy.c -o out/quectel-mbim-proxy -lpthread -ldl -lrt 
/opt/FriendlyARM/toolchain/4.9.3/bin/arm-none-linux-gnueabihf-gcc -Wall -Wextra -Werror -O1  quectel-atc-proxy.c atchannel.c at_tok.c util.c -o out/quectel-atc-proxy -lpthread -ldl -lrt 
/opt/FriendlyARM/toolchain/4.9.3/bin/arm-none-linux-gnueabihf-gcc -Wall -Wextra -Werror -O1  QmiWwanCM.c GobiNetCM.c main.c QCQMUX.c QMIThread.c util.c qmap_bridge_mode.c mbim-cm.c device.c atc.c atchannel.c at_tok.c udhcpc.c -o out/quectel-CM -lpthread -ldl -lrt

rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ 


rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM$ cd out/
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM/out$ ll
total 272
drwxrwxr-x 2 rootroot rootroot   4096 5月   2 16:29 ./
drwxrwxr-x 5 rootroot rootroot   4096 5月   2 16:29 ../
-rwxrwxr-x 1 rootroot rootroot  45844 5月   2 16:29 quectel-atc-proxy*
-rwxrwxr-x 1 rootroot rootroot 183564 5月   2 16:29 quectel-CM*
-rwxrwxr-x 1 rootroot rootroot  16336 5月   2 16:29 quectel-mbim-proxy*
-rwxrwxr-x 1 rootroot rootroot  20296 5月   2 16:29 quectel-qmi-proxy*
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM/out$ 
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM/out$ file quectel-CM 
quectel-CM: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.0.8, BuildID[sha1]=df17be612cd8840b562e01885b0a84d9afa96d78, with debug_info, not stripped
rootroot@rootroot-ThinkBook-16-G5-IRH:~/quectel-CM/out$ 


参考资料:
百度:QMIThread.c:2100:9: error: ‘for’ loop initial declarations are only allowe


https://blog.csdn.net/qq_53381910/article/details/131819714
error: ‘for‘ loop initial declarations are only allowed in C99 or C11 mode


https://blog.csdn.net/lei2014lei/article/details/134590485
error: ‘for‘ loop initial declarations are only allowed in C99 or C11 mode


 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/1410326.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

如何配置和使用Apollo的component里的plugin

关于如何使用Apollo的Component里的plugin&#xff0c;在Apollo的文档里只有如果和开发的说明却没有找到一个清楚完整说明怎么把plugin跑起来的说明&#xff0c;例如我想把lidar_detection_filter按我们的需求对目标过滤算法作修改然后编译完后&#xff0c;执行 cyber_launch …

2024年【浙江省安全员-C证】考试及浙江省安全员-C证找解析

题库来源&#xff1a;安全生产模拟考试一点通公众号小程序 2024年【浙江省安全员-C证】考试及浙江省安全员-C证找解析&#xff0c;包含浙江省安全员-C证考试答案和解析及浙江省安全员-C证找解析练习。安全生产模拟考试一点通结合国家浙江省安全员-C证考试最新大纲及浙江省安全…

12 Junit单元测试、反射、注解

单元测试 介绍 Junit单元测试是做什么的&#xff1f; 就是针对最小的功能单元(方法)&#xff0c;编写测试代码对其进行正确性测试。 Junit单元测试框架 可以用来对方法进行测试&#xff0c;它是由Junit公司开源出来的 Junit单元测试的优点是什么&#xff1f; 可以灵活的…

智能消费记账|基于SSM+vue的大学生智能消费记账系统(源码+数据库+文档)

智能消费记账目录 基于SSMvue的大学生智能消费记账系统 一、前言 二、系统设计 三、系统功能设计 1 用户列表 2 预算信息管理 3 预算类型管理 四、数据库设计 五、核心代码 六、论文参考 七、最新计算机毕设选题推荐 八、源码获取&#xff1a; 博主介绍&#xff1…

JavaScript百炼成仙自学笔记——3

外门小比 JavaScript运算符 var a 10; var b 2; var s1 a b; var s2 a - b; var s3 a * b; var s4 a / b; var a 10; var b a; var console.log(b); 同理还有a&#xff0c;就是先对a本身进行运算&#xff0c;然后再用a的值 var a 1; var b; var sum (b a--a) a--…

【Excel】excel连接数字和符号

使用“&”对数字和符号进行连接 示例&#xff1a; 将“2.6”和“&#xff0c;”连成“2.6&#xff0c;” 连接公式为&#xff1a; V3&W3 V3和W3分别是"2.6"和“&#xff0c;”在excel中的位置

Word文件导出为PDF

Word文件导出为PDF 方法一、使用Word自带另存为PDF功能 打开需要转换为PDF格式的Word文件&#xff0c;依次点击【文件】➡【另存为】➡选择文件保存类型为.PDF 使用这种方法导出的PDF可能存在Word中书签丢失的情况&#xff0c;在导出界面点击&#xff0c;选项进入详细设置 勾…

ICode国际青少年编程竞赛- Python-1级训练场-for循环入门

ICode国际青少年编程竞赛- Python-1级训练场-for循环入门 1、 for i in range(4):Dev.step(4)Dev.turnLeft()2、 for i in range(3):Dev.step(6)Dev.turnRight()3、 for i in range(3):Dev.turnRight()Dev.step(2)Dev.turnLeft()Dev.step(-3)4、 for i in range(4):Dev…

GPT-1

GPT 系列是 OpenAI 的一系列预训练模型&#xff0c;GPT 的全称是 Generative Pre-Trained Transformer&#xff0c;顾名思义&#xff0c;GPT 的目标是通过 Transformer&#xff0c;使用预训练技术得到通用的语言模型。目前已经公布论文的有 GPT-1、GPT-2、GPT-3。 最近非常火的…

数据结构学习/复习4--链表的实现/链表练习题/二级指针与一级指针在链表实现中的运用

一、链表的实现&#xff08;写法不唯一&#xff0c;此处多处用二级指针&#xff09; 二、链表实现总结 1.二级指针存储一级指针 2.改变一级指针需要用到二级指针&#xff0c;本次使用二级指针进行修改 注意写法不唯一&#xff0c;也有不用二级指针写法 3.链表的结构体(节点)内…

第13章 软件测评相关标准

一、标准化概述 &#xff08;一&#xff09;概念 1、标准 一定范围内获得最佳秩序&#xff0c;经协商一致并由公认机构批准共同使用和重复使用的一种规范性文档&#xff0c;是标准化活动的核心产物。 2、标准化 一定范围内获得最佳秩序&#xff0c;对现实问题和潜在问题制…

ShellScript脚本编程(一)

什么是Shell Shell 是一个用 C 语言编写的程序&#xff0c;它是用户使用 Linux 的桥梁。Shell 既是一种命令语言&#xff0c;又是一种程序设计语言 Shell 是指一种应用程序&#xff0c;这个应用程序提供了一个界面&#xff0c;用户通过这个界面访问操作系统内核的服务 为什么…

基于Spring Boot的校园疫情防控系统设计与实现

基于Spring Boot的校园疫情防控系统设计与实现 开发语言&#xff1a;Java框架&#xff1a;springbootJDK版本&#xff1a;JDK1.8数据库工具&#xff1a;Navicat11开发软件&#xff1a;eclipse/myeclipse/idea 系统部分展示 管理员登录首页界面图&#xff0c;管理员进入校园疫…

数据分析:基于DESeq2的转录组功能富集分析

介绍 DESeq2常用于识别差异基因&#xff0c;它主要使用了标准化因子标准化数据&#xff0c;再根据广义线性模型判别组间差异&#xff08;组间残差是否显著判断&#xff09;。在获取差异基因结果后&#xff0c;我们可以进行下一步的富集分析&#xff0c;常用方法有基于在线网站…

## CSDN创作活动:缓解工作压力:程序员的健康之道

缓解工作压力&#xff1a;程序员的健康之道 在当今快节奏的社会中&#xff0c;程序员作为一个高度专业化和技术密集的群体&#xff0c;往往需要面对持续的工作压力和创新挑战。在如此高强度的工作环境下&#xff0c;如何有效缓解工作压力&#xff0c;保持工作效率和个人健康成…

Java线程池的七大参数说明

线程池中的七大参数如下&#xff1a; &#xff08;1&#xff09;corePoolSize&#xff1a;线程池中的常驻核心线程数。 &#xff08;2&#xff09;maximumPoolSize&#xff1a;线程池能够容纳同时执行的最大线程数&#xff0c;此值大于等于1。 &#xff08;3&#xff09;keepAl…

Recruit App

招聘类APP小程序

【Vulhub靶场】Nginx 漏洞复现

Nginx 漏洞复现 一、Nginx 文件名逻辑漏洞&#xff08;CVE-2013-4547&#xff09;1、影响版本2、漏洞原理3、漏洞复现 二、Nginx 解析漏洞1、版本信息&#xff1a;2、漏洞详情3、漏洞复现 一、Nginx 文件名逻辑漏洞&#xff08;CVE-2013-4547&#xff09; 1、影响版本 Nginx …

HSDB使用教程

HSDB&#xff1a;Hostspot Debugger&#xff0c;JVM内置的工具&#xff0c;用于深入分析JVM运行时的内部状态 启动HSDB java -cp D:/tools/jdk-1.8/lib/sa-jdi.jar sun.jvm.hotspot.HSDB 获取进程id jps 连接到指定进程 查找类 通过查询查找对象 输入查询语句 select d from …

SQL 基础 | AS 的用法介绍

SQL&#xff08;Structured Query Language&#xff09;是一种用于管理和操作数据库的标准编程语言。 在SQL中&#xff0c;AS关键字有几种不同的用法&#xff0c;主要用于重命名表、列或者查询结果。 以下是AS的一些常见用法&#xff1a; 重命名列&#xff1a;在SELECT语句中&a…