Kernel Modules
Posted on Thu 28 March 2019 in linux
Kernel options can be either built into the kernel, or stand-alone as modules.
1. Built-in
COMMAND | CODE |
---|---|
check existence | ls /sys/module/<mod_name> |
check parameter | cat /sys/module/<mod_nam>/parameters/<param_name> |
modify parameter | set <mod_name>.<param_name>=<param_value> in kernel command line |
1.1 Example: enable guc in i915
$ cat /sys/module/i915/parameters/enable_guc
0
# current value = 0 (disabled)
$ grep enable_guc -A4 -m1 /usr/src/linux/drivers/gpu/drm/i915/i915_params.c
i915_param_named_unsafe(enable_guc, int, 0400,
"Enable GuC load for GuC submission and/or HuC load. "
"Required functionality can be selected using bitmask values. "
"(-1=auto, 0=disable [default], 1=GuC submission, 2=HuC load)");
# set value -1 to enable
According to the above output, append i915.enable_guc=-1 to kernel command line.
If efibootmgr is the boot manager, just issue:
efibootmgr -c -d /dev/nvme0n1 -L 'gentoo' -u 'root=PARTUUID=817fae1c-8972-6318-531a-1b5a9821de23 i915.enable_guc=-1'
P.S. see more here
P.P.S. use unicode if the default ASCII codes are garbled in efibootmgr.
2. Stand-alone
COMMAND | CODE |
---|---|
check existence | lsmod <mod_name> (usu. residing in /lib/modules/$(uname -r)/kernel) |
load a module | modprobe <mod_name> |
check parameter | modinfo -p <mod_name> |
modify parameter | option <mod_name> <param_name>=<param_value> in /etc/modprobe.d/<mod_name>.conf (sample) |
Build: https://wiki.archlinux.org/title/Compile_kernel_module
note: check EXTRAVERSION in top level Makefile ; compile wanted module by specifying its directory name ; installation compression alternative: zstd