From 6b137ff16d1967c1f2c4a91b65032e3c8652e4cd Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 18 Oct 2024 15:06:46 -0700 Subject: [PATCH] insmod.sh: Support 'rmmod' directive Some mechanisms (e.g., initramfs module lists) may be overzealous in what modules get loaded on a system. It can save resources to remove certain modules when we know they are going to be unused -- for example, extraneous panel drivers only needed for other devices within a given device family. Bug: 360934165 Test: `rmmod|.ko` added to init.insmod..cfg Change-Id: Iddb588116a0526faded3396d54f54ef82deed44d --- insmod/insmod.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/insmod/insmod.sh b/insmod/insmod.sh index 8cac37e..dfc4fdd 100755 --- a/insmod/insmod.sh +++ b/insmod/insmod.sh @@ -1,11 +1,11 @@ #!/vendor/bin/sh -############################################################# -### init.insmod.cfg format: ### -### ----------------------------------------------------- ### -### [insmod|setprop|enable/moprobe|wait] [path|prop name] ### -### ... ### -############################################################# +################################################################### +### init.insmod.cfg format: ### +### ----------------------------------------------------------- ### +### [insmod|setprop|enable|moprobe|rmmod|wait] [path|prop name] ### +### ... ### +################################################################### modules_dir= system_modules_dir= @@ -96,6 +96,7 @@ if [ -f $cfg_file ]; then modprobe -a -d "${modules_dir}" $arg fi ;; + "rmmod") rmmod $arg ;; "wait") wait_for_file $arg ;; esac done < $cfg_file