</varlistentry>
<varlistentry>
- <term><option>--qemu-gui</option></term>
-
- <listitem><para>Start QEMU in graphical mode.</para>
+ <term><option>--initrd=</option><replaceable>PATH</replaceable></term>
- <xi:include href="version-info.xml" xpointer="v255"/></listitem>
+ <listitem>
+ <para>Set the initrd to use for direct kernel boot.</para>
+ <para>If the linux kernel supplied is a UKI then this argument is not required.</para>
+ <para>If no initrd was installed into the image then the image will fail to boot.</para>
+ <xi:include href="version-info.xml" xpointer="v256"/>
+ </listitem>
</varlistentry>
<varlistentry>
- <term><option>--secure-boot=</option><replaceable>BOOL</replaceable></term>
+ <term><option>--qemu-gui</option></term>
- <listitem><para>Configure whether to search for firmware which supports Secure Boot.</para>
- <para>If the option is not specified the first firmware which is detected will be used.
- If the option is set to yes then the first firmware with Secure Boot support will be selected.
- If no is specified then the first firmware without Secure Boot will be selected.</para>
+ <listitem><para>Start QEMU in graphical mode.</para>
<xi:include href="version-info.xml" xpointer="v255"/></listitem>
</varlistentry>
<xi:include href="version-info.xml" xpointer="v256"/></listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><option>--secure-boot=</option><replaceable>BOOL</replaceable></term>
+
+ <listitem><para>Configure whether to search for firmware which supports Secure Boot.</para>
+ <para>If the option is not specified the first firmware which is detected will be used.
+ If the option is set to yes then the first firmware with Secure Boot support will be selected.
+ If no is specified then the first firmware without Secure Boot will be selected.</para>
+
+ <xi:include href="version-info.xml" xpointer="v255"/></listitem>
+ </varlistentry>
</variablelist>
+ </refsect2>
- </refsect2><refsect2>
+ <refsect2>
<title>System Identity Options</title>
<variablelist>
#include <getopt.h>
#include <stdint.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include "sd-event.h"
#include "gpt.h"
#include "hexdecoct.h"
#include "hostname-util.h"
+#include "kernel-image.h"
#include "log.h"
#include "machine-credential.h"
+#include "macro.h"
#include "main-func.h"
#include "mkdir.h"
#include "pager.h"
#include "rm-rf.h"
#include "signal-util.h"
#include "socket-util.h"
+#include "string-util.h"
#include "strv.h"
#include "tmpfile-util.h"
#include "unit-name.h"
static unsigned arg_vsock_cid = VMADDR_CID_ANY;
static int arg_tpm = -1;
static char *arg_linux = NULL;
+static char *arg_initrd = NULL;
static bool arg_qemu_gui = false;
static int arg_secure_boot = -1;
static MachineCredentialContext arg_credentials = {};
STATIC_DESTRUCTOR_REGISTER(arg_credentials, machine_credential_context_done);
STATIC_DESTRUCTOR_REGISTER(arg_firmware, freep);
STATIC_DESTRUCTOR_REGISTER(arg_linux, freep);
+STATIC_DESTRUCTOR_REGISTER(arg_initrd, freep);
STATIC_DESTRUCTOR_REGISTER(arg_kernel_cmdline_extra, strv_freep);
static int help(void) {
" --vsock-cid= Specify the CID to use for the qemu guest's vsock\n"
" --tpm=BOOL Configure whether to use a virtual TPM or not\n"
" --linux=PATH Specify the linux kernel for direct kernel boot\n"
+ " --initrd=PATH Specify the initrd for direct kernel boot\n"
" --qemu-gui Start QEMU in graphical mode\n"
" --secure-boot=BOOL Configure whether to search for firmware which\n"
" supports Secure Boot\n"
ARG_VSOCK_CID,
ARG_TPM,
ARG_LINUX,
+ ARG_INITRD,
ARG_QEMU_GUI,
ARG_SECURE_BOOT,
ARG_SET_CREDENTIAL,
{ "vsock-cid", required_argument, NULL, ARG_VSOCK_CID },
{ "tpm", required_argument, NULL, ARG_TPM },
{ "linux", required_argument, NULL, ARG_LINUX },
+ { "initrd", required_argument, NULL, ARG_INITRD },
{ "qemu-gui", no_argument, NULL, ARG_QEMU_GUI },
{ "secure-boot", required_argument, NULL, ARG_SECURE_BOOT },
{ "set-credential", required_argument, NULL, ARG_SET_CREDENTIAL },
return r;
break;
+ case ARG_INITRD: {
+ r = parse_path_argument(optarg, /* suppress_root= */ false, &arg_initrd);
+ if (r < 0)
+ return r;
+ break;
+ }
+
case ARG_QEMU_GUI:
arg_qemu_gui = true;
break;
return log_oom();
}
+ if (arg_initrd) {
+ r = strv_extend_many(&cmdline, "-initrd", arg_initrd);
+ if (r < 0)
+ return log_oom();
+ }
+
if (use_vsock) {
vsock_fd = open_vsock();
if (vsock_fd < 0)