Skip to content

Commit

Permalink
Improve examples for modules API docs. (#68)
Browse files Browse the repository at this point in the history
Ensure all the examples provided demonstrate how to use the API in
meaningful ways.

In addition, improve some of the descriptions of the modules API
behavior.
  • Loading branch information
cwize1 authored Jan 8, 2025
1 parent cd12449 commit 0bc50e3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 30 deletions.
55 changes: 33 additions & 22 deletions docs/imagecustomizer/api/configuration/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,62 @@ Options for configuring a kernel module.

## name [string]

Name of the module.

```yaml
os:
modules:
- name: br_netfilter
```
The name of the kernel module to configure.

## loadMode [string]

The loadMode setting for kernel modules dictates how and when these modules
The loadMode setting for kernel modules dictates how and when these modules
are loaded or disabled in the system.

Supported values:

- `always`: Set kernel modules to be loaded automatically at boot time.
- If the module is blacklisted in the base image, remove the blacklist entry.

- If the module is disabled in the base image, then remove the blacklist entry from
the `/etc/modprobe.d/modules-disabled.conf` file.

- Add the module to `/etc/modules-load.d/modules-load.conf`.
- Write the options, if provided.

- `auto`: Used for modules that are automatically loaded by the kernel as needed,
without explicit configuration to load them at boot.
- If the module is disabled in the base image, remove the blacklist entry to
allow it to be loaded automatically.
- Write the provided options to `/etc/modprobe.d/module-options.conf`, but do not
add the module to `/etc/modules-load.d/modules-load.conf`, as it should be loaded automatically by
the kernel when necessary.

- If the module is disabled in the base image, then remove the blacklist entry from
the `/etc/modprobe.d/modules-disabled.conf` file.

- `disable`: Configures kernel modules to be explicitly disabled, preventing them from
loading automatically.
- If the module is not already disabled in the base image, a blacklist entry will
be added to `/etc/modprobe.d/blacklist.conf` to ensure the module is disabled.

- If the module is not already disabled in the base image, then add a blacklist entry
to the `/etc/modprobe.d/modules-disabled.conf` file.

- `inherit`: Configures kernel modules to inherit the loading behavior set in the base
image. Only applying new options where they are explicitly provided and applicable.
- If the module is not disabled, and options are provided, these options will be
written to `/etc/modprobe.d/module-options.conf`.
image.

Default value: `inherit`.

- empty string or not set, it will default to `inherit`.
Example:

```yaml
os:
modules:
- name: br_netfilter
loadMode: disable
- name: vfio
loadMode: always
```
## options [map\<string, string>]
Kernel options for modules can specify how these modules interact with the system,
Kernel options for modules can specify how these modules interact with the system,
and adjust performance or security settings specific to each module.
An error will be reported if module options are specified for a kernel module that has
been disabled in the image.
The options are specified in the `/etc/modprobe.d/module-options.conf` file.

Example:

```yaml
os:
modules:
Expand Down
8 changes: 0 additions & 8 deletions docs/imagecustomizer/api/configuration/os.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,6 @@ os:
Used to configure kernel modules.
Example:
```yaml
os:
modules:
- name: vfio
```
## overlays [[overlay](./overlay.md)[]]
Used to add filesystem overlays.
Expand Down

0 comments on commit 0bc50e3

Please sign in to comment.