Android9.0 HIsi
Android 8.0Mstar
Android 4.4 Hisi
模块有方N720
首先根据模块方添加linux驱动 一般不会出现很大的问题
这个模块是USB 串口的更改option.c(路径一般为 kernel/drivers/usb/serial/option.c)具体以供应商手册为准。
后面的添加也是照搬
最主要一步 添加驱动hisi 有可能会打不开make kernel_menuconfig
直接把这个加到你对应板子的Deconfig就可以了
CONFIG_USB_SERIAL=y
# CONFIG_USB_SERIAL_CONSOLE is not set
# CONFIG_USB_SERIAL_GENERIC is not set
# CONFIG_USB_SERIAL_SIMPLE is not set
# CONFIG_USB_SERIAL_AIRCABLE is not set
# CONFIG_USB_SERIAL_ARK3116 is not set
# CONFIG_USB_SERIAL_BELKIN is not set
# CONFIG_USB_SERIAL_CH341 is not set
# CONFIG_USB_SERIAL_WHITEHEAT is not set
# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
# CONFIG_USB_SERIAL_CP210X is not set
# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
# CONFIG_USB_SERIAL_EMPEG is not set
# CONFIG_USB_SERIAL_FTDI_SIO is not set
# CONFIG_USB_SERIAL_VISOR is not set
# CONFIG_USB_SERIAL_IPAQ is not set
# CONFIG_USB_SERIAL_IR is not set
# CONFIG_USB_SERIAL_EDGEPORT is not set
# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
# CONFIG_USB_SERIAL_F81232 is not set
# CONFIG_USB_SERIAL_GARMIN is not set
# CONFIG_USB_SERIAL_IPW is not set
# CONFIG_USB_SERIAL_IUU is not set
# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
# CONFIG_USB_SERIAL_KEYSPAN is not set
# CONFIG_USB_SERIAL_KLSI is not set
# CONFIG_USB_SERIAL_KOBIL_SCT is not set
# CONFIG_USB_SERIAL_MCT_U232 is not set
# CONFIG_USB_SERIAL_METRO is not set
# CONFIG_USB_SERIAL_MOS7720 is not set
# CONFIG_USB_SERIAL_MOS7840 is not set
# CONFIG_USB_SERIAL_MXUPORT is not set
# CONFIG_USB_SERIAL_NAVMAN is not set
# CONFIG_USB_SERIAL_PL2303 is not set
# CONFIG_USB_SERIAL_OTI6858 is not set
# CONFIG_USB_SERIAL_QCAUX is not set
# CONFIG_USB_SERIAL_QUALCOMM is not set
# CONFIG_USB_SERIAL_SPCP8X5 is not set
# CONFIG_USB_SERIAL_SAFE is not set
# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
# CONFIG_USB_SERIAL_SYMBOL is not set
# CONFIG_USB_SERIAL_TI is not set
# CONFIG_USB_SERIAL_CYBERJACK is not set
# CONFIG_USB_SERIAL_XIRCOM is not set
CONFIG_USB_SERIAL_WWAN=y
CONFIG_USB_SERIAL_OPTION=y
# CONFIG_USB_SERIAL_OMNINET is not set
# CONFIG_USB_SERIAL_OPTICON is not set
# CONFIG_USB_SERIAL_XSENS_MT is not set
# CONFIG_USB_SERIAL_WISHBONE is not set
# CONFIG_USB_SERIAL_SSU100 is not set
# CONFIG_USB_SERIAL_QT2 is not set
# CONFIG_USB_SERIAL_DEBUG is not set
添加完这个就可以把kernel放到你的板子里了
可以看到usb设备节点
kernel就完全没问题了
要注意 kernel是不是打开了PPP一般来说用PPP比较多 也比较容易调试
接下来就是系统了 7.0以下直接在init.rc里面添加 然后更改下权限就可以了
Android 8.0以上
直接修改hardware/ril/rild/rild.rc
接下来也是 8.0以上添加服务
android.hardware.radio.deprecated
hwbinder
1.0
IOemHook
slot1
android.hardware.radio
hwbinder
1.1
IRadio
slot1
ISap
slot1
(大部分代码出自git log 为了方便粘贴只去掉+号 请自行缩进)
最重要一步 关掉SELinux 当然有的厂家选择不关掉
两种方法
1. bootargs 更改
2.适用于Android9.0
--- a/core/init/selinux.cpp
+++ b/core/init/selinux.cpp
@@ -89,6 +89,7 @@ EnforcingStatus StatusFromCmdline() {
}
bool IsEnforcing() {
+ return false;
if (ALLOW_PERMISSIVE_SELINUX) {
return StatusFromCmdline() == SELINUX_ENFORCING;
}
当然不关也没问题~~自己写权限文件 由于我们可以关掉 我就没去看
整个文档部分结束
这个地方加完可能大部分芯片可以
但是有的厂商!!!!!!!!!!!!!!!!
所有都关掉
基于9.0所有都关掉最全攻略
trySetupData for APN type default, reason: dataEnabled. Data disallowed, reasons: DATA_DISABLED 这个错误基本上就是没加ro.com.android.prov_mobiledata=true
ro.telephony.default_network=10 \//默认网络选择可避免只有2g
persist.sys.pref.net.type=10 \
ro.com.android.dataroaming=true \//这个是数据漫游可加可不加
ro.com.android.prov_mobiledata=true \//这个是必须加的 不加打不开网络的
ro.radio.noril=false \ //这个必须改为false否则系统会认为你没有数据网络
vendor.rild.libpath=/vendor/lib/libreference-rilecyoufang.so//这个是给rild加载库的参数详情见rild.c
附录:
安卓网络首选项修改如下参数:
路径(因平台而异):
frameworks/base/telephony/java/com/android/internal/telephony/RILConstants.java
安卓默认参数设置:
int PREFERRED_NETWORK_MODE = TelephonyManager.getDefaultPreferredNetworkType(0, NETWORK_MODE_WCDMA_PREF);
修改为:
int PREFERRED_NETWORK_MODE = TelephonyManager.getDefaultPreferredNetworkType(0, NETWORK_MODE_LTE_GSM_WCDMA);
REQUEST_SET_PREFERRED_NETWORK_TYPE
int NETWORK_MODE_WCDMA_PREF = 0;
int NETWORK_MODE_GSM_ONLY = 1;
int NETWORK_MODE_WCDMA_ONLY = 2;
int NETWORK_MODE_GSM_UMTS = 3;
int NETWORK_MODE_CDMA = 4;
int NETWORK_MODE_CDMA_NO_EVDO = 5;
int NETWORK_MODE_EVDO_NO_CDMA = 6;
int NETWORK_MODE_GLOBAL = 7;
int NETWORK_MODE_LTE_CDMA_EVDO = 8;
int NETWORK_MODE_LTE_GSM_WCDMA = 9;
int NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA = 10;
int NETWORK_MODE_LTE_ONLY = 11;
int NETWORK_MODE_LTE_WCDMA = 12;
int NETWORK_MODE_TD_SCDMA_ONLY = 13;
int NETWORK_MODE_TD_SCDMA_WCDMA = 14;
int NETWORK_MODE_TD_SCDMA_LTE = 15;
int NETWORK_MODE_TD_SCDMA_GSM = 16;
int NETWORK_MODE_TD_SCDMA_GSM_LTE = 17;
int NETWORK_MODE_TD_SCDMA_GSM_WCDMA = 18;
int NETWORK_MODE_TD_SCDMA_WCDMA_LTE = 19;
int NETWORK_MODE_TD_SCDMA_GSM_WCDMA_LTE = 20;
int NETWORK_MODE_TD_SCDMA_CDMA_EVDO_GSM_WCDMA = 21;
int NETWORK_MODE_TD_SCDMA_LTE_CDMA_EVDO_GSM_WCDMA = 22;
下面是所需要编译的包不要问为什么 加就对了
PRODUCT_PACKAGES += \
TelephonyProvider \
TeleService \
rild
下面是文件放的位置
PRODUCT_COPY_FILES += \
device/hisilicon/bigfish/build/prebuilts/youfang/libreference-ril.so:vendor/lib/libreference-rilecyoufang.so \
device/hisilicon/bigfish/build/prebuilts/youfang/chat:system/bin/chat \
device/hisilicon/bigfish/build/prebuilts/youfang/ip-down:system/etc/ppp/ip-down \
device/hisilicon/bigfish/build/prebuilts/youfang/ip-up:system/etc/ppp/ip-up \
device/hisilicon/bigfish/build/prebuilts/youfang/apns-conf.xml:system/etc/apns-conf.xml \
上面基本上除了apn其它的模块商都会给 要注意自己的cpu架构 怎么看呢
我这个是32位的 当然一般64兼容32
还有一个地方要设置hisilicon/Hi3751V350/overlay/frameworks/base/core/res/res/values/config.xml(这个config一般厂商都会有overlay如果没有 就在frameworks相同的路径里面)
这个地方是设置网络优先级 如果没有mobile就会有问题
"ethernet,9,9,1,-1,true"
"wifi,1,1,1,-1,true"
"mobile,0,0,0,-1,true"
"mobile_mms,2,0,2,60000,true"
"mobile_supl,3,0,2,60000,true"
"mobile_dun,4,0,2,60000,true"
"mobile_hipri,5,0,3,60000,true"
"mobile_fota,10,0,2,60000,true"
"mobile_ims,11,0,2,60000,true"
"mobile_cbs,12,0,2,60000,true"
"mobile_ia,14,0,2,-1,true"
"mobile_emergency,15,0,2,-1,true"
"wifi_p2p,13,1,0,-1,true"
"1,1"
"0,1"
"15,15"
"9,9"
"1,15"
全部检查OK之后 应该就可以上网了ppp0就是模块的网卡
还有很多人出现PPP退出 查看/dev/ppp设备节点有没有 有的话强制chmod 777试一下 应该是可以上网 然后写到init.rc就可以了
参考https://blog.csdn.net/u012932409/article/details/100044278
https://blog.csdn.net/qq_32017483/article/details/100131180
作者:干点杂活