Merge changes from topic "zumasystemdlkm" into udc-d1-dev am: 86fdd03b13

Original change: https://googleplex-android-review.googlesource.com/c/device/google/gs-common/+/22086762

Change-Id: I8a7c4e66eec021999127392cf88dc06259262e4e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot 2023-03-18 06:23:56 +00:00 committed by Automerger Merge Worker
commit 75a8bf09a8
2 changed files with 38 additions and 13 deletions

View file

@ -6,6 +6,7 @@
# Load common kernel modules
# Modules here will be loaded *before* device specific modules
modprobe|-b *
modprobe|system -b *
modprobe|vendor -b *
# All common modules loaded
setprop|vendor.common.modules.ready

View file

@ -8,16 +8,29 @@
#############################################################
modules_dir=
system_modules_dir=
vendor_modules_dir=
for f in /vendor/lib/modules/*/modules.dep /vendor/lib/modules/modules.dep; do
if [[ -f "$f" ]]; then
modules_dir="$(dirname "$f")"
break
fi
for dir in system vendor; do
for f in /${dir}/lib/modules/*/modules.dep /${dir}/lib/modules/modules.dep; do
if [[ -f "$f" ]]; then
if [[ "${dir}" == "system" ]]; then
system_modules_dir="$(dirname "$f")"
else
vendor_modules_dir="$(dirname "$f")"
modules_dir=${vendor_modules_dir}
fi
break
fi
done
done
if [[ -z "${modules_dir}" ]]; then
echo "Unable to locate kernel modules directory" 2>&1
if [[ -z "${system_modules_dir}" ]]; then
echo "Unable to locate system kernel modules directory" 2>&1
fi
if [[ -z "${vendor_modules_dir}" ]]; then
echo "Unable to locate vendor kernel modules directory" 2>&1
exit 1
fi
@ -55,12 +68,23 @@ if [ -f $cfg_file ]; then
"enable") echo 1 > $arg ;;
"modprobe")
case ${arg} in
"-b *" | "-b")
arg="-b --all=${modules_dir}/modules.load" ;;
"*" | "")
arg="--all=${modules_dir}/modules.load" ;;
"system -b *" | "system -b")
modules_dir=${system_modules_dir}
arg="-b --all=${system_modules_dir}/modules.load" ;;
"system *" | "system")
modules_dir=${system_modules_dir}
arg="--all=${system_modules_dir}/modules.load" ;;
"-b *" | "-b" | "vendor -b *" | "vendor -b")
modules_dir=${vendor_modules_dir}
arg="-b --all=${vendor_modules_dir}/modules.load" ;;
"*" | "" | "vendor *" | "vendor")
modules_dir=${vendor_modules_dir}
arg="--all=${vendor_modules_dir}/modules.load" ;;
esac
modprobe -a -d "${modules_dir}" $arg ;;
if [[ -d "${modules_dir}" ]]; then
modprobe -a -d "${modules_dir}" $arg
fi
;;
"wait") wait_for_file $arg ;;
esac
done < $cfg_file