system_dlkm_modprobe.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #! /vendor/bin/sh
  2. #=============================================================================
  3. # Copyright (c) 2022 Qualcomm Technologies, Inc.
  4. # All Rights Reserved.
  5. # Confidential and Proprietary - Qualcomm Technologies, Inc.
  6. #=============================================================================
  7. SYSTEM_DLKM_DIR="/system_dlkm/lib/modules"
  8. VENDOR_DLKM_DIR="/vendor_dlkm/lib/modules"
  9. MODPROBE="/vendor/bin/modprobe"
  10. for dir in ${SYSTEM_DLKM_DIR} ;
  11. do
  12. if [ ! -e ${dir}/*/modules.load ]; then
  13. continue
  14. fi
  15. if [ -e ${VENDOR_DLKM_DIR}/system_dlkm.modules.blocklist ] && grep -q blocklist ${VENDOR_DLKM_DIR}/system_dlkm.modules.blocklist; then
  16. blocklist_expr="$(sed -n -e 's/blocklist \(.*\)/\1/p' ${VENDOR_DLKM_DIR}/system_dlkm.modules.blocklist | sed -e 's/-/_/g' -e 's/^/-e /')"
  17. else
  18. # Use pattern that won't be found in modules list so that all modules pass through grep below
  19. blocklist_expr="-e %"
  20. fi
  21. # Filter out modules in blocklist - we would see unnecessary errors otherwise
  22. load_modules=$(cat ${dir}/*/modules.load | grep -w -v ${blocklist_expr})
  23. first_module=$(echo ${load_modules} | cut -d " " -f1)
  24. other_modules=$(echo ${load_modules} | cut -d " " -f2-)
  25. if ! ${MODPROBE} -b -s -d ${dir}/*/ -a ${first_module} > /dev/null ; then
  26. continue
  27. fi
  28. # load modules individually in case one of them fails to init
  29. for module in ${other_modules}; do
  30. ( ${MODPROBE} -b -s -d ${dir}/*/ -a ${module} > /dev/null ) &
  31. done
  32. wait
  33. setprop odm.system.all.modules.ready 1
  34. exit 0
  35. done
  36. exit 1