Search This Blog

Thursday, October 22, 2020

Kernel module info

A few commands to help in checking and adjusting kernel module options: 

  1. Display information about kernel module, including all options

    modinfo $KERNEL_MODULE

  2. Display information about current value for each option

    for i (/sys/module/$KERNEL_MODULE/parameters/*) {\
      echo $(basename $i);\
      cat $i\
    }


  3. Change kernel module option without restart (temporary)

    echo "$NEW_VALUE" > /sys/module/$KERNEL_MODULE/parameters/$OPTION

  4. Load module with an option set to value
    insmod $PATH_TO_MODULE/$KERNEL_MODULE.ko\ $OPTION1=$VALUE1 \
    $OPTION2=$VALUE2


  5. Ensure kernel module option is set during boot up with grub
    1. Open /etc/default/grub
    2. Add/edit following line
      GRUB_CMDLINE_LINUX='$KERNEL_MODULE.$OPTION=$VALUE'

Of course $KERNEL_MODULE, as well as all other strings with "$" at the beginning, has to be replaced by appropriate value.

In CRUX /etc/default/grub does not exist, so it has to be created.

 Useful links

No comments: