vendor_modprobe.sh 1.5 KB

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