Linux Kernel

From wikinotes

Documentation

kernel option docs https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html
tut: kernel programming guide https://sysprog21.github.io/lkmpg/

Locations

/etc/modprobe.d/*.conf load kernel modules on startup
/lib/modules/$(uname -r)/* kernel modules (modules.builtin lists builtin modules)

Kernel Options

Your can add boot options for your kernel.
The location depends on your bootloader, for systemd-boot it would be in a file like /boot/loader/entries/archlinux.conf.

# /boot/loader/entries/archlinux.conf

# ...
options rdblacklist=nouveau nofb nomodeset

Some useful kernel options

nofb       # disable framebuffer
nomodeset  # disable kernel modesetting (increased resolution)

Kernel Modules

/etc/modprobe.d/*.conf location of kernel-module files

managing kernel modules

lsmod                                          # list loaded kernel modules
modinfo btusb                                  # list kernel options for btusb
modprobe btusb                                 # load 'btusb' kernel module
cat /lib/modules/$(uname -r)/modules.builtin   # list builtin kernel modules

automatically loading kernel modules

Similar to other systemd files, you can gather a bunch of kernel modules in a single file. The syntax of the file is a newline separated list of modules. Their names will be exactly as they would be called by modprobe. A newline with a first character of '#', marks a comment.

/etc/modprobe.d/wiimote.conf

# /etc/modprobe.d/{yourname}.conf
uinput
btusb

list kernel modules

lsmod  # list loaded kernel modules

kernel module load order

Kernel Downgrades

Boot your distro off a USB stick, and chroot into your existing installation. You'll need to uninstall all packages that are particular to your kernel version like linux, linux-headers, virtualbox-host-modules, virtualbox-guest-modules.

# Connect to the internet
sudo mount /dev/sda2 /mnt
arch-chroot /mnt /bin/bash
cd /var/cache/pacman/pkg

pacman -Rs linux-3.9.7 linux-headers-3.9.7 virtualbox-host-modules virtualbox-guest-modules
pacman -U linux-3.7.1 linux-headers 3.7.1
exit

sudo reboot