Difference between revisions of "Kernel Competence"

From GhostBSD Wiki
Jump to: navigation, search
(Loading modules at Boot)
(Loading modules at Boot)
Line 63: Line 63:
 
===Loading modules at Boot===
 
===Loading modules at Boot===
 
Normally you want to load a kernel module automatically at boot.<br/>
 
Normally you want to load a kernel module automatically at boot.<br/>
You have to use ''/boot/loader.conf'' with the entry:<br/>
+
You have to make an entry in the ''/boot/loader.conf'' file.
 +
 
 +
The procedure is always the same: Take the name of the kernel module and add: <code>_load="YES"</code>
 +
 
 +
For example:<br/>
  
 
<code>vboxdrv_load="YES"</code>
 
<code>vboxdrv_load="YES"</code>

Revision as of 11:47, 26 February 2020

Welcome to Icon Disti GhostBSD.png Kernel Competence.
Kernel Competence
Sysctl Kldstat Third-party Kernel Modules
Kernel Modules FreeBSD Ports: Kld Kenv
Back to the Icon Disti GhostBSD.pngSystem

Introduction

On this page and its sub-pages we will collect all information connect to the kernel, like managing kernel modules, retrieve information from the kernel and use special commands.

Kernel

The kernel is the interface between the hardware and the software. The kernel lets the software write data to disk drives and to network. When a program needs memory, the kernel handles the access to the physical memory chip. When a program requests CPU time, the kernel organizes it. The kernel provides all the software interfaces that a program needs, in order to access hardware resources.

To follow the UNIX philosophy: to minimalist, modular software development the Ghost/FreeBSD kernel is set together out of modules. If a hardware requires a special piece of software, a appropriate module has to be loaded in to the working memory. Not needed modules stay on the hard disc or the software repositories.

Modules

The kernel and any modules included with GhostBSD are files in the directory /boot/kernel. Third-party modules are located in /boot/modules. Not all modules are loaded by default. If needed, one can load them later.
All files elsewhere on the system or in the ports called the userland, meaning they are intended for users even if they use kernel facilities.

Loading and Unloading Modules on a running System

Loading and unloading kernel modules is done with kldload(8) and kldunload(8).

Example: You want to load vboxdrv.ko, listed in /boot/modules/vboxdrv.ko as a third-party kernel module. You simply chop of /boot/modules/ and the .ko extention and write in a terminal:
# kldload vboxdrv

The following options are available:

-n Do not try to load module if already loaded.
-v Be more verbose.
-q Silence any extraneous warnings.

To unload this module you write:
# kldunload vboxdrv

The following options are available:

-f Force the unload. This ignores error returns to MOD_QUIESCE from the module and implies that the module should be unloaded even if it is currently in use. The users are left to cope as best they can.
-v Be more verbose.
-i id Unload the file with this ID.
-n name Unload the file with this name.

NOTES
The kernel security level settings may prevent a module from being loaded or unloaded by giving Operation not permitted.

Loading modules at Boot

Normally you want to load a kernel module automatically at boot.
You have to make an entry in the /boot/loader.conf file.

The procedure is always the same: Take the name of the kernel module and add: _load="YES"

For example:

vboxdrv_load="YES"

Kernel Tools