flo: Accelerate boot by paralleling device enable

Some QCOM devices require sysfs to trigger boot/init which are blocking
the init process.
[    7.453205] init: Command 'write /sys/kernel/boot_adsp/boot 1' action=post-fs-data (/init.angler.rc:166) returned 0 took 271.936ms.
This CL is to put those slow to start devices in a
separate service and wait for the service to be done later on.

Bug: 32712851
Test: On device
Change-Id: Idd4e965f122cbc8421b443a41573d363112dfa50
This commit is contained in:
Wei Wang 2016-11-21 17:58:09 -08:00 committed by Artem Borisov
parent d973f1d245
commit c4376f08be
8 changed files with 60 additions and 2 deletions

View File

@ -202,6 +202,10 @@ PRODUCT_PACKAGES += \
ueventd.rc \
ueventd.flo.rc
PRODUCT_COPY_FILES += \
device/asus/flo/rootdir/etc/init.qcom.devwait.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.devwait.sh \
device/asus/flo/rootdir/etc/init.qcom.devstart.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.devstart.sh
# Recorder
PRODUCT_PACKAGES += \
Recorder

View File

@ -40,12 +40,14 @@ on fs
mount_all ./fstab.flo
swapon_all ./fstab.flo
restorecon_recursive /persist
write /sys/kernel/boot_adsp/boot 1
on early-boot
# set RLIMIT_MEMLOCK to 64MB
setrlimit 8 67108864 67108864
# Busy loop to wait for devices booted by devstart_sh just in case device not ready
exec - root root system -- /vendor/bin/init.qcom.devwait.sh
on boot
#Create QMUX deamon socket area
mkdir /dev/socket/qmux_radio 0770 radio radio
@ -126,6 +128,9 @@ on boot
# Wifi firmware reload path
chown wifi wifi /sys/module/wlan/parameters/fwpath
on post-fs
# Start devices by sysfs trigger
start devstart_sh
# msm specific files that need to be created on /data
on post-fs-data
@ -342,7 +347,12 @@ service diag_mdlog /vendor/bin/diag_mdlog -s 100
class late_start
disabled
service devstart_sh /vendor/bin/init.qcom.devstart.sh
class main
user root
group root system
disabled
oneshot
# on property:gsm.sim.state=READY
# start diag_mdlog

View File

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

View File

@ -0,0 +1,8 @@
#!/system/bin/sh
up="`getprop sys.qcom.devup`"
while [ "$up" != "1" ]
do
sleep 0.1
up="`getprop sys.qcom.devup`"
done

View File

@ -24,3 +24,6 @@ type persist_wifi_file, file_type;
type sysfs_rmnet, fs_type, sysfs_type;
type sysfs_mpdecision, fs_type, sysfs_type;
type sysfs_surfaceflinger, fs_type, sysfs_type;
#type for devstart
type sysfs_audio, sysfs_type, fs_type;

View File

@ -131,6 +131,8 @@
/system/vendor/bin/init\.flo\.wifi\.sh u:object_r:conn_init_exec:s0
/system/vendor/bin/irsc_util u:object_r:irsc_util_exec:s0
/system/vendor/bin/init\.flo\.bt\.sh u:object_r:bluetooth_loader_exec:s0
/system/vendor/bin/init\.qcom\.devstart\.sh u:object_r:init-qcom-devstart-sh_exec:s0
/system/vendor/bin/init\.qcom\.devwait\.sh u:object_r:init-qcom-devwait-sh_exec:s0
# Persist firmware filesystem
/persist(/.*)? u:object_r:persist_file:s0
@ -154,3 +156,6 @@
# Sysfs files used by surfaceflinger
/sys/devices/virtual/graphics/fb1/format_3d -- u:object_r:sysfs_surfaceflinger:s0
/sys/devices/virtual/graphics/fb1/hpd -- u:object_r:sysfs_surfaceflinger:s0
# Sysfs entry for audio
/sys/kernel/boot_adsp/boot u:object_r:sysfs_audio: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_audio:file w_file_perms;

View File

@ -0,0 +1,9 @@
type init-qcom-devwait-sh, domain;
type init-qcom-devwait-sh_exec, exec_type, file_type;
init_daemon_domain(init-qcom-devwait-sh)
allow init-qcom-devwait-sh shell_exec:file rx_file_perms;
# execute toybox/toolbox
allow init-qcom-devwait-sh toolbox_exec:file rx_file_perms;