mirror of
https://github.com/AuxXxilium/arc-patches.git
synced 2024-11-23 23:00:55 +07:00
fba28dd332
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
16 lines
827 B
Bash
Executable File
16 lines
827 B
Bash
Executable File
#!/usr/bin/sh
|
|
# This script is saved to /sbin/modprobe which is a so called UMH (user-mode-helper) for kmod (kernel/kmod.c)
|
|
# The kmod subsystem in the kernel is used to load modules from kernel. We exploit it a bit to load RP as soon as
|
|
# possible (which turns out to be via init/main.c => load_default_modules => load_default_elevator_module
|
|
# When the kernel is booted with "elevator=elevator" it will attempt to load a module "elevator-iosched"... and the rest
|
|
# should be obvious from the code below. DO NOT print anything here (kernel doesn't attach STDOUT)
|
|
for arg in "$@"; do
|
|
if [ "${arg}" = "elevator-iosched" ] || [ "${arg}" = "elevator=elevator" ]; then
|
|
insmod /usr/lib/modules/rp.ko
|
|
rm /usr/lib/modules/rp.ko
|
|
rm /usr/sbin/modprobe
|
|
ln -s /usr/bin/kmod /usr/sbin/modprobe
|
|
exit 0
|
|
fi
|
|
done
|
|
exit 1 |