这篇文章主要是5G模组的配置过程,包括底层调试,一些较新的SDK许多4G、5G的相关配置和服务都没有添加,因此需要添加添加配置和增加5G服务,遇到的问题及解决处理方法

一,底层调试

原理图

dts

这个5G模组是usb接口,所以需要查看模块的PIDVIDlsusb查看是 2c7c:0900
再查看drivers/usb/serial/option.c这个文件是否包含此ID的枚举。发现是具备的,就不做修改,如果没有就需要添加
查看dev下的ttyUSB*枚举了几个,查看是枚举了ttyUSB0~ttyUSB4。仔细查看他们的权限都是666。这个需要在rc服务操作
文件路径:device/rockchip/common/rootdir/ueventd.rockchip.rc 操作ttyUSB0~ttyUSB4的权限
添加移远自己的驱动
\kernel-6.1\drivers\net\usb\
+ qmi_wwan_q.c   
\kernel-6.1\drivers\net\usb\Makefile
+ obj-$(CONFIG_USB_NET_QMI_WWAN) += qmi_wwan_q.o

二、添加配置和增加5G服务

由于此sdk比较新,许多4G5G的相关配置和服务都没有添加,所以第一步就是添加配置和服务。下面代码的修改大部分在device目录
路径 device\rockchip\common\device.mk
chip/common/device.mkockchip/common/device.mkrockchip/common/device.mkr
ockchip/common/device.mk
作用:引入 4g_modem.mk,让系统编译时包含 4G 模块相关的配置。
路径 device\rockchip\common\BoardConfig.mk

作用:使能4G

路径 device\rockchip\rk3576\BoardConfig.mk

+#4g 
+BOARD_HAS_RK_4G_MODEM := true 
+BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true  #此添加项是为了防止编译报错

 路径/rockchip/common/modules/4g_modem.mk


# Copyright 2021 Rockchip Limited 
# 
# Licensed under the Apache License, Version 2.0 (the "License"); 
# you may not use this file except in compliance with the License. 
# You may obtain a copy of the License at 
# 
# http://www.apache.org/licenses/LICENSE-2.0 
# 
# Unless required by applicable law or agreed to in writing, software 
# distributed under the License is distributed on an "AS IS" BASIS, 
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
# See the License for the specific language governing permissions and 
# limitations under the License. 
# 

PRODUCT_PACKAGES += \
	CarrierDefaultApp \
	CarrierConfig \
	rild \
    dhcpcd \
	libreference-ril.so
  	
PRODUCT_COPY_FILES += vendor/rockchip/common/phone/etc/apns-full-conf.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/apns-conf.xml
PRODUCT_PROPERTY_OVERRIDES += \
 ro.boot.noril=false \
 ro.telephony.default_network=9 



DEVICE_MANIFEST_FILE += device/rockchip/common/4g_modem/manifest.xml 

PRODUCT_PACKAGES += \
	libhidlbase.vendor \
	libhwbinder.vendor \
	android.hardware.radio@1.3.vendor \
	android.hardware.radio@1.4.vendor \
	android.hardware.radio.deprecated@1.0.vendor \
	libhidlbase.vendor \
	libhwbinder.vendor \
	android.hardware.radio.config@1.0.vendor \
	android.hardware.radio.config@1.1.vendor \
	android.hardware.radio.config@1.2.vendor \
	android.hardware.radio@1.5.vendor \
	android.hardware.radio@1.6.vendor \
	android.hardware.secure_element@1.0.vendor \
	android.hardware.secure_element@1.1.vendor \
	android.hardware.secure_element@1.2.vendor 
ifeq ($(strip $(TARGET_ARCH)), arm64) 
PRODUCT_PROPERTY_OVERRIDES += \
 vendor.rild.libpath=/vendor/lib64/libreference-ril.so
 
PRODUCT_COPY_FILES += \
  $(LOCAL_PATH)/../4g_modem/bin64/dhcpcd:$(TARGET_COPY_OUT_VENDOR)/bin/dhcpcd \
  $(LOCAL_PATH)/../4g_modem/lib64/libreference-ril.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libreference-ril.so \
  $(LOCAL_PATH)/../4g_modem/lib64/librilutils.so:$(TARGET_COPY_OUT_VENDOR)/lib64/librilutils.so
else
PRODUCT_PROPERTY_OVERRIDES += \
 vendor.rild.libpath=/vendor/lib/librk-ril.so 
 
PRODUCT_COPY_FILES += \
 $(LOCAL_PATH)/../4g_modem/bin32/dhcpcd:$(TARGET_COPY_OUT_VENDOR)/bin/dhcpcd \
 $(LOCAL_PATH)/../4g_modem/lib32/librk-ril.so:$(TARGET_COPY_OUT_VENDOR)/lib/librk-ril.so
 endif

路径/rockchip/common/overlay/frameworks/base/core/res/res/values/config.xml

<!-- This device is not "voice capable"; it's data-only. --> 
- <bool name="config_voice_capable">false</bool> 
+ <bool name="config_voice_capable">true</bool> 

 <!-- This device does not allow sms service. --> 
- <bool name="config_sms_capable">false</bool> 
+ <bool name="config_sms_capable">true</bool> 

 <!-- Flag indicating whether the current device allows data. 
 If true, this means that the device supports data connectivity through 
 the telephony network. 
 This can be overridden to false for devices that support voice and/or sms . --
>

- <bool name="config_mobile_data_capable">false</bool> 
+ <bool name="config_mobile_data_capable">true</bool>

路径rockchip\rk3576\overlay\frameworks\base\core\res\res\values\config.xml

    <string-array translatable="false" name="networkAttributes">
        <item>"wifi,1,1,2,-1,true"</item>
       +<item>"mobile,0,0,0,-1,true"</item>
        +<item>"mobile_mms,2,0,2,60000,true"</item>
        +<item>"mobile_supl,3,0,2,60000,true"</item>
        +<item>"mobile_dun,4,0,2,60000,true"</item>
        +<item>"mobile_hipri,5,0,3,60000,true"</item>
        +<item>"mobile_fota,10,0,2,60000,true"</item>
        +<item>"mobile_ims,11,0,2,60000,true"</item>
        +<item>"mobile_cbs,12,0,2,60000,true"</item>       
        <item>"bluetooth,7,7,0,-1,true"</item>
        <item>"ethernet,9,9,9,-1,true"</item>
    </string-array>

路径device\rockchip\rk3576\device.mk

PRODUCT_PROPERTY_OVERRIDES += \
                ro.ril.ecclist=112,911 \
                ro.opengles.version=196610 \
                wifi.interface=wlan0 \
               +ro.telephony.default_network=9 \
        	   +rild.libpath=/vendor/lib64/libreference-ril.so \
        	   +rild.libargs=-d /dev/ttyUSB2 \
                ro.audio.monitorOrientation=true \
                debug.nfc.fw_download=false \
                debug.nfc.se=false \
                vendor.hwc.compose_policy=1 \
                sys.wallpaper.rgb565=0 \
                sf.power.control=2073600 \
                sys.rkadb.root=0 \
                ro.sf.fakerotation=false \
                ro.tether.denied=false \
                sys.resolution.changed=false \
                ro.default.size=100 \
                ro.product.usbfactory=rockchip_usb \
                wifi.supplicant_scan_interval=15 \
                ro.factory.tool=0 \
                ro.kernel.android.checkjni=0 \
                ro.build.shutdown_timeout=6 \
                persist.enable_task_snapshots=false \
                ro.vendor.frameratelock=true \
                persis.rild.libargs=-d /dev/ttyUSB2

路径\device\rockchip\rk3576\init.rk3576.rc

on boot
    chown system system /sys/class/thermal/thermal_zone0/policy
    chown system system /sys/class/thermal/thermal_zone1/policy
    chown system system /sys/class/thermal/thermal_zone2/policy

    write /dev/cpuset/foreground/cpus 0-7
    write /dev/cpuset/foreground/boost/cpus 0-7
    write /dev/cpuset/background/cpus 0-7
    write /dev/cpuset/system-background/cpus 0-7
    write /dev/cpuset/top-app/cpus 0-7

    # reduce schedul time to improve io performance
    write /sys/kernel/debug/sched_features NO_ENERGY_AWARE

    chown system system /sys/devices/platform/2602e000.syscon/2602e000.syscon:usb2-phy@0/otg_mode
    chmod 0660 /sys/devices/platform/2602e000.syscon/2602e000.syscon:usb2-phy@0/otg_mode

    # The initial load of RT process, set the range of 0-1024, set the RT task above 300 will preferentially run on the cpuB(cpu4-cpu7)
    write /proc/sys/kernel/sched_util_clamp_min_rt_default 0

    write /proc/sys/vm/dirty_ratio 10
    write /proc/sys/vm/dirty_background_ratio 1
    write /proc/sys/vm/dirty_writeback_centisecs 100
    write /proc/sys/vm/dirty_expire_centisecs 500
   + copy /odm/librilutils.so /vendor/lib64/librilutils.so
   + chown system system /vendor/lib64/librilutils.so
   +chmod 0644 /vendor/lib64/librilutils.so
#少的这个库会导致ril服务无法开启,由于vendor分区是后面才生成的,无法直接编译的时候拷贝进文件系统,此处在boot阶段做操作

路径vendor\rockchip\common\phone\phone.mk

PRODUCT_PROPERTY_OVERRIDES +=ro.boot.noril=false
# else
# PRODUCT_PROPERTY_OVERRIDES +=ro.boot.noril=true
endif

路径/hardware/interfaces/compatibility_matrices/compatibility_matrix.8.xml

+  <hal format="hidl" optional="true">
+        <name>android.hardware.radio</name>
+		<version>1.1</version>
+        <version>1.2</version>
+        <version>1.3</version>
+        <version>1.4</version>
+        <version>1.5</version>
+        <version>1.6</version>
+        <interface>
+            <name>IRadio</name>
+			<instance>slot1</instance>
+            <instance>slot2</instance>
+            <instance>slot3</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="true">
+        <name>android.hardware.radio</name>
+        <version>1.2</version>
+        <interface>
+            <name>ISap</name>
+            <instance>slot1</instance>
+        </interface>
+     </hal>
+
+    <hal format="hidl" optional="true">
+        <name>android.hardware.radio.deprecated</name>
+        <version>1.0</version>
+        <interface>
+        <name>IOemHook</name>
+        <instance>slot1</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="true">
+        <name>android.hardware.radio.config</name>
+        <!--
+        See compatibility_matrix.4.xml on versioning of radio config HAL.
+        -->
+		<version>1.0</version>
+        <version>1.1</version>
+        <interface>
+            <name>IRadioConfig</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="true">
+        <name>android.hardware.radio.config</name>
+        <version>1.3</version>
+        <interface>
+            <name>IRadioConfig</name>
+            <instance>default</instance>
+        </interface>
+     </hal>
    <hal format="aidl" optional="true">
        <name>android.hardware.radio.config</name>
        <version>2</version>

路径device\rockchip\common\4g_modem\manifest.xml

<manifest version="1.0" type="device">
    <hal format="hidl">
        <name>android.hardware.radio</name>
        <transport>hwbinder</transport>
        <fqname>@1.1::IRadio/slot1</fqname>
         <fqname>@1.1::IRadio/slot2</fqname>
          <fqname>@1.2::ISap/slot1</fqname>
        <fqname>@1.5::IRadio/slot1</fqname>       
    </hal>
</manifest>

接下来添加移远提供的4G库文件

路径vendor\rockchip\common\phone\bin

+ chat

路径vendor\rockchip\common\phone\etc\ppp

+ ip-down
+ ip-up

路径vendor\rockchip\common\phone\etc\lib

+ libreference-ril.so
+ libril.so

路径vendor\rockchip\common\phone\etc

+ ql-ril.conf

路径 vendor\rockchip\common\phone\phone.mk

PRODUCT_COPY_FILES += \
    $(CUR_PATH)/phone/etc/ppp/ip-down:system/etc/ppp/ip-down \
    $(CUR_PATH)/phone/etc/ppp/ip-up:system/etc/ppp/ip-up \
    $(CUR_PATH)/phone/etc/ppp/call-pppd:system/etc/ppp/call-pppd \
-   $(CUR_PATH)/phone/etc/operator_table:system/etc/operator_table \
+   $(CUR_PATH)/phone/etc/operator_table:system/etc/operator_table \
+    $(CUR_PATH)/phone/etc/ppp/ip-down:system/bin/ip-down \
+    $(CUR_PATH)/phone/etc/ppp/ip-up:system/bin/ip-up \
+    $(CUR_PATH)/phone/bin/chat:system/bin/chat \
+    $(CUR_PATH)/phone/lib/libreference-ril.so:vendor/lib64/libquectel-ril.so \
+    $(CUR_PATH)/phone/lib/libril.so:vendor/lib64/libril.so \
+    $(CUR_PATH)/phone/etc/ql-ril.conf:system/etc/ql-ril.conf 

路径/hardware/ril/rild/rild.rc

-service vendor.ril-daemon /vendor/bin/hw/rild
-    class main
-    user radio
-    group radio cache inet misc audio log readproc wakelock
-    capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW

+ service ril-daemon /vendor/bin/hw/rild -l /vendor/lib64/libquectel-ril.so
+    class main
+    user root
+    group radio cache inet misc audio log readproc wakelock
+    capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW

未完

Logo

智能硬件社区聚焦AI智能硬件技术生态,汇聚嵌入式AI、物联网硬件开发者,打造交流分享平台,同步全国赛事资讯、开展 OPC 核心人才招募,助力技术落地与开发者成长。

更多推荐