Linux Kernel: Difference between revisions

From wikinotes
 
(One intermediate revision by the same user not shown)
Line 8: Line 8:
|}
|}
</blockquote><!-- Documentation -->
</blockquote><!-- Documentation -->
= Locations =
<blockquote>
{| class="wikitable"
|-
| <code>/etc/modprobe.d/*.conf</code> || load kernel modules on startup
|-
| <code>/lib/modules/$(uname -r)/*</code> || kernel modules (modules.builtin lists builtin modules)
|-
|}
</blockquote><!-- locations -->


= Notes =
= Notes =
<blockquote>
<blockquote>
{|
{|
|-
| [[linux kernel ring buffer]]
|-
|-
| [[linux kernel configuration]]
| [[linux kernel configuration]]
Line 30: Line 21:
|}
|}
</blockquote><!-- Notes -->
</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 -->
== 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).<br>
Most distros use the <code>-dkms</code> suffix to indicate a package like this.
</blockquote><!-- Dynamic Kernel Modules (DKMS) -->
</blockquote><!-- Kernel Modules -->
= 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