(The RK3588 development board used in the following content is the Neardi LCB3588 core modules, which is modified and added according to its Android11 source code)
1. Related drivers added: Mount EC20 hardware
qmi_wan is a USB driver in the Linux kernel that supports USB wireless broadband devices based on the QMI (Qualcomm MSM Interface) protocol. Driver source code: Quectel_Linux_Android_QMI_WWAN_Driver_V1.2.6.zip
Add qmi_wwan_q.c to the kernel-5.10/drivers/net/usb/qmi_wwan_q.c directory.
Corresponding Makefile modifications:
1.diff –git a/kernel-5.10/drivers/net/usb/Makefile
2.b/kernel-5.10/drivers/net/usb/Makefile
3.index 99fd12b..32228ef 100644
4.— a/kernel-5.10/drivers/net/usb/Makefile
5.+++ b/kernel-5.10/drivers/net/usb/Makefile
6.@@ -37,7 +37,8 @@ obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o
7.obj-$(CONFIG_USB_NET_CDC_NCM) += cdc_ncm.o
8.obj-$(CONFIG_USB_NET_HUAWEI_CDC_NCM) += huawei_cdc_ncm.o
9.obj-$(CONFIG_USB_VL600) += lg-vl600.o
10.-obj-$(CONFIG_USB_NET_QMI_WWAN) += qmi_wwan.o
11.+#obj-$(CONFIG_USB_NET_QMI_WWAN) += qmi_wwan.o
12.+obj-$(CONFIG_USB_NET_QMI_WWAN) += qmi_wwan_q.o
13.obj-$(CONFIG_USB_NET_CDC_MBIM) += cdc_mbim.o
14.obj-$(CONFIG_USB_NET_CH9200) += ch9200.o
15.obj-$(CONFIG_USB_NET_AQC111) += aqc111.o
Add EC20 related information to option.c and recompile it into the kernel. (The modified option.c is provided again, see the end of the article)
After compiling, use adb shell to verify whether the driver is compiled into the kernel (the wwan0 device is the network device of EC20):
1.evk_8mp:/ $ adb shell
2.evk_8mp:/ $ ifconfig wwan0
3.wwan0 Link encap:UNSPEC Driver qmi_wwan_q
4.NOARP MTU:1500 Metric:1
5.RX packets:0 errors:0 dropped:0 overruns:0 frame:0
6.TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
7.collisions:0 txqueuelen:1000
8.RX bytes:0 TX bytes:0
2. Add RIL library
(The 3588 development board used in the following content is the Neardi LCB3588 development board, which is modified and added according to its Android11 source code)
RIL version used by Android 12: Quectel_Android_RIL_Driver_V3.6.14_master_Release_ndk_20231013_10_54
RIL compiled into Android system:
Copy the specific version of libreferece-ril.so to the SDK device/rockchip/common/libquectel-ril/arm64-v8a/libreferece-ril.so directory and compile;
Note: For the ndk version, only libreferece-ril.so needs to be modified, and libril.so does not need to be modified.
Used to start RIL Daemon (Radio Interface Layer Daemon).
(RIL Daemon is a background process in the Android system that handles functions related to radio communications (such as mobile networks)) Add the following content in the device/rockchip/rk3588/init.rk3588.rc directory:
1.service ril-daemon /vendor/bin/hw/rild -l <libreference-ril path>
2.class main
3.user radio
4.group radio cache inet misc audio sdcard_rw log
5.capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW
Notes:
service indicates that this is a service declaration
vendor.ril-daemon is the name of the service, indicating that this is a RIL Daemon service provided by the vendor
/vendor/bin/hw/rild is the executable file path of the service, that is, the location of the binary file of RIL Daemon
-l /vendor/lib64/libreference-ril.so indicates the path of the library file that RIL Daemon will load, here is libreference-ril.so
**class main** specifies the class of the service, here is the main class. The main class usually indicates that this is a main system service
**user radio** specifies the user that the service runs, here is the radio user
**group radio cache inet misc audio log readproc wakelock** specifies the group that the service runs, here are multiple groups listed, including radio, cache, inet, misc, audio, log, readproc and wakelock
**capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW** specifies the Linux capabilities of the service. These capabilities are used to provide specific permissions. Here, BLOCK_SUSPEND, NET_ADMIN, and NET_RAW are included
The /vendor/etc/vintf/manifest.xml file in the Android system is generally imported from the device/device name/manifest.xml in the SDK. The RK3588 manufacturer has customized it and configured it in device/rockchip/common/manifests/manifest_level_31.xml.
Add in device/rockchip/common/manifests/manifest_level_31.xml:
1.<hal format=”hidl”>
2.<name>android.hardware.radio</name>
3.<transport>hwbinder</transport>
4.<fqname>@1.1::IRadio/slot1</fqname>
5.<fqname>@1.1::ISap/slot1</fqname>
6.</hal>
After modification, check whether it is compatible with @1.1::IRadio/slot1 and @1.1::ISap/slot1 in hardware/interfaces/compatibility_matrices/compatibility_matrice.6.xml and modify it as follows:
1.<hal format=”hidl” optional=”true”>
2.<name>android.hardware.radio</name>
3.<version>1.6</version>
4.<version>1.5</version>
5.<version>1.4</version>
6.<version>1.3</version>
7.<version>1.2</version>
8.<version>1.1</version> <!– 兼容添加:1.1::IRadio/slot1 –>
9.<interface>
10.<name>IRadio</name>
11.<instance>slot1</instance> <!– 兼容添加:1.1::IRadio/slot1 –>
12.<instance>slot2</instance>
13.<instance>slot3</instance>
14.</interface>
15.</hal>
16.<hal format=”hidl” optional=”true”>
17.<name>android.hardware.radio</name>
18.<version>1.1</version> <!– 兼容添加:1.1::ISap/slot1 –>
19<interface>
20.<name>ISap</name> <!– 兼容添加:1.1::ISap/slot1 –>
21.<instance>slot1</instance>
22.</interface>
23.</hal>
24.<hal format=”hidl” optional=”true”>
25.<name>android.hardware.radio.config</name>
26.<!–
27.See compatibility_matrix.4.xml on versioning of radio config HAL.
28.–>
29.<version>1.1</version>
30.<!– <version>1.2</version> –>
31.<version>1.0</version>
32.<interface>
33.<name>IRadioConfig</name>
34.<instance>default</instance>
35.</interface>
36</hal>
3. Setting device file permissions and attributes
The EC20 device will export 4 USB serial ports. If the device permissions are not modified, the upper layer will be unusable.
Temporary permissions:
chmod 777 /dev/ttyUSB* # Temporarily use chmod to open permissions:
1.
2.- **Permanent permissions**
3.
4.Add **mkcombinedroot/vendor/ueventd.rc** :
5.
6.“`sh
7./dev/ttyUSB* 0660 radio radio
8./dev/ttyACM* 0660 radio radio
9./dev/cdc-wdm* 0660 radio radio
10./dev/qcqmi* 0660 radio radio
11./dev/cdc-acm* 0660 radio radio
1./dev/ttyUSB* 0660 radio radio
2.# Device file Device permissions Device owner Group of device owner
4. Verification
After compiling, burn it to the development board:
1.asu@asu:~$ adb root & adb remount & adb shell
2.rk3588_s: cat /vendor/etc/vintf/manifest.xml # Copy to local machine and modify the content as 5.1
3.rk3588_s: adb push manifest.xml /vendor/etc/vintf/ # Push to 3588
4.rk3588_s: adb shell
5.rk3588_s: sync
6.rk3588_s: find -name “*.xml” 2>/dev/null | xargs grep IRadio
7.# Check if <fqname>@1.1::IRadio/slot</fqname> is modified
8.rk3588_s: reboot # Restart to update the modification
9.asu@asu:~$ adb root & adb remount & adb shell
10.rk3588_s: ifconfig -a # Check if wwan0 is available Network equipment (need to wait a little longer)
11.rk3588_s: ping www.baidu.com # Ping success means communication is successful
If communication fails, modify the android.hardware.radio section in vendor/etc/vintf/manifest.xml as follows:
1.<hal format=”hidl”>
2.<name>android.hardware.radio</name>
3.<transport>hwbinder</transport>
4.<fqname>@1.1::IRadio/slot1</fqname> #Change to 1.1
5.<fqname>@1.1::ISap/slot1</fqname> #Change to 1.1
6.</hal>
After modification, restart the test again.