diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-04-14 17:52:55 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-04-28 17:54:14 +0200 |
commit | 5c1d67af465ab6921beec3f864ffdf1670ca4e1e (patch) | |
tree | 64f4c4df7fc19d050c9b4d501e1fc036e1438535 /src/core/kmod-setup.c | |
parent | 6ef00eb846a89558ad46d2937addd8ea952b7062 (diff) | |
download | systemd-5c1d67af465ab6921beec3f864ffdf1670ca4e1e.tar.gz |
pid1: load 'qemu_fw_cfg' kmod super early, so that we can import credentials from it
In one of the next commits we want to add support for importing system
credentials from qemu_fw_cfg, very early during boot. (So that we can
use the credentials therein for generators and even earlier). But that
means udev won#t load these modules for us, we have to load them
manually first.
Diffstat (limited to 'src/core/kmod-setup.c')
-rw-r--r-- | src/core/kmod-setup.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c index d054668b8e..f4488dd692 100644 --- a/src/core/kmod-setup.c +++ b/src/core/kmod-setup.c @@ -10,6 +10,7 @@ #include "macro.h" #include "recurse-dir.h" #include "string-util.h" +#include "virt.h" #if HAVE_KMOD #include "module-util.h" @@ -80,6 +81,10 @@ static bool has_virtio_rng(void) { return r > 0; } + +static bool in_qemu(void) { + return IN_SET(detect_vm(), VIRTUALIZATION_KVM, VIRTUALIZATION_QEMU); +} #endif int kmod_setup(void) { @@ -109,6 +114,9 @@ int kmod_setup(void) { #endif /* virtio_rng would be loaded by udev later, but real entropy might be needed very early */ { "virtio_rng", NULL, false, false, has_virtio_rng }, + + /* qemu_fw_cfg would be loaded by udev later, but we want to import credentials from it super early */ + { "qemu_fw_cfg", "/sys/firmware/qemu_fw_cfg", false, false, in_qemu }, }; _cleanup_(kmod_unrefp) struct kmod_ctx *ctx = NULL; unsigned i; |