【Android】移除 Android frameworks 层,当 Linux 系统使用。(服务移除篇)
前言说明
此文章仅作为技术经验记录,核心思想,就是在 init.rc 里面移除服务,致使 frameworks 不被启动,其它不便多说。
此文章内容为系统服务移除篇,最终实现的效果是 Android 相关的系统核心服务均不被运行,实现释放大量的硬件资源。
下一篇为文件裁剪篇(视情况而定),主要目的是移除大量 Android frameworks 的文件,加快编译速度和减小固件大小。
应用补丁
From 7c7192cdfc157eca58f03dd8b0e4e32767c9dbad Mon Sep 17 00:00:00 2001
From: lovemengx <lovemengx@qq.com>
Date: Wed, 5 Aug 2020 20:30:46 +0800
Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=20frameworks=20=E6=9C=8D?=
=?UTF-8?q?=E5=8A=A1,=20=E5=BC=80=E6=9C=BA=E9=80=9F=E5=BA=A6=E6=8F=90?=
=?UTF-8?q?=E5=8D=87=E5=88=B0=209=20=E7=A7=92=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
device/rda/common/res/init.rc | 293 +++++++++---------
.../rda/etau/NollecA9V2V8810P/oem_driver.rc | 2 +-
device/rda/etau/init.rda8810.rc | 110 +++----
3 files changed, 204 insertions(+), 201 deletions(-)
diff --git a/device/rda/common/res/init.rc b/device/rda/common/res/init.rc
index b404e840ba..4b665d2a24 100755
--- a/device/rda/common/res/init.rc
+++ b/device/rda/common/res/init.rc
@@ -120,6 +120,7 @@ loglevel 15
write /dev/cpuctl/apps/bg_non_interactive/cpu.shares 52
write /dev/cpuctl/apps/bg_non_interactive/cpu.rt_runtime_us 700000
write /dev/cpuctl/apps/bg_non_interactive/cpu.rt_period_us 1000000
+ write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor performance
# qtaguid will limit access to specific data based on group memberships.
# net_bw_acct grants impersonation of socket owners.
@@ -360,20 +361,20 @@ on boot
# Define TCP buffer sizes for various networks
# ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
- setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
- setprop net.tcp.buffersize.wifi 524288,1048576,2097152,262144,524288,1048576
- setprop net.tcp.buffersize.lte 524288,1048576,2097152,262144,524288,1048576
- setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
- setprop net.tcp.buffersize.hspa 4094,87380,262144,4096,16384,262144
- setprop net.tcp.buffersize.hsupa 4094,87380,262144,4096,16384,262144
- setprop net.tcp.buffersize.hsdpa 4094,87380,262144,4096,16384,262144
- setprop net.tcp.buffersize.hspap 4094,87380,1220608,4096,16384,1220608
- setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
- setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
- setprop net.tcp.buffersize.evdo 4094,87380,262144,4096,16384,262144
+# setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
+# setprop net.tcp.buffersize.wifi 524288,1048576,2097152,262144,524288,1048576
+# setprop net.tcp.buffersize.lte 524288,1048576,2097152,262144,524288,1048576
+# setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
+# setprop net.tcp.buffersize.hspa 4094,87380,262144,4096,16384,262144
+# setprop net.tcp.buffersize.hsupa 4094,87380,262144,4096,16384,262144
+# setprop net.tcp.buffersize.hsdpa 4094,87380,262144,4096,16384,262144
+# setprop net.tcp.buffersize.hspap 4094,87380,1220608,4096,16384,1220608
+# setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
+# setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
+# setprop net.tcp.buffersize.evdo 4094,87380,262144,4096,16384,262144
# Set this property so surfaceflinger is not started by system_init
- setprop system_init.startsurfaceflinger 0
+# setprop system_init.startsurfaceflinger 0
#open coredump
setrlimit 4 -1 -1
@@ -425,26 +426,26 @@ service ueventd /sbin/ueventd
critical
seclabel u:r:ueventd:s0
-service watchdogd /sbin/watchdogd
- class core
- critical
- seclabel u:r:watchdogd:s0
+#service watchdogd /sbin/watchdogd
+# class core
+# critical
+# seclabel u:r:watchdogd:s0
-service healthd /system/bin/healthd
- class core
- critical
- seclabel u:r:healthd:s0
+#service healthd /system/bin/healthd
+# class core
+# critical
+# seclabel u:r:healthd:s0
-on property:selinux.reload_policy=1
- restart ueventd
- restart installd
+#on property:selinux.reload_policy=1
+# restart ueventd
+# restart installd
service console /system/bin/sh
class core
console
disabled
- user shell
+ user root
group log
#on property:ro.debuggable=1
@@ -478,9 +479,9 @@ service usb_traced /system/bin/usb_traced
class main
disabled
-service AT_transfer /system/bin/AT_transfer
- class main
- disabled
+#service AT_transfer /system/bin/AT_transfer
+# class main
+# disabled
on property:debug.usbtrace=1
write /sys/class/android_usb/android0/f_mlog/bp_trace 1
@@ -498,131 +499,133 @@ on property:debug.fta.enable=0
setprop sys.usb.config mtp,adb
stop AT_transfer
-service servicemanager /system/bin/servicemanager
- class core
- user system
- group system
- critical
- onrestart restart healthd
- onrestart restart zygote
- onrestart restart media
- onrestart restart surfaceflinger
- onrestart restart drm
+#service servicemanager /system/bin/servicemanager
+# class core
+# user system
+# group system
+# critical
+# onrestart restart healthd
+# onrestart restart zygote
+# onrestart restart media
+# onrestart restart surfaceflinger
+# onrestart restart drm
service vold /system/bin/vold
class core
socket vold stream 0660 root mount
ioprio be 2
-service netd /system/bin/netd
- class main
- socket netd stream 0660 root system
- socket dnsproxyd stream 0660 root inet
- socket mdns stream 0660 root system
+#service netd /system/bin/netd
+# class main
+# socket netd stream 0660 root system
+# socket dnsproxyd stream 0660 root inet
+# socket mdns stream 0660 root system
service debuggerd /system/bin/debuggerd
class main
-service ril-daemon /system/bin/rild
- class main
- socket rild stream 660 root radio
- socket rild-debug stream 660 radio system
- user root
- group radio cache inet misc audio log system
-
-service surfaceflinger /system/bin/surfaceflinger
- class main
- user root
- group graphics drmrpc
- onrestart restart zygote
-
-service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
- class main
- socket zygote stream 660 root system
- onrestart write /sys/android_power/request_state wake
- onrestart write /sys/power/state on
- onrestart restart media
- onrestart restart netd
-
-service drm /system/bin/drmserver
- class main
- user drm
- group drm system inet drmrpc
-
-service media /system/bin/mediaserver
- class main
- user root
- group audio camera inet net_bt net_bt_admin net_bw_acct drmrpc
- ioprio rt 4
-
-service bootanim /system/bin/bootanimation
- class main
- user graphics
- group graphics
- disabled
- oneshot
-
-service shutdownanim /system/bin/bootanimation shut
- class main
- user graphics
- group graphics
- disabled
- oneshot
-
-service installd /system/bin/installd
- class main
- socket installd stream 600 system system
-
-service flash_recovery /system/etc/install-recovery.sh
- class main
- oneshot
-
-service racoon /system/bin/racoon
- class main
- socket racoon stream 600 system system
- # IKE uses UDP port 500. Racoon will setuid to vpn after binding the port.
- group vpn net_admin inet
- disabled
- oneshot
-
-service mtpd /system/bin/mtpd
- class main
- socket mtpd stream 600 system system
- user vpn
- group vpn net_admin inet net_raw
- disabled
- oneshot
-
-service keystore /system/bin/keystore /data/misc/keystore
- class main
- user keystore
- group keystore drmrpc
- socket keystore stream 666
-
-service dumpstate /system/bin/dumpstate -s
- class main
- socket dumpstate stream 0660 shell log
- disabled
- oneshot
-
-service sshd /system/bin/start-ssh
- class main
- disabled
-
-service mdnsd /system/bin/mdnsd
- class main
- user mdnsr
- group inet net_raw
- socket mdnsd stream 0660 mdnsr inet
- disabled
- oneshot
-
-service usbdrvinstall /system/bin/sh /vendor/modules/usbdrvinstall.sh
- user root
- group root
- disabled
- oneshot
-
-service su_daemon /system/xbin/su --daemon
- class main
- user root
+#service ril-daemon /system/bin/rild
+# class main
+# socket rild stream 660 root radio
+# socket rild-debug stream 660 radio system
+# user root
+# group radio cache inet misc audio log system
+
+#service surfaceflinger /system/bin/surfaceflinger
+# class main
+# user root
+# group graphics drmrpc
+# onrestart restart zygote
+
+#service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
+# class main
+# socket zygote stream 660 root system
+# onrestart write /sys/android_power/request_state wake
+# onrestart write /sys/power/state on
+# onrestart restart media
+# onrestart restart netd
+
+#service drm /system/bin/drmserver
+# class main
+# user drm
+# group drm system inet drmrpc
+
+#service media /system/bin/mediaserver
+# class main
+# user root
+# group audio camera inet net_bt net_bt_admin net_bw_acct drmrpc
+# ioprio rt 4
+
+#service bootanim /system/bin/bootanimation
+# class main
+# user graphics
+# group graphics
+# disabled
+# oneshot
+#
+#service shutdownanim /system/bin/bootanimation shut
+# class main
+# user graphics
+# group graphics
+# disabled
+# oneshot
+
+#service installd /system/bin/installd
+# class main
+# socket installd stream 600 system system
+#
+#service flash_recovery /system/etc/install-recovery.sh
+# class main
+# oneshot
+#
+#service racoon /system/bin/racoon
+# class main
+# socket racoon stream 600 system system
+# # IKE uses UDP port 500. Racoon will setuid to vpn after binding the port.
+# group vpn net_admin inet
+# disabled
+# oneshot
+#
+#service mtpd /system/bin/mtpd
+# class main
+# socket mtpd stream 600 system system
+# user vpn
+# group vpn net_admin inet net_raw
+# disabled
+# oneshot
+
+#service keystore /system/bin/keystore /data/misc/keystore
+# class main
+# user keystore
+# group keystore drmrpc
+# socket keystore stream 666
+
+## 可以用dumpstate 获取设备的各种信息
+#service dumpstate /system/bin/dumpstate -s
+# class main
+# socket dumpstate stream 0660 shell log
+# disabled
+# oneshot
+
+#service sshd /system/bin/start-ssh
+# class main
+# disabled
+
+## mdnsd 是多播 DNS 和 DNS 服务发现的守护程序
+#service mdnsd /system/bin/mdnsd
+# class main
+# user mdnsr
+# group inet net_raw
+# socket mdnsd stream 0660 mdnsr inet
+# disabled
+# oneshot
+
+#service usbdrvinstall /system/bin/sh /vendor/modules/usbdrvinstall.sh
+# user root
+# group root
+# disabled
+# oneshot
+
+#service su_daemon /system/xbin/su --daemon
+# class main
+# user root
diff --git a/device/rda/etau/NollecA9V2V8810P/oem_driver.rc b/device/rda/etau/NollecA9V2V8810P/oem_driver.rc
index c5ae844e58..3719883cae 100755
--- a/device/rda/etau/NollecA9V2V8810P/oem_driver.rc
+++ b/device/rda/etau/NollecA9V2V8810P/oem_driver.rc
@@ -1,6 +1,6 @@
on early-boot
# insmod /vendor/modules/ssv6x5x.ko
- insmod /vendor/driver/rda_headset.ko
+# insmod /vendor/driver/rda_headset.ko
insmod /vendor/modules/galcore.ko registerMemBase=0x20080000 irqLine=25 baseAddress=0x80000000 showArgs=1
insmod /vendor/modules/vpu.ko
insmod /vendor/modules/voc.ko
diff --git a/device/rda/etau/init.rda8810.rc b/device/rda/etau/init.rda8810.rc
index bd5794b342..867136a978 100755
--- a/device/rda/etau/init.rda8810.rc
+++ b/device/rda/etau/init.rda8810.rc
@@ -1,4 +1,4 @@
-import init.ril.rc
+#import init.ril.rc
import init.rda.usb.rc
import init.storage.rc
import oem_driver.rc
@@ -14,7 +14,6 @@ on post-fs-data
mkdir /data/misc/wpa_supplicant 0770 wifi wifi
mkdir /data/misc/dhcp 0770 dhcp dhcp
chown dhcp dhcp /data/misc/dhcp
- chmod 777 /data/misc/wifi/wpa_supplicant.conf
on init
mkdir /vendor 0770 system system
@@ -74,18 +73,19 @@ on boot
chown system system /sys/devices/virtual/input/input2/driver/enabled
chown system system /sys/devices/platform/rda-headset.0/enabled
- mkdir /data/local/tmp/xlog 0777
-
on property:ro.debuggable=1
write /sys/module/kgdboc/parameters/kgdboc ttyS0
-# turn on and turn off Wi-Fi
- write /sys/class/rfkill/rfkill0/state 1
- write /sys/class/rfkill/rfkill0/state 0
-
on property:init.svc.wpa_supplicant=stopped
stop dhcpcd_wlan0
+on property:persist.sys.usb.config=*
+ setprop sys.usb.config none
+ setprop sys.usb.config adb
+
+on property:app.sdcard.exist=1
+ mount vfat /dev/block/mmcblk0p1 /sdcard
+
service androidlogonsd /system/xbin/androidlogonsd.sh
class main
disabled
@@ -97,13 +97,13 @@ service androidlogonsd /system/xbin/androidlogonsd.sh
###############################################################
# redirect logs(LOGE, LOGI...) to linux console
###############################################################
-service logcat /system/bin/logcat -f /dev/kmsg *:W
- disabled
- oneshot
+#service logcat /system/bin/logcat -f /dev/kmsg *:W
+# disabled
+# oneshot
-service bootlogo /system/bin/bootlogo /system/media/bootlogo
- user root
- oneshot
+#service bootlogo /system/bin/bootlogo /system/media/bootlogo
+# user root
+# oneshot
service swapd /system/xbin/createswap.sh
class main
@@ -126,34 +126,34 @@ service fatd /system/xbin/createfat.sh
class main
oneshot
-service gsmMuxd /system/bin/gsmMuxd -m basic -s /dev/modem0 -l /dev/ttyMux -b 115200 -n 8 -f 2047
- class main
- user root
- group radio cache inet misc audio sdcard_rw log system
- seclabel u:r:gsmMuxd:s0
-
-service ril_ctl /system/bin/logwrapper /system/bin/ril_ctl
- class main
- user root
- seclabel u:r:ril_ctl:s0
-
-service wpa_supplicant /system/bin/wpa_supplicant \
- -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -dd \
- -g@android:wpa_wlan0
- class main
- socket wpa_wlan0 dgram 660 wifi wifi
- disabled
- oneshot
+#service gsmMuxd /system/bin/gsmMuxd -m basic -s /dev/modem0 -l /dev/ttyMux -b 115200 -n 8 -f 2047
+# class main
+# user root
+# group radio cache inet misc audio sdcard_rw log system
+# seclabel u:r:gsmMuxd:s0
-service dhcpcd_wlan0 /system/bin/logwrapper /system/bin/dhcpcd -A -dd
- class main
- disabled
- oneshot
+#service ril_ctl /system/bin/logwrapper /system/bin/ril_ctl
+# class main
+# user root
+# seclabel u:r:ril_ctl:s0
-service iprenew_wlan0 /system/bin/logwrapper /system/bin/dhcpcd -n
- class main
- disabled
- oneshot
+#service wpa_supplicant /system/bin/wpa_supplicant \
+# -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -dd \
+# -g@android:wpa_wlan0
+# class main
+# socket wpa_wlan0 dgram 660 wifi wifi
+# disabled
+# oneshot
+#
+#service dhcpcd_wlan0 /system/bin/logwrapper /system/bin/dhcpcd -A -dd
+# class main
+# disabled
+# oneshot
+#
+#service iprenew_wlan0 /system/bin/logwrapper /system/bin/dhcpcd -n
+# class main
+# disabled
+# oneshot
#Do not need on Android4.2
#service hciattach /system/bin/logwrapper /system/bin/hciattach -n -s 115200 /dev/ttyS1 rda 115200 noflow
@@ -186,19 +186,19 @@ service iprenew_wlan0 /system/bin/logwrapper /system/bin/dhcpcd -n
# oneshot
-service preinstall /system/bin/sh /system/bin/preinstall.sh
- user root
- group root
- disabled
- oneshot
-
-service apanic /system/bin/sh /system/bin/init.apanic.sh
- user root
- group root
- disabled
- oneshot
-
-on property:sys.boot_completed=1
- start preinstall
- start apanic
+#service preinstall /system/bin/sh /system/bin/preinstall.sh
+# user root
+# group root
+# disabled
+# oneshot
+#
+#service apanic /system/bin/sh /system/bin/init.apanic.sh
+# user root
+# group root
+# disabled
+# oneshot
+#
+#on property:sys.boot_completed=1
+# start preinstall
+# start apanic
--
2.19.2
【Android】移除 Android frameworks 层,当 Linux 系统使用。(服务移除篇)的更多相关文章
- Linux 系统Telnet服务
Linux 系统Telnet服务 telnet与ssh相比,安全性能并不高,但是在ssh版本升级或者其他的情况下还是需要开启这一项服务.linux提供服务是由运行在后台的守护进程daemon来执行的, ...
- Linux系统xinetd服务启动不了
Linux系统xinetd服务启动不了 xinetd服务时发现xinetd服务启动不了,并出现错误提示xinetd:unrecognized service,当出现这个错误提示的时候说明系统未安装xi ...
- Linux系统Apache服务 - 配置 HTTP 的虚拟机主机
接Linux系统Apache服务 - 配置HTTP的默认主页 1.创建/srv目录,作为httpd的文件目录,并创建/srv/default/www和/srv/www1.example.com/www ...
- 让Android 变身回一台真正的Linux系统吧!!!
在Android上开发也有两年的时间了,虽然一直都知道Android是构建在Linux Kernel上的手机操作系统,但在此之前一直没有实感. 直到第一次买了Android的手机,并请人帮我Root后 ...
- Android内存解析(一)—从Linux系统内存逐步认识Android应用内存
总述 Android应用程序被限制了内存使用上限,一般为16M或24M(具体看系统设置),当应用的使用内存超过这个上限时,就会被系统认为内存泄漏,被kill掉.所以在android开发时,管理好内存的 ...
- Linux系统NBD驱动安装拓展篇
前言: 最近在安装中标麒麟机器的时候,发现麒麟的操作系统找不到src.rpm包,且系统内部也没有内核文件,导致正常方法安装NBD驱动无法实施.故这里找了另一种办法帮助此类型操作系统安装NBD驱动. 一 ...
- linux系统oracle服务自启动
终于知道为什么自启动脚本一直无法成功执行,原来都是空格不对惹的祸.具体步骤说明如下: 1.修改dbstart和dbshut脚本 dbstart脚本默认值启动oracle服务,不启动监听服务,如果想在启 ...
- Linux系统文件系统及文件基础篇
学习Linux,重难点在于掌握不同类别的文件系统及其作用.通过对Linux系统的安装,我们首先来了解下Linux系统里各个目录文件夹下的大致功能:主要的目录树的有/./root./home./usr. ...
- Linux系统默认服务建议开启关闭说明列表
服务名称 功能简介 建议 acpid 电源管理接口.如果是笔记本用户建议开启,可以监听内核层的相关电源事件. 开启 anacron 系统的定时任务程序.cron的一个子系统,如果定时任务错过了执行时间 ...
- 自学linux——4.Linux的自有服务(基础篇)
linux自有服务(内置) 一.运行级别(模式) 在Linux中存在一个进程:init,进程id是1. 查看进程:#ps -ef|grep init 对应的配置文件:inittab(运行级别配置文件位 ...
随机推荐
- 河北首家城商行传统核心业务国产化,TDSQL突破三“最”为秦皇岛银行保驾护航
11 月 1 日,秦皇岛银行新一代分布式核心系统成功投产并稳定安全运行超过三个月,标志着秦皇岛银行数字化转型应用和服务水平登上了一个新台阶. 这是秦皇岛银行有史以来规模最大.范围最广.难度最高的一次系 ...
- python(27)反射机制
1. 什么是反射? 它的核心本质其实就是基于字符串的事件驱动,通过字符串的形式去操作对象的属性或者方法 2. 反射的优点 一个概念被提出来,就是要明白它的优点有哪些,这样我们才能知道为什么要使用反射. ...
- 嵌入式-C语言基础:函数指针
定义函数地址:如果在程序中定义了一个函数,那么在编译的时候,编译系统为函数代码分配一段存储空间,这段存储空间的起始地址(也叫入口地址)称为这个函数的地址. 和数组一样,数组名代表地址,而函数名表示函数 ...
- 树莓派编译opencv4
前言 我用的是 树莓派3b 编译的 opencv4.1.0,如果不想编译可以直接下载我编译好的. 下载地址 直接 make install,或者按照我后续步骤复制动态链接库. 准备 需要调节虚拟内存大 ...
- 解决redmi airdots 2右耳充不进电,灯不亮
解决方案 在放入充电盒并插入数据线充电状态下,长按按钮
- tesseract-orc训练 结合python3图像识别验证码
##前言 其实就是用到tesseract-ocr这个引擎来识别,只不过我们需要做一些在此之前的工作 将图片用pillow进行初步处理,将图片中的验证码显示的清晰一些,关于这些教程可以查看我的另一篇文章 ...
- day23 JDBC(Java Database Connection)连接 与 通配符与插入返回主键
JDBC配置connector的jar包 1.项目下新建lib文件夹 2.将mysql-connector-java-版本号.jar复制到lib目录下 3.右键项目名,选择Properties选项 4 ...
- 【每日一题】【集合增删】2022年1月13日-NC41 最长无重复子数组-220113/220122
描述 给定一个长度为n的数组arr,返回arr的最长无重复元素子数组的长度,无重复指的是所有数字都不相同. 子数组是连续的,比如[1,3,5,7,9]的子数组有[1,3],[3,5,7]等等,但是[1 ...
- Jgit的使用笔记
原文:Jgit的使用笔记 - Stars-One的杂货小窝 之前整的一个系统,涉及到git代码的推送,是通过cmd命令去推送的,然后最近在产品验收的时候,测试部门随意填了个git仓库,然后导致仓库代码 ...
- ArcObjects SDK开发 016 在ArcMap中使用Toolbox
1.如何找到ToolBox 通过Geoprocessing菜单上的ArcToolbox菜单项,可以打开ArcToolbox面板. 工具栏上也有一个ArcToolbox的按钮,点击该按钮也可以打开. 通 ...