From fe798d9f4fcbc3e1b5631213a4c63ae096ac8b84 Mon Sep 17 00:00:00 2001 From: Daniel Mentz Date: Thu, 13 May 2021 15:37:33 -0700 Subject: [PATCH] Use modprobe --all to load all modules in modules.load Previously, we ran modprobe command for every .ko file listed in init.insmod.*.cfg. Let's move to a different approach where we call modprobe with the following command line. modprobe -b --all=/vendor/lib/modules/modules.load This will insmod all modules listed in modules.load except for those that are mentioned in the blocklist at /vendor/lib/modules/modules.blocklist A common reason for a module to be on the blocklist is that it must only be loaded under a certain condition like when a specific service is launched. Bug: 190652328 Change-Id: I37dfc83cbc90534243765f6985bc53f3fa83aef0 --- init.insmod.gs101.cfg | 21 +-------------------- init.insmod.sh | 9 ++++++++- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/init.insmod.gs101.cfg b/init.insmod.gs101.cfg index f5d9d642..1eb29b9a 100644 --- a/init.insmod.gs101.cfg +++ b/init.insmod.gs101.cfg @@ -7,25 +7,6 @@ # Load common kernel modules # Modules here will be loaded *before* device specific modules install_display_drivers -modprobe|mailbox-wc.ko -modprobe|aoc_core.ko -modprobe|aoc_channel_dev.ko -modprobe|aoc_control_dev.ko -modprobe|snd-soc-wm-adsp.ko -modprobe|snd-soc-cs35l41.ko -modprobe|aoc_char_dev.ko -modprobe|aoc_usb_driver.ko -modprobe|heatmap.ko -modprobe|gsa.ko -modprobe|gsa_gsc.ko -modprobe|abrolhos.ko -modprobe|haptics-cs40l2x.ko -modprobe|snd_soc_cs40l2x.ko -modprobe|slg51000-core.ko -modprobe|slg51000-regulator.ko -modprobe|pinctrl-slg51000.ko -modprobe|lwis.ko -modprobe|stmvl53l1.ko -modprobe|st21nfc.ko +modprobe|-b * # All common modules loaded setprop|vendor.common.modules.ready diff --git a/init.insmod.sh b/init.insmod.sh index a49fae59..97ae7bcb 100755 --- a/init.insmod.sh +++ b/init.insmod.sh @@ -61,7 +61,14 @@ if [ -f $cfg_file ]; then "insmod") insmod $arg ;; "setprop") setprop $arg 1 ;; "enable") echo 1 > $arg ;; - "modprobe") modprobe -a -d "${modules_dir}" $arg ;; + "modprobe") + case ${arg} in + "-b *" | "-b") + arg="-b --all=${modules_dir}/modules.load" ;; + "*" | "") + arg="--all=${modules_dir}/modules.load" ;; + esac + modprobe -a -d "${modules_dir}" $arg ;; "wait") wait_for_file $arg ;; "install_display_drivers") install_display_drivers ;; esac