-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Its permission is related to the module it loads, and they vary from device to device Bug: 168440095 Test: boot with no SELinux error log Change-Id: Idf058b54bfc8250cf2c574ade285ab479af59cb3
- Loading branch information
Adam Shih
committed
Sep 28, 2020
1 parent
7dd7861
commit 176df15
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/vendor/bin/sh | ||
|
||
############################################################# | ||
### init.insmod.cfg format: ### | ||
### ----------------------------------------------------- ### | ||
### [insmod|setprop|enable/moprobe|wait] [path|prop name] ### | ||
### ... ### | ||
############################################################# | ||
|
||
# imitates wait_for_file() in init | ||
wait_for_file() | ||
{ | ||
filename="${1}" | ||
timeout="${2:-5}" | ||
|
||
expiry=$(($(date "+%s")+timeout)) | ||
while [[ ! -e "${filename}" ]] && [[ "$(date "+%s")" -le "${expiry}" ]] | ||
do | ||
sleep 0.01 | ||
done | ||
} | ||
|
||
if [ $# -eq 1 ]; then | ||
cfg_file=$1 | ||
else | ||
exit 1 | ||
fi | ||
|
||
|
||
if [ -f $cfg_file ]; then | ||
while IFS="|" read -r action arg | ||
do | ||
case $action in | ||
"insmod") insmod $arg ;; | ||
"setprop") setprop $arg 1 ;; | ||
"enable") echo 1 > $arg ;; | ||
"modprobe") | ||
case ${arg} in | ||
"-b *" | "-b") | ||
arg="-b $(cat /vendor/lib/modules/modules.load)" ;; | ||
"*" | "") | ||
arg="$(cat /vendor/lib/modules/modules.load)" ;; | ||
esac | ||
modprobe -a -d /vendor/lib/modules $arg ;; | ||
"wait") wait_for_file $arg ;; | ||
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 vendor.all.modules.ready 1 | ||
setprop vendor.all.devices.ready 1 |