Linux Kernel: Difference between revisions

From wikinotes
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 9: Line 9:
</blockquote><!-- Documentation -->
</blockquote><!-- Documentation -->


= Locations =
= Notes =
<blockquote>
<blockquote>
{| class="wikitable"
{|
|-
|-
| <code>/etc/modprobe.d/*.conf</code> || load kernel modules on startup
| [[linux kernel ring buffer]]
|-
|-
| <code>/lib/modules/$(uname -r)/*</code> || kernel modules (modules.builtin lists builtin modules)
| [[linux kernel configuration]]
|-
| [[linux kernel event queue]]
|-
|-
|}
|}
</blockquote><!-- locations -->
</blockquote><!-- Notes -->
 
= Kernel Options =
<blockquote>
Your can add boot options for your kernel.<br>
The location depends on your bootloader, for <code>systemd-boot</code> it would be in a file like <code>/boot/loader/entries/archlinux.conf</code>.
 
<source lang="bash">
# /boot/loader/entries/archlinux.conf
 
# ...
options rdblacklist=nouveau nofb nomodeset
</source>
 
Some useful kernel options
<source lang="bash">
nofb      # disable framebuffer
nomodeset  # disable kernel modesetting (increased resolution)
</source>
</blockquote><!-- Kernel Options -->
 
= Kernel Modules =
<blockquote>
{| class="wikitable"
| <code>/etc/modprobe.d/*.conf</code> || location of kernel-module files
|}
 
== Managing Kernel Modules ==
<blockquote>
<source lang="bash">
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
</source>
</blockquote><!-- Managing Kernel Modules -->
 
== automatically loading kernel modules ==
<blockquote>
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
<source lang="bash">
# /etc/modprobe.d/{yourname}.conf
uinput
btusb
</source>
</blockquote><!-- automatically loading kernel modules -->
</blockquote><!-- Kernel Modules -->
 
= Dynamic Kernel Modules (DKMS) =
<blockquote>
DKMS packages include kernel modules that are recompiled every time a new kernel is installed.<br>
You can safely install/build these modules after an update without reboot, but you'll need to restart to use them (so the new kernel is used).
 
</blockquote><!-- Dynamic Kernel Modules (DKMS) -->
 
= Kernel Downgrades =
<blockquote>
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.
 
<syntaxhighlight lang="bash">
# 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
</syntaxhighlight>
</blockquote> <!-- Kernel Downgrades -->

Latest revision as of 15:53, 28 January 2023