# Mount filesystems and start core system services.onlate-inittriggerearly-fs# Mount fstab in init.{$device}.rc by mount_all command. Optional parameter# '--early' can be specified to skip entries with 'latemount'.# /system and /vendor must be mounted by the end of the fs stage,# while /data is optional.triggerfstriggerpost-fs# Mount fstab in init.{$device}.rc by mount_all with '--late' parameter# to only mount entries with 'latemount'. This is needed if '--early' is# specified in the previous mount_all command on the fs stage.# With /system mounted and properties form /system + /factory available,# some services can be started.triggerlate-fs# Now we can mount /data. File encryption requires keymaster to decrypt# /data, which in turn can only be loaded when system properties are present.triggerpost-fs-data# Load persist properties and override properties (if enabled) from /data.triggerload_persist_props_action# Should be before netd, but after apex, properties and logging is available.triggerload_bpf_programs# Now we can start zygote for devices with file based encryption# 触发zygote启动triggerzygote-start# Remove a file to wake up anything waiting for firmware.triggerfirmware_mounts_completetriggerearly-boottriggerboot
3.2 并行执行uevent(enable_parallel_restorecon)
vendor/ueventd.rc中加入parallel_restorecon enable
1
parallel_restorecon enable
3.3 CPU 打开性能模式
1 开机的时候,cpu开启性能模式
1
2
3
4
5
on early-init
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor performance
# 查看当前频率
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
2 开机后关闭,改成自动适应
1
on property:sys.boot_completed=1 write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor schedutil
4 移除没有用到的模块
比如: 如CI模块
1
2
3
on post-fs-data
insmod /vendor/lib/modules/cimax-usb.ko
insmod /vendor/lib/modules/ci.ko
5 延迟vendor/etc/init下的非关键服务
放在early-boot或者boot阶段执行,加快zygote的启动
1
2
3
4
5
6
// 放在early-boot或者boot阶段执行
on boot
start xxx
service xxx /system/bin/xxx
user root
group system
/** Turn off the verifier. */
public static final int DISABLE_VERIFIER = 1 << 9;
1
2
3
4
5
6
7
8
9
parsedArgs.mRuntimeFlags |= Zygote.DISABLE_VERIFIER;
/* Request to fork the system server process */
pid = Zygote.forkSystemServer(
parsedArgs.mUid, parsedArgs.mGid,
parsedArgs.mGids,
parsedArgs.mRuntimeFlags,
null,
parsedArgs.mPermittedCapabilities,
parsedArgs.mEffectiveCapabilities);