init: wait for '/dev/block/bootdevice/by-name/cache' timed out and took 5007ms【学习笔记】
平台信息:
内核:4.9.112
系统:android one
平台:qcom sdm439
作者:庄泽彬(欢迎转载,请注明作者)
一、android设备在开机的时候打印了如下的log,由于系统使用了AB分区,把cache分区和recovery分区干掉了,因此在init.rc文件中等待cache分区的挂载肯定会失败,这样会导致系统开机的时间变慢5秒,因此这部分需要优化,提高系统的开机速度:
1 [ 25.411599] init: wait for '/dev/block/bootdevice/by-name/cache' timed out and took 5007ms 2 [ 25.411892] init: Command 'wait /dev/block/bootdevice/by-name/cache' action=charger (/system/etc/init/init.xxx.rc:187) took 5007ms and failed: wait_for_file() failed
二、修改方法,找到对应的init.xxx.rc文件:
1 on bootlog 2 # wait /dev/block/bootdevice/by-name/cache 3 start logcat_boot 4 start kmsg_boot
三、测试对比
1 未优化之前的时间: 2 [ 25.206440] Boot completed 3 [ 24.588259] Boot completed 4 [ 24.287756] Boot completed 5 [ 24.073655] Boot completed 6 7 8 优化之后的时间: 9 [ 22.822842] Boot completed 10 [ 22.647295] Boot completed 11 [ 22.641041] Boot completed 12 [ 22.605505] Boot completed