diff options
| author | Wei Wang <wvw@google.com> | 2016-11-21 17:58:09 -0800 |
|---|---|---|
| committer | Ali B <abittin@gmail.com> | 2018-01-19 19:06:57 +0300 |
| commit | 896c121f751da6352abadd922d79033f1bde9f51 (patch) | |
| tree | 3333f7260e2bf313440adaf0ef0b5f22770d8b30 | |
| parent | cf71fdfc7da714a5203db8f9940a7ffe0fe7168e (diff) | |
flo: Accelerate boot by paralleling device enablestaging/o8.1staging/8.1
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
| -rw-r--r-- | device-common.mk | 4 | ||||
| -rw-r--r-- | rootdir/etc/init.flo.rc | 14 | ||||
| -rwxr-xr-x | rootdir/etc/init.qcom.devstart.sh | 4 | ||||
| -rwxr-xr-x | rootdir/etc/init.qcom.devwait.sh | 8 | ||||
| -rw-r--r-- | sepolicy/file.te | 3 | ||||
| -rw-r--r-- | sepolicy/file_contexts | 5 | ||||
| -rw-r--r-- | sepolicy/init-devstart-sh.te | 15 | ||||
| -rw-r--r-- | sepolicy/init-devwait-sh.te | 9 |
8 files changed, 60 insertions, 2 deletions
diff --git a/device-common.mk b/device-common.mk index b2da036..50f24f5 100644 --- a/device-common.mk +++ b/device-common.mk @@ -201,6 +201,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 diff --git a/rootdir/etc/init.flo.rc b/rootdir/etc/init.flo.rc index ff401da..96bc7f3 100644 --- a/rootdir/etc/init.flo.rc +++ b/rootdir/etc/init.flo.rc @@ -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 diff --git a/rootdir/etc/init.qcom.devstart.sh b/rootdir/etc/init.qcom.devstart.sh new file mode 100755 index 0000000..8e8cff5 --- /dev/null +++ b/rootdir/etc/init.qcom.devstart.sh @@ -0,0 +1,4 @@ +#!/system/bin/sh + +echo 1 > /sys/kernel/boot_adsp/boot +setprop sys.qcom.devup 1 diff --git a/rootdir/etc/init.qcom.devwait.sh b/rootdir/etc/init.qcom.devwait.sh new file mode 100755 index 0000000..aeee1d4 --- /dev/null +++ b/rootdir/etc/init.qcom.devwait.sh @@ -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 diff --git a/sepolicy/file.te b/sepolicy/file.te index be38233..c3d93d0 100644 --- a/sepolicy/file.te +++ b/sepolicy/file.te @@ -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; diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts index b2efebd..845cf8a 100644 --- a/sepolicy/file_contexts +++ b/sepolicy/file_contexts @@ -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 diff --git a/sepolicy/init-devstart-sh.te b/sepolicy/init-devstart-sh.te new file mode 100644 index 0000000..6702afc --- /dev/null +++ b/sepolicy/init-devstart-sh.te @@ -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; diff --git a/sepolicy/init-devwait-sh.te b/sepolicy/init-devwait-sh.te new file mode 100644 index 0000000..1529536 --- /dev/null +++ b/sepolicy/init-devwait-sh.te @@ -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; |
