android 7.1 开机速度优化记录

调试过程中做一些记录:平台msm8953 ,android 7.1(部分参考网络大神的记录和翻译老外的文章)

一、

0、驱动层的裁剪  Android native层服务的裁剪 Android frameworks层服务的裁剪  Android APP层的裁剪

1、lk优化,去掉Lk里面的各种延时,目前启动时间1.3s左右

lk阶段可以把显示部分的初始化去掉,不再显示logo图片,节约0.2s左右

2、kernel优化 ,使用user版本的kernel,init进程启动时间在1s左右,需要继续裁剪Kernel大小,这样lk加载内核时间也会缩短

(1) 减少Log输出

(2)移除不必要的驱动,文件系统,子文件系统,查看 /dev /sys下的节点,移除不必要的功能。例子:如果wlan通过pcie链接,sdio接口驱动可以去掉

(3)裁剪设备树里面不必要的硬件设备。查看生成的.config,移除不必要的选项

(4)优化驱动的probe功能,减少不必要的延时

(5)bootgraph 用来分析内核功能, 在kernel cmdline 增加 initcall_debug ,然后dmesg > boot.log  bootgraph.pl boot.log >  boot.svg

BoardConfig-common.mk:
    BOARD_KERNEL_CMDLINE += initcall_debug ignore_loglevel

driver:
    .probe_type = PROBE_PREFER_ASYNCHRONOUS,

(6)电源优化

on init
    # Disable UFS powersaving
    write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 0
    write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 0
    write /sys/devices/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 0
    write /sys/module/lpm_levels/parameters/sleep_disabled Y
on property:sys.boot_completed=1
    # Enable UFS powersaving
    write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 1
    write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 1
    write /sys/devices/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1
    write /sys/module/lpm_levels/parameters/sleep_disabled N
on charger
    # Enable UFS powersaving
    write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 1
    write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 1
    write /sys/devices/soc/${ro.boot.bootdevice}/hibern8_on_idle_enable 1
    write /sys/class/typec/port0/port_type sink
    write /sys/module/lpm_levels/parameters/sleep_disabled N

参考:google pixel 手机

CONFIG_ANDROID_LOGGER=y
CONFIG_IMX134=y
CONFIG_IMX132=y
CONFIG_OV9724=y
CONFIG_OV5648=y
CONFIG_GC0339=y
CONFIG_OV8825=y
CONFIG_OV8865=y
CONFIG_s5k4e1=y
CONFIG_OV12830=y
CONFIG_USB_EHCI_HCD=y
CONFIG_IOMMU_IO_PGTABLE_FAST_SELFTEST=y
CONFIG_IKCONFIG=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_TI_DRV2667=y
CONFIG_CHR_DEV_SCH=y
CONFIG_MMC=y
CONFIG_MMC_PERF_PROFILING=y
CONFIG_MMC_CLKGATE=y
CONFIG_MMC_PARANOID_SD_INIT=y
CONFIG_MMC_BLOCK_MINORS=32
CONFIG_MMC_TEST=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_PLTFM=y
CONFIG_MMC_SDHCI_MSM=y
CONFIG_MMC_SDHCI_MSM_ICE=y
CONFIG_MMC_CQ_HCI=y
CONFIG_MSDOS_FS=y
# CONFIG_SYSFS_SYSCALL is not set
CONFIG_EEPROM_AT24=y
# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
CONFIG_INPUT_HBTP_INPUT=y
# CONFIG_VGA_ARB is not set
CONFIG_USB_MON=y
CONFIG_USB_STORAGE_DATAFAB=y
CONFIG_USB_STORAGE_FREECOM=y
CONFIG_USB_STORAGE_ISD200=y
CONFIG_USB_STORAGE_USBAT=y
CONFIG_USB_STORAGE_SDDR09=y
CONFIG_USB_STORAGE_SDDR55=y
CONFIG_USB_STORAGE_JUMPSHOT=y
CONFIG_USB_STORAGE_ALAUDA=y
CONFIG_USB_STORAGE_KARMA=y
CONFIG_USB_STORAGE_CYPRESS_ATACB=y
CONFIG_SW_SYNC_USER=y
CONFIG_SEEMP_CORE=y
CONFIG_MSM_SMEM_LOGGING=y
CONFIG_IOMMU_DEBUG=y
CONFIG_IOMMU_DEBUG_TRACKING=y
CONFIG_IOMMU_TESTS=y
CONFIG_MOBICORE_DRIVER=y
# CONFIG_DEBUG_PREEMPT is not set

 

二、android os部分优化

1、使用bootchart 生成图片的方式,结果生成的图片只有可怜的几项,跟网上相比丢失太多,原因未知。

2、决定使用Logcat来判断

三、zygote 预加载优化

diff --git a/base/preloaded-classes b/base/preloaded-classes
index fe2fba5..934a089 100644
--- a/base/preloaded-classes
+++ b/base/preloaded-classes
@@ -247,25 +247,25 @@
 [[S
 [[[I
 android.R$styleable
-android.accounts.Account
-android.accounts.Account$1
-android.accounts.AccountManager
-android.accounts.AccountManager$1
-android.accounts.AccountManager$11
-android.accounts.AccountManager$AmsTask
-android.accounts.AccountManager$AmsTask$1
-android.accounts.AccountManager$AmsTask$Response
-android.accounts.AccountManagerCallback
-android.accounts.AccountManagerFuture
-android.accounts.AccountsException
-android.accounts.AuthenticatorException
-android.accounts.IAccountManager
-android.accounts.IAccountManager$Stub
-android.accounts.IAccountManager$Stub$Proxy
-android.accounts.IAccountManagerResponse
-android.accounts.IAccountManagerResponse$Stub
-android.accounts.OnAccountsUpdateListener
-android.accounts.OperationCanceledException
+#android.accounts.Account
+#android.accounts.Account$1
+#android.accounts.AccountManager
+#android.accounts.AccountManager$1
+#android.accounts.AccountManager$11
+#android.accounts.AccountManager$AmsTask
+#android.accounts.AccountManager$AmsTask$1
+#android.accounts.AccountManager$AmsTask$Response
+#android.accounts.AccountManagerCallback
+#android.accounts.AccountManagerFuture
+#android.accounts.AccountsException
+#android.accounts.AuthenticatorException
+#android.accounts.IAccountManager
+#android.accounts.IAccountManager$Stub
+#android.accounts.IAccountManager$Stub$Proxy
+#android.accounts.IAccountManagerResponse
+#android.accounts.IAccountManagerResponse$Stub
+#android.accounts.OnAccountsUpdateListener
+#android.accounts.OperationCanceledException
 android.animation.AnimationHandler
 android.animation.AnimationHandler$1
 android.animation.AnimationHandler$2
@@ -963,15 +963,15 @@ android.hardware.Camera
 android.hardware.Camera$CameraInfo
 android.hardware.Camera$Face
 android.hardware.ConsumerIrManager
-android.hardware.Sensor
-android.hardware.SensorEvent
-android.hardware.SensorEventListener
-android.hardware.SensorManager
+#android.hardware.Sensor
+#android.hardware.SensorEvent
+#android.hardware.SensorEventListener
+#android.hardware.SensorManager
 android.hardware.SerialManager
 android.hardware.SerialPort
-android.hardware.SystemSensorManager
-android.hardware.SystemSensorManager$BaseEventQueue
-android.hardware.SystemSensorManager$SensorEventQueue
+#android.hardware.SystemSensorManager
+#android.hardware.SystemSensorManager$BaseEventQueue
+#android.hardware.SystemSensorManager$SensorEventQueue
 android.hardware.camera2.CameraCharacteristics$Key
 android.hardware.camera2.CameraManager
 android.hardware.camera2.CaptureRequest$Key
@@ -991,7 +991,7 @@ android.hardware.display.IDisplayManager$Stub$Proxy
 android.hardware.display.IDisplayManagerCallback
 android.hardware.display.IDisplayManagerCallback$Stub
 android.hardware.fingerprint.FingerprintManager
-android.hardware.hdmi.HdmiControlManager
+#android.hardware.hdmi.HdmiControlManager
 android.hardware.input.IInputDevicesChangedListener
 android.hardware.input.IInputDevicesChangedListener$Stub
 android.hardware.input.IInputManager
@@ -1009,27 +1009,27 @@ android.hardware.location.ContextHubManager
 android.hardware.location.ContextHubService
 android.hardware.location.IContextHubService
 android.hardware.location.IContextHubService$Stub
-android.hardware.radio.RadioManager
-android.hardware.radio.RadioManager$AmBandConfig
-android.hardware.radio.RadioManager$AmBandConfig$1
-android.hardware.radio.RadioManager$AmBandDescriptor
-android.hardware.radio.RadioManager$AmBandDescriptor$1
-android.hardware.radio.RadioManager$BandConfig
-android.hardware.radio.RadioManager$BandConfig$1
-android.hardware.radio.RadioManager$BandDescriptor
-android.hardware.radio.RadioManager$BandDescriptor$1
-android.hardware.radio.RadioManager$FmBandConfig
-android.hardware.radio.RadioManager$FmBandConfig$1
-android.hardware.radio.RadioManager$FmBandDescriptor
-android.hardware.radio.RadioManager$FmBandDescriptor$1
-android.hardware.radio.RadioManager$ModuleProperties
-android.hardware.radio.RadioManager$ModuleProperties$1
-android.hardware.radio.RadioManager$ProgramInfo
-android.hardware.radio.RadioManager$ProgramInfo$1
-android.hardware.radio.RadioMetadata
-android.hardware.radio.RadioMetadata$1
-android.hardware.radio.RadioModule
-android.hardware.radio.RadioTuner
+#android.hardware.radio.RadioManager
+#android.hardware.radio.RadioManager$AmBandConfig
+#android.hardware.radio.RadioManager$AmBandConfig$1
+#android.hardware.radio.RadioManager$AmBandDescriptor
+#android.hardware.radio.RadioManager$AmBandDescriptor$1
+#android.hardware.radio.RadioManager$BandConfig
+#android.hardware.radio.RadioManager$BandConfig$1
+#android.hardware.radio.RadioManager$BandDescriptor
+#android.hardware.radio.RadioManager$BandDescriptor$1
+#android.hardware.radio.RadioManager$FmBandConfig
+#android.hardware.radio.RadioManager$FmBandConfig$1
+#android.hardware.radio.RadioManager$FmBandDescriptor
+#android.hardware.radio.RadioManager$FmBandDescriptor$1
+#android.hardware.radio.RadioManager$ModuleProperties
+#android.hardware.radio.RadioManager$ModuleProperties$1
+#android.hardware.radio.RadioManager$ProgramInfo
+#android.hardware.radio.RadioManager$ProgramInfo$1
+#android.hardware.radio.RadioMetadata
+#android.hardware.radio.RadioMetadata$1
+#android.hardware.radio.RadioModule
+#android.hardware.radio.RadioTuner
 android.hardware.soundtrigger.SoundTrigger
 android.hardware.soundtrigger.SoundTrigger$ConfidenceLevel
 android.hardware.soundtrigger.SoundTrigger$ConfidenceLevel$1
@@ -1555,24 +1555,24 @@ android.net.wifi.WifiSsid
 android.net.wifi.WifiSsid$1
 android.net.wifi.nan.WifiNanManager
 android.net.wifi.p2p.WifiP2pManager
-android.nfc.IAppCallback
-android.nfc.IAppCallback$Stub
-android.nfc.INfcAdapter
-android.nfc.INfcAdapter$Stub
-android.nfc.INfcAdapter$Stub$Proxy
-android.nfc.INfcCardEmulation
-android.nfc.INfcCardEmulation$Stub
-android.nfc.INfcCardEmulation$Stub$Proxy
-android.nfc.INfcFCardEmulation
-android.nfc.INfcFCardEmulation$Stub
-android.nfc.INfcFCardEmulation$Stub$Proxy
-android.nfc.INfcTag
-android.nfc.INfcTag$Stub
-android.nfc.INfcTag$Stub$Proxy
-android.nfc.NfcActivityManager
-android.nfc.NfcAdapter
-android.nfc.NfcAdapter$1
-android.nfc.NfcManager
+#android.nfc.IAppCallback
+#android.nfc.IAppCallback$Stub
+#android.nfc.INfcAdapter
+#android.nfc.INfcAdapter$Stub
+#android.nfc.INfcAdapter$Stub$Proxy
+#android.nfc.INfcCardEmulation
+#android.nfc.INfcCardEmulation$Stub
+#android.nfc.INfcCardEmulation$Stub$Proxy
+#android.nfc.INfcFCardEmulation
+#android.nfc.INfcFCardEmulation$Stub
+#android.nfc.INfcFCardEmulation$Stub$Proxy
+#android.nfc.INfcTag
+#android.nfc.INfcTag$Stub
+#android.nfc.INfcTag$Stub$Proxy
+#android.nfc.NfcActivityManager
+#android.nfc.NfcAdapter
+#android.nfc.NfcAdapter$1
+#android.nfc.NfcManager
 android.opengl.EGL14
 android.opengl.EGLConfig
 android.opengl.EGLContext

四、app相关优化

1、去除不需要的app以及相关库

diff --git a/target/product/core.mk b/target/product/core.mk
index c315bb4..7e7c612 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -21,21 +21,13 @@
 # core_tiny.mk in addition to core_minimal.mk.
 
 PRODUCT_PACKAGES += \
-    BasicDreams \
     BlockedNumberProvider \
     BookmarkProvider \
-    Browser2 \
-    Calendar \
-    CalendarProvider \
     CaptivePortalLogin \
     CertInstaller \
     Contacts \
-    DeskClock \
     DocumentsUI \
     DownloadProviderUi \
-    Email \
-    ExactCalculator \
-    Exchange2 \
     ExternalStorageProvider \
     FusedLocation \
     InputDevices \
@@ -48,12 +40,9 @@ PRODUCT_PACKAGES += \
     PicoTts \
     PacProcessor \
     libpac \
-    PrintSpooler \
     PrintRecommendationService \
     ProxyHandler \
-    QuickSearchBox \
     Settings \
-    SharedStorageBackup \
     StorageManager \
     Telecom \
     TeleService \
diff --git a/target/product/core_base.mk b/target/product/core_base.mk
index 03d33e1..d02b058 100644
--- a/target/product/core_base.mk
+++ b/target/product/core_base.mk
@@ -33,7 +33,6 @@ PRODUCT_PACKAGES += \
     libfilterpack_imageproc \
     libgabi++ \
     libmdnssd \
-    libnfc_ndef \
     libpowermanager \
     libspeexresampler \
     libstagefright_soft_aacdec \
diff --git a/target/product/full_base.mk b/target/product/full_base.mk
index 65bdf0f..2f8eef5 100644
--- a/target/product/full_base.mk
+++ b/target/product/full_base.mk
@@ -25,17 +25,12 @@ PRODUCT_PACKAGES := \
     libWnnEngDic \
     libWnnJpnDic \
     libwnndict \
-    WAPPushManager
 
 PRODUCT_PACKAGES += \
-    Galaxy4 \
     HoloSpiralWallpaper \
-    LiveWallpapers \
-    LiveWallpapersPicker \
     MagicSmokeWallpapers \
     NoiseField \
     PhaseBeam \
-    PhotoTable
 
 # Additional settings used in all AOSP builds
 PRODUCT_PROPERTY_OVERRIDES := \
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index 5c48358..be3ed0d 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -21,7 +21,6 @@ PRODUCT_PACKAGES := \
     Bluetooth \
     BluetoothMidiService \
     Camera2 \
-    Gallery2 \
     Music \
     MusicFX \
     OneTimeInitializer \
diff --git a/target/product/telephony.mk b/target/product/telephony.mk
index e840ba1..60ede56 100644
--- a/target/product/telephony.mk
+++ b/target/product/telephony.mk
@@ -21,7 +21,6 @@ PRODUCT_PACKAGES := \
     CarrierConfig \
     Dialer \
     CallLogBackup \
-    CellBroadcastReceiver \
     EmergencyInfo \
     rild

2、languages_full.mk,locales_full.mk: 去除不需要的语言设置(可以去除res包的大小)

五、Bootanimation

控制动画包中资源数量及大小,另外考虑缩短循环播放和结尾的时间。

调试手段:
禁用开机动画:将”debug.sf.nobootanimation”设为”1” device/qcom/msm8996/system.prop
禁用锁屏:将”def_lockscreen_disabled”设为”true” frameworks/base/packages/SettingsProvider/res/values/defaults.xml

六、提升CPU频率 - 将所有CPU切换至性能模式

adb shell stop perf-hal-1-0

adb shell "echo 1 > /sys/devices/system/cpu/cpu0/online"
adb shell "echo 1 > /sys/devices/system/cpu/cpu1/online"
adb shell "echo 1 > /sys/devices/system/cpu/cpu2/online"
adb shell "echo 1 > /sys/devices/system/cpu/cpu3/online"
adb shell "echo 1 > /sys/devices/system/cpu/cpu4/online"
adb shell "echo 1 > /sys/devices/system/cpu/cpu5/online"
adb shell "echo 1 > /sys/devices/system/cpu/cpu6/online"
adb shell "echo 1 > /sys/devices/system/cpu/cpu7/online"

adb shell "echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
adb shell "echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor"
adb shell "echo performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor"
adb shell "echo performance > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor"
adb shell "echo performance > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor"
adb shell "echo performance > /sys/devices/system/cpu/cpu5/cpufreq/scaling_governor"
adb shell "echo performance > /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor"
adb shell "echo performance > /sys/devices/system/cpu/cpu7/cpufreq/scaling_governor"

adb shell "echo performance > /sys/class/devfreq/soc:qcom,cpubw/governor"
adb shell "echo performance > /sys/class/devfreq/soc:qcom,mincpubw/governor"
adb shell "echo performance > /sys/class/devfreq/soc:qcom,memlat-cpu0/governor"
adb shell "echo performance > /sys/class/devfreq/soc:qcom, memlat-cpu6/governor"

七、提升GPU频率

adb shell "echo 0 > /sys/class/kgsl/kgsl-3d0/min_pwrlevel"
adb shell "echo 1 > /sys/class/kgsl/kgsl-3d0/force_clk_on"
adb shell "echo performance > /sys/class/kgsl/kgsl-3d0/devfreq/governor"

八、

 

 

 

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值