此文章仅作为技术经验记录,核心思想,就是在 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
手机扫一扫
移动阅读更方便
你可能感兴趣的文章