1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00

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.
This commit is contained in:
Lennart Poettering 2022-04-14 17:52:55 +02:00
parent 6ef00eb846
commit 5c1d67af46

View File

@ -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;