wahoo: improve boot time and pull in bootanim display time

1) separate fstab mount
2) launch bootanim early
3) boottime cpuset/io tune
4) parallel slow init operations: write sysfs and insmod

After CL:
Boot time saved 330ms, bootanim triggered early before data/ mounted

Bug: 36780513
Test: walleye boots
Change-Id: I02803179746710413f4b1e2372f3550cd95d1581
This commit is contained in:
Wei Wang
2017-03-30 16:05:32 -07:00
parent b1a2a67cf8
commit e0fc600245
10 changed files with 173 additions and 32 deletions

View File

@@ -66,6 +66,9 @@ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/init.radio.sh:system/bin/init.radio.sh \
$(LOCAL_PATH)/uinput-fpc.kl:system/usr/keylayout/uinput-fpc.kl \
$(LOCAL_PATH)/uinput-fpc.idc:system/usr/idc/uinput-fpc.idc \
$(LOCAL_PATH)/init.qcom.devstart.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.devstart.sh \
$(LOCAL_PATH)/init.qcom.ipastart.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.ipastart.sh \
$(LOCAL_PATH)/init.insmod.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.insmod.sh
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_COPY_FILES += \

View File

@@ -36,15 +36,46 @@ on early-init
chmod 0755 /sys/kernel/debug
on init
# Loading kernel modules in background
start insmod_sh
# Support legacy paths
symlink /sdcard /mnt/sdcard
symlink /sdcard /storage/sdcard0
# disable thermal hotplug for thermal
write /sys/module/msm_thermal/core_control/enabled 0
# bring back all cores
write /sys/devices/system/cpu/cpu0/online 1
write /sys/devices/system/cpu/cpu1/online 1
write /sys/devices/system/cpu/cpu2/online 1
write /sys/devices/system/cpu/cpu3/online 1
write /sys/devices/system/cpu/cpu4/online 1
write /sys/devices/system/cpu/cpu5/online 1
write /sys/devices/system/cpu/cpu6/online 1
write /sys/devices/system/cpu/cpu7/online 1
# configure governor settings for little cluster
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "sched"
# configure governor settings for big cluster
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor "sched"
start power_sh
# enable all cores for all cpuset during boot
write /dev/cpuset/top-app/cpus 0-7
write /dev/cpuset/foreground/cpus 0-7
write /dev/cpuset/foreground/boost/cpus 0-7
write /dev/cpuset/background/cpus 0-7
write /dev/cpuset/system-background/cpus 0-7
# set default schedTune value for foreground/top-app
write /dev/stune/foreground/schedtune.prefer_idle 1
write /dev/stune/top-app/schedtune.boost 10
write /dev/stune/top-app/schedtune.prefer_idle 1
on fs
wait /dev/block/platform/soc/${ro.boot.bootdevice}
symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
mount_all fstab.${ro.hardware}
mount_all fstab.${ro.hardware} --early
swapon_all fstab.${ro.hardware}
# Keeping following partitions outside fstab file. As user may not have
@@ -56,6 +87,24 @@ on fs
restorecon_recursive /persist
mkdir /persist/data 0700 system system
# Start HW service manager early
start hwservicemanager
on late-fs
# Start devices by sysfs trigger
start devstart_sh
# Start services for bootanim
start servicemanager
start vr_wm
start surfaceflinger
start bootanim
start hwcomposer-2-1
start configstore-hal-1-0
start gralloc-2-0
# Mount RW partitions which need run fsck
mount_all fstab.${ro.hardware} --late
on post-fs
# set RLIMIT_MEMLOCK to 64MB
setrlimit 8 67108864 67108864
@@ -63,20 +112,23 @@ on post-fs
# Since bootloader does not have a UI turn screen ON
write /sys/class/leds/lcd-backlight/brightness 255
# Enable audio and video device for bootanim
write /sys/kernel/boot_adsp/boot 1
write /sys/kernel/boot_slpi/boot 1
start qseecomd
chmod 0664 /sys/devices/virtual/graphics/fb0/idle_time
chown system graphics /sys/devices/virtual/graphics/fb0/idle_time
on property:sys.listeners.registered=true
# load IPA FWs
write /dev/ipa 1
start ipastart_sh
on post-fs-data
# We can start netd here before in is launched in common init.rc on zygote-start
start netd
# Start qseecomd once we have /data/
start qseecomd
# zygote need to be started after otapreopt which will be done on post-fs-data
on zygote-start
# zygote is started in common init.rc
# and now we can continue initialize /data/
mkdir /data/tombstones 0771 system system
mkdir /tombstones/modem 0771 system system
mkdir /tombstones/lpass 0771 system system
@@ -190,26 +242,10 @@ on post-fs-data
setprop vold.post_fs_data_done 1
on early-boot
exec - root root system -- /system/bin/init.power.sh
# update cpusets now that processors are up
# initialize for Silver Only first and then Silver + Gold
# Silver Only configuration cannot work with 0-7
write /dev/cpuset/top-app/cpus 0-3
write /dev/cpuset/foreground/cpus 0-3
write /dev/cpuset/foreground/boost/cpus 0-3
write /dev/cpuset/background/cpus 0-3
write /dev/cpuset/system-background/cpus 0-3
write /dev/cpuset/top-app/cpus 0-7
write /dev/cpuset/foreground/cpus 0-7
write /dev/cpuset/foreground/boost/cpus 0-7
write /dev/cpuset/background/cpus 0-7
write /dev/cpuset/system-background/cpus 0-7
# set default schedTune value for foreground/top-app
write /dev/stune/foreground/schedtune.prefer_idle 1
write /dev/stune/top-app/schedtune.boost 10
write /dev/stune/top-app/schedtune.prefer_idle 1
# wait for devices
wait_for_prop sys.qcom.devup 1
# wait for insmod_sh to finish all modules
wait_for_prop sys.all.modules.ready 1
on boot
mkdir /dev/socket/qmux_radio 0770 radio radio
@@ -485,3 +521,31 @@ service bugreport /system/bin/dumpstate -d -p -B -z \
service chre /vendor/bin/chre
class late_start
socket chre seqpacket 0660 root system
service power_sh /system/bin/init.power.sh
class main
user root
group root system
disabled
oneshot
service devstart_sh /vendor/bin/init.qcom.devstart.sh
class main
user root
group root system
disabled
oneshot
service ipastart_sh /vendor/bin/init.qcom.ipastart.sh
class main
user system
group net_admin
disabled
oneshot
service insmod_sh /vendor/bin/init.insmod.sh
class main
user root
group root system
disabled
oneshot

24
init.insmod.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/system/bin/sh
#########################################
### init.insmod.cfg format: ###
### --------------------------------- ###
### [insmod|setprop] [path|prop name] ###
### ... ###
#########################################
cfg_file="/vendor/etc/init.insmod.cfg"
if [ -f $cfg_file ]; then
while IFS=" " read -r action name
do
case $action in
"insmod") insmod $name ;;
"setprop") setprop $name 1 ;;
esac
done < $cfg_file
fi
# set property even if there is no insmod config
# as property value "1" is expected in early-boot trigger
setprop sys.all.modules.ready 1

5
init.qcom.devstart.sh Normal file
View File

@@ -0,0 +1,5 @@
#!/system/bin/sh
echo 1 > /sys/kernel/boot_adsp/boot
echo 1 > /sys/kernel/boot_slpi/boot
setprop sys.qcom.devup 1

3
init.qcom.ipastart.sh Normal file
View File

@@ -0,0 +1,3 @@
#!/system/bin/sh
echo 1 > /dev/ipa

View File

@@ -90,6 +90,8 @@ sys/devices/bt_wcn[0-9]+/rfkill/rfkill0/state u:object_r:s
/sys/devices/soc/caa4000\.qcom,fd(/.*)? u:object_r:sysfs_camera:s0
/sys/bus/msm_subsys(/.*)? u:object_r:sysfs_msm_subsys:s0
/sys/module/subsystem_restart u:object_r:sysfs_msm_subsys_restart:s0
/sys/kernel/boot_adsp/boot u:object_r:sysfs_msm_subsys:s0
/sys/kernel/boot_slpi/boot u:object_r:sysfs_msm_subsys:s0
# files in debugfs
/sys/kernel/debug/rpm_stats u:object_r:debugfs_rpm:s0
@@ -137,6 +139,10 @@ sys/devices/bt_wcn[0-9]+/rfkill/rfkill0/state u:object_r:s
/vendor/bin/chre u:object_r:chre_exec:s0
/vendor/bin/folio_daemon u:object_r:folio_daemon_exec:s0
/vendor/bin/time_daemon u:object_r:time_daemon_exec:s0
/vendor/bin/init\.qcom\.devstart\.sh u:object_r:init-qcom-devstart-sh_exec:s0
/vendor/bin/init\.qcom\.ipastart\.sh u:object_r:init-qcom-ipastart-sh_exec:s0
/vendor/bin/init\.insmod\.sh u:object_r:init-insmod-sh_exec:s0
/vendor/etc/init\.insmod\.cfg u:object_r:init-insmod-sh_exec:s0
# data files
/data/misc/radio(/.*)? u:object_r:radio_data_file:s0

View File

@@ -0,0 +1,15 @@
type init-qcom-devstart-sh, domain;
type init-qcom-devstart-sh_exec, exec_type, file_type;
init_daemon_domain(init-qcom-devstart-sh)
allow init-qcom-devstart-sh shell_exec:file rx_file_perms;
# execute toybox/toolbox
allow init-qcom-devstart-sh toolbox_exec:file rx_file_perms;
# Set the sys.qcom.devup property
set_prop(init-qcom-devstart-sh, system_prop)
# Set boot_adsp and boot_slpi to 1
allow init-qcom-devstart-sh sysfs_msm_subsys:file w_file_perms;

View File

@@ -0,0 +1,16 @@
type init-insmod-sh, domain;
type init-insmod-sh_exec, exec_type, file_type;
init_daemon_domain(init-insmod-sh)
allow init-insmod-sh shell_exec:file rx_file_perms;
# execute toybox/toolbox
allow init-insmod-sh toolbox_exec:file rx_file_perms;
# Set the sys.touch.modules.ready property
set_prop(init-insmod-sh, system_prop)
# Allow insmod
allow init-insmod-sh self:capability sys_module;
allow init-insmod-sh system_file:system module_load;

View File

@@ -0,0 +1,9 @@
type init-qcom-ipastart-sh, domain;
type init-qcom-ipastart-sh_exec, exec_type, file_type;
init_daemon_domain(init-qcom-ipastart-sh)
allow init-qcom-ipastart-sh shell_exec:file rx_file_perms;
# Set /dev/ipa to 1
allow init-qcom-ipastart-sh ipa_dev:chr_file w_file_perms;

View File

@@ -2,14 +2,10 @@
allow init tmpfs:lnk_file create;
allow init configfs:lnk_file create;
allow init self:capability sys_module;
allow init sda_block_device:blk_file relabelto;
allow init system_file:system module_load;
allow init firmware_file:dir mounton;
allow init configfs:file w_file_perms;
allow init tty_device:chr_file rw_file_perms;
allow init ipa_dev:chr_file w_file_perms;
allow init persist_file:dir mounton;