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|<module_name>.ko` added to init.insmod.<device>.cfg
Change-Id: Iddb588116a0526faded3396d54f54ef82deed44d
This commit is contained in:
Brian Norris 2024-10-18 15:06:46 -07:00
parent fa448be01f
commit 6b137ff16d

View file

@ -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