2 Star 0 Fork 0

mirrors_android_source/sunfish

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
init.insmod.sh 1.37 KB
一键复制 编辑 原始数据 按行查看 历史
Adam Shih 提交于 2020-09-28 11:04 +08:00 . Move init.insmod.sh back to devices
#!/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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_android_source/sunfish.git
git@gitee.com:mirrors_android_source/sunfish.git
mirrors_android_source
sunfish
sunfish
main

搜索帮助