Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libkmod: tools: Introduce 'module fallback' directory #202

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Commits on Oct 22, 2024

  1. shared: Export is_dir()

    Make it possible to use is_dir() helper outside of util.c.
    
    Signed-off-by: Vitaly Kuznetsov <[email protected]>
    vittyvk committed Oct 22, 2024
    Configuration menu
    Copy the full SHA
    fd1c14f View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2024

  1. libkmod: Introduce fallback module directory

    Currently, traditional Linux systems using initramfs are forced to keep two
    copies of the modules which may be needed both during early boot and for
    normal system operation. This seems to be inevitable for the case when
    initramfs is built locally but with the rise of distro shipped UKIs the
    question whether it would be possible to avoid the redundancy arises.
    
    To make it possible to reuse modules from initramfs without copying them to
    the root filesystem (which may be read-only), the suggested approach is to
    preserve them on tmpfs, e.g. in /run/modules/`uname -r` but the challenge
    is to make kmod search there. It would certainly be possible to e.g. bind
    mount /run/modules/`uname -r` to /lib/modules/`uname -r` but this will make
    the destination read-only and traditional tools which are used to install
    packages with modules (e.g. rpm) will break. Instead, a 'fallback'
    directory approach is suggested: in case main /lib/modules/`uname -r` is
    completely missing, kmod tools will check whether /run/modules/`uname -r`
    exist and search there.
    
    In theory, it would've been possible to replace this fallback option with a
    dedicated config for kmod making modules location dynamic but this seems to
    be a more intrusive change and it will also require additional external
    actions to switch from 'fallback' to 'main' if/when modules get installed
    to the main system.
    
    Note, no merging of /run/modules/`uname -r` and /lib/modules/`uname -r` is
    performed. It is expected, that in case /lib/modules/`uname -r` exists, it
    is a superset and modules from initramfs are no longer needed.
    
    Signed-off-by: Vitaly Kuznetsov <[email protected]>
    vittyvk committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    5fdaf03 View commit details
    Browse the repository at this point in the history
  2. modprobe: support fallback module directory with -d/-S

    By default, modprobe relies on libkmod to set up module search
    path (kmod_new(NULL, ...)) but in case -d/-S options are used, modprobe
    explicitly defines search path using MODULE_DIRECTORY. Add support for
    MODULE_FALLBACK_DIRECTORY when the main one is missing.
    
    Signed-off-by: Vitaly Kuznetsov <[email protected]>
    vittyvk committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    bcc38fc View commit details
    Browse the repository at this point in the history
  3. testsuite: add modprobe fallback test

    Check whether modprobe is able to load modules from /run/modules/`uname -r`
    when /lib/modules/`uname -r` is missing.
    
    Signed-off-by: Vitaly Kuznetsov <[email protected]>
    vittyvk committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    41738f5 View commit details
    Browse the repository at this point in the history
  4. testsuite: add modprobe fallback custom ver test

    Check whether modprobe --set-version is able to load modules from
    /run/modules/<custom-ver> when /lib/modules/<custom-ver> is missing.
    
    Signed-off-by: Vitaly Kuznetsov <[email protected]>
    vittyvk committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    4e9f579 View commit details
    Browse the repository at this point in the history
  5. modinfo: support fallback module directory with -b/-k

    By default, modinfo relies on libkmod to set up module search
    path (kmod_new(NULL, ...)) but in case -b/-k options are used, modinfo
    explicitly defines search path using MODULE_DIRECTORY. Add support for
    MODULE_FALLBACK_DIRECTORY when the main one is missing.
    
    Signed-off-by: Vitaly Kuznetsov <[email protected]>
    vittyvk committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    d8a6030 View commit details
    Browse the repository at this point in the history
  6. testsuite: add modinfo fallback test

    Check whether modinfo is able to find modules in /run/modules/`uname -r`
    when /lib/modules/`uname -r` is missing.
    
    Signed-off-by: Vitaly Kuznetsov <[email protected]>
    vittyvk committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    0155e2e View commit details
    Browse the repository at this point in the history
  7. testsuite: add modinfo fallback custom ver test

    Check whether modinfo --set-version is able to find modules in
    /run/modules/<custom-ver> when /lib/modules/<custom-ver> is missing.
    
    Signed-off-by: Vitaly Kuznetsov <[email protected]>
    vittyvk committed Oct 23, 2024
    Configuration menu
    Copy the full SHA
    6bf065d View commit details
    Browse the repository at this point in the history