赞
踩
开机时长是系统优化的重点,下面将从几个方面进行优化:
缩减Uboot 阶段启动内容:
diff --git a/board/amlogic/configs/g12a_u202_v1.h b/board/amlogic/configs/g12a_u202_v1.h index 4cb206c..aa4a9cb 100755 --- a/board/amlogic/configs/g12a_u202_v1.h +++ b/board/amlogic/configs/g12a_u202_v1.h @@ -151,7 +151,6 @@ "get_bootloaderversion;" \ "setenv bootargs ${initargs} ${fs_type} otg_device=${otg_device} reboot_mode_android=${reboot_mode_android} logo=${display_layer},loaded,${fb_addr} vout2=${outputmode2}, vout=${outputmode},enable panel_type=${panel_type} lcd_ctrl=${lcd_ctrl} hdmitx=${cecconfig},${colorattribute} hdmimode=${hdmimode} hdmichecksum=${hdmichecksum} dolby_vision_on=${dolby_vision_on} frac_rate_policy=${frac_rate_policy} hdmi_read_edid=${hdmi_read_edid} cvbsmode=${cvbsmode} osd_reverse=${osd_reverse} video_reverse=${video_reverse} irq_check_en=${Irq_check_en} androidboot.selinux=${EnableSelinux} androidboot.firstboot=${firstboot} jtag=${jtag}; "\ "setenv bootargs ${bootargs} androidboot.hardware=amlogic androidboot.bootloader=${bootloader_version} androidboot.build.expect.baseband=N/A;"\ - "run cmdline_keys;"\ "\0"\ "switch_bootmode="\ "get_rebootmode;"\ @@ -349,7 +348,6 @@ "run bcb_cmd; "\ "run factory_reset_poweroff_protect;"\ "run upgrade_check;"\ - "run bootcount_check;"\ "run init_display;"\ "run storeargs;"\ "run upgrade_key;" \ --
1.关闭Kernel 打印,quiet bootargs
diff --git a/board/amlogic/configs/g12a_u202_v1.h b/board/amlogic/configs/g12a_u202_v1.h
index 370638d..4cb206c 100755
--- a/board/amlogic/configs/g12a_u202_v1.h
+++ b/board/amlogic/configs/g12a_u202_v1.h
@@ -136,7 +136,7 @@
"fs_type=""rootfstype=ramfs""\0"\
"initargs="\
"init=/init console=ttyS0,115200 no_console_suspend earlycon=aml-uart,0xff803000 "\
- "ramoops.pstore_en=1 ramoops.record_size=0x8000 ramoops.console_size=0x4000 raid=noautodetect "\
+ "ramoops.pstore_en=1 ramoops.record_size=0x8000 ramoops.console_size=0x4000 raid=noautodetect quiet "\
"\0"\
"upgrade_check="\
"echo upgrade_step=${upgrade_step}; "\
2.不启动不用的模块
diff --git a/arch/arm/configs/meson64_a32_defconfig b/arch/arm/configs/meson64_a32_defconfig index a0964bf..5ee8f3f 100755 --- a/arch/arm/configs/meson64_a32_defconfig +++ b/arch/arm/configs/meson64_a32_defconfig @@ -285,7 +285,7 @@ CONFIG_AMLOGIC_VIDEOBUF_RESOURCE=y CONFIG_AMLOGIC_MEDIA_VIDEO=y CONFIG_AMLOGIC_MEDIA_VIDEOCAPTURE=y CONFIG_AMLOGIC_VOUT=y -CONFIG_AMLOGIC_CVBS_OUTPUT=y +#CONFIG_AMLOGIC_CVBS_OUTPUT=y CONFIG_AMLOGIC_WSS=y CONFIG_AMLOGIC_VDAC=y CONFIG_AMLOGIC_HDMITX=y @@ -358,8 +358,8 @@ CONFIG_AMLOGIC_GX_SUSPEND=y CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND=y CONFIG_AMLOGIC_LED=y CONFIG_AMLOGIC_LED_SYS=y -CONFIG_AMLOGIC_JTAG=y -CONFIG_AMLOGIC_JTAG_MESON=y +#CONFIG_AMLOGIC_JTAG=y +#CONFIG_AMLOGIC_JTAG_MESON=y CONFIG_AMLOGIC_WDT=y CONFIG_AMLOGIC_WDT_MESON=y CONFIG_AMLOGIC_WDT_MESON_V3=y @@ -367,7 +367,7 @@ CONFIG_AMLOGIC_ESM=y CONFIG_AMLOGIC_WIFI=y CONFIG_AMLOGIC_BT_DEVICE=y CONFIG_AMLOGIC_POWER=y -CONFIG_AMLOGIC_PCIE=y +#CONFIG_AMLOGIC_PCIE=y CONFIG_AMLOGIC_IRBLASTER_CORE=y CONFIG_AMLOGIC_IRBLASTER_MESON=y CONFIG_AMLOGIC_IRBLASTER_PROTOCOL=y @@ -393,10 +393,10 @@ CONFIG_DEVTMPFS_MOUNT=y CONFIG_DMA_CMA=y CONFIG_CMA_SIZE_MBYTES=8 CONFIG_CONNECTOR=y -CONFIG_MTD=y -CONFIG_MTD_CMDLINE_PARTS=y -CONFIG_MTD_BLOCK=y -CONFIG_MTD_OOPS=y +#CONFIG_MTD=y +#CONFIG_MTD_CMDLINE_PARTS=y +#CONFIG_MTD_BLOCK=y +#CONFIG_MTD_OOPS=y #CONFIG_MTD_NAND=y #CONFIG_MTD_SPI_NOR=y #CONFIG_MTD_UBI=y @@ -591,7 +591,7 @@ CONFIG_FUSE_FS=y CONFIG_JOLIET=y CONFIG_ZISOFS=y CONFIG_UDF_FS=y -CONFIG_MSDOS_FS=y +#CONFIG_MSDOS_FS=y CONFIG_VFAT_FS=y CONFIG_EXFAT_FS=y CONFIG_NTFS_FS=y
根据实际需求,去除不需要的kernel 模块
目前来看,Kernel 这两部分的修改,效果比较明显。可以优化4-5s
1.preloaded-classes & preloaded_drawables
diff --git a/config/preloaded-classes b/config/preloaded-classes index 0014793..14bae46 100644 --- a/config/preloaded-classes +++ b/config/preloaded-classes @@ -1253,10 +1253,6 @@ android.hardware.ICameraService$Stub android.hardware.ICameraService$Stub$Proxy android.hardware.ICameraServiceListener android.hardware.ICameraServiceListener$Stub -android.hardware.Sensor -android.hardware.SensorEvent -android.hardware.SensorEventListener -android.hardware.SensorManager android.hardware.SerialManager android.hardware.SerialPort android.hardware.SystemSensorManager @@ -1887,52 +1883,6 @@ android.icu.util.UResourceBundleIterator android.icu.util.UResourceTypeMismatchException android.icu.util.VersionInfo android.inputmethodservice.SoftInputWindow -android.location.Address -android.location.Address$1 -android.location.BatchedLocationCallbackTransport -android.location.BatchedLocationCallbackTransport$CallbackTransport -android.location.Country$1 -android.location.CountryDetector -android.location.Criteria$1 -android.location.Geocoder
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml index f6a5787..50558ff 100644 --- a/core/res/res/values/arrays.xml +++ b/core/res/res/values/arrays.xml @@ -23,7 +23,7 @@ the zygote process before it starts forking application processes. --> <array name="preloaded_drawables"> <item>@drawable/toast_frame</item> - <item>@drawable/btn_check_on_pressed_holo_light</item> +<!-- <item>@drawable/btn_check_on_pressed_holo_light</item> <item>@drawable/btn_check_on_pressed_holo_dark</item> <item>@drawable/btn_check_on_holo_light</item> <item>@drawable/btn_check_on_holo_dark</item> @@ -64,7 +64,7 @@ <item>@drawable/btn_radio_off_disabled_holo_light</item> <item>@drawable/btn_radio_off_disabled_holo_dark</item> <item>@drawable/btn_radio_off_disabled_focused_holo_light</item> - <item>@drawable/btn_radio_off_disabled_focused_holo_dark</item> + <item>@drawable/btn_radio_off_disabled_focused_holo_dark</item>--> <item>@drawable/btn_default_pressed_holo_light</item> <item>@drawable/btn_default_pressed_holo_dark</item> <item>@drawable/btn_default_normal_holo_light</item> @@ -77,7 +77,7 @@ <item>@drawable/btn_default_disabled_focused_holo_dark</item> <item>@drawable/btn_default_holo_dark</item> <item>@drawable/btn_default_holo_light</item> - <item>@drawable/btn_star_off_normal_holo_light</item> + <!--<item>@drawable/btn_star_off_normal_holo_light</item> <item>@drawable/btn_star_on_normal_holo_light</item> <item>@drawable/btn_star_on_disabled_holo_light</item> <item>@drawable/btn_star_off_disabled_holo_light</item>
2.SystemServer 不启动无关的service
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 1880e9f..eecb9ed 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -796,10 +796,10 @@ public final class SystemServer { mSystemServiceManager.startService(TelecomLoaderService.class); traceEnd(); - traceBeginAndSlog("StartTelephonyRegistry"); - telephonyRegistry = new TelephonyRegistry(context); - ServiceManager.addService("telephony.registry", telephonyRegistry); - traceEnd(); +// traceBeginAndSlog("StartTelephonyRegistry"); +// telephonyRegistry = new TelephonyRegistry(context); +// ServiceManager.addService("telephony.registry", telephonyRegistry); +// traceEnd(); traceBeginAndSlog("StartEntropyMixer"); mEntropyMixer = new EntropyMixer(context); @@ -1061,9 +1061,9 @@ public final class SystemServer { traceEnd(); } - traceBeginAndSlog("StartClipboardService"); - mSystemServiceManager.startService(ClipboardService.class); - traceEnd(); +// traceBeginAndSlog("StartClipboardService"); +// mSystemServiceManager.startService(ClipboardService.class); +// traceEnd(); traceBeginAndSlog("StartNetworkManagementService"); try { @@ -1273,15 +1273,15 @@ public final class SystemServer { traceEnd(); } - traceBeginAndSlog("StartWiredAccessoryManager"); - try { - // Listen for wired headset changes - inputManager.setWiredAccessoryCallbacks( - new WiredAccessoryManager(context, inputManager)); - } catch (Throwable e) { - reportWtf("starting WiredAccessoryManager", e); - } - traceEnd(); +// traceBeginAndSlog("StartWiredAccessoryManager"); +// try { +// // Listen for wired headset changes +// inputManager.setWiredAccessoryCallbacks( +// new WiredAccessoryManager(context, inputManager)); +// } catch (Throwable e) { +// reportWtf("starting WiredAccessoryManager", e); +// } +// traceEnd(); if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_MIDI)) { // Start MIDI Manager service @@ -1508,11 +1508,11 @@ public final class SystemServer { } traceEnd(); - if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) { - traceBeginAndSlog("StartFingerprintSensor"); - mSystemServiceManager.startService(FingerprintService.class); - traceEnd(); - } +// if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) { +// traceBeginAndSlog("StartFingerprintSensor"); +// mSystemServiceManager.startService(FingerprintService.class); +// traceEnd(); +// }
3.Systemui
startServicesIfNeeded
减少config_systemUIServiceComponents 启动的服务
frameworks/base/packages/SystemUI/res/values/config.xml
string-array name="config_systemUIServiceComponents" translatable="false"> <item>com.android.systemui.Dependency</item> <item>com.android.systemui.util.NotificationChannels</item> <item>com.android.systemui.statusbar.CommandQueue$CommandQueueStart</item> <item>com.android.systemui.keyguard.KeyguardViewMediator</item> <item>com.android.systemui.recents.Recents</item> <item>com.android.systemui.volume.VolumeUI</item> <item>com.android.systemui.stackdivider.Divider</item> <item>com.android.systemui.SystemBars</item> <item>com.android.systemui.usb.StorageNotification</item> <item>com.android.systemui.power.PowerUI</item> <item>com.android.systemui.media.RingtonePlayer</item> <item>com.android.systemui.keyboard.KeyboardUI</item> <item>com.android.systemui.pip.PipUI</item> <item>com.android.systemui.shortcut.ShortcutKeyDispatcher</item> <item>@string/config_systemUIVendorServiceComponent</item> <item>com.android.systemui.util.leak.GarbageMonitor$Service</item> <item>com.android.systemui.LatencyTester</item> <item>com.android.systemui.globalactions.GlobalActionsComponent</item> <item>com.android.systemui.ScreenDecorations</item> <item>com.android.systemui.fingerprint.FingerprintDialogImpl</item> <item>com.android.systemui.SliceBroadcastRelayHandler</item> <item>com.android.systemui.funshion.gesture.GestureBarUI</item> <item>com.android.systemui.funshion.floatball.FloatshortcutUI</item> <item>com.android.systemui.funshion.eye.EyeShieldBarUI</item> <item>com.android.systemui.funshion.micmute.MicMuteUI</item> </string-array>
可根据实际需要进行裁剪
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。