【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(运行级别配置文件位 ...
随机推荐
- Scrapy 发送Request Payload
Scrapy 发送Request Payload 首先要打开 F12 进入调试模式 然后 查看是用什么方法获取的 如果是Json: 1. json.dumps 转化成Json yield Reques ...
- CSP-S游记
第三次考csp-s了,希望这次不要二等 Day ?(初赛) 之前校内模拟赛平均下来都在班级中游,所以不求高分但是觉得过没问题(事实好像确实如此 先开题,选择题很水秒了(devinNB猜到了考Linux ...
- loguru库使用
参考: https://github.com/Delgan/loguru https://loguru.readthedocs.io/en/stable/overview.html https://b ...
- C语言实现计算“已经活了多少天”
输入生日,通过系统或者自己输入,获得当前日期,计算已经存活了多少天. #include<stdio.h> #include<time.h> /** * 函数介绍: * 通过输入 ...
- DTSE Tech Talk | 第10期:云会议带你入门音视频世界
摘要:本期直播主题是<云会议带你入门音视频世界>,华为云媒体服务产品部资深专家金云飞,与开发者们交流华为云会议在实时音视频行业中的集成应用,帮助开发者更好的理解华为云会议及其开放能力. 本 ...
- carbon
https://blog.csdn.net/wtt945482445/article/details/79385234
- 【OpenStack云平台】安装Centos操作系统
视频教程:https://live.csdn.net/v/236820 1.环境准备 准备实验所需要的环境,需要安装VMware Workstation.使用的系统镜像为CentOS-7.5-x86_ ...
- Go语言输出函数fmt.Print、fmt.Printf、fmt.Println的用法区别
fmt 包的介绍 fmt = format,是一种格式化输出函数汇总包,用于格式化输出 fmt.Print === 原样输出 Print formats using the default forma ...
- Project facet Java version 13 is not supported.
问题 导入的文件运行时出现报错:Project facet Java version 13 is not supported. 大概就是版本不支持,看了下自己的Java版本是1.8的,修改下版本即可运 ...
- 关于解决scapy.error.Scapy_Exception: tcpdump is not available. Cannot use filter !报错
解决办法 sudo apt install tcpdump 后续 我特意没写到我的 arp 攻击那篇文章里面,就是为了水一片文章