x86/loader: add -shim option

Add new -shim command line option, wire up for the x86 loader.
When specified load shim into the new "etc/boot/shim" fw_cfg file.

Needs OVMF changes too to be actually useful.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-ID: <20240905141211.1253307-6-kraxel@redhat.com>
This commit is contained in:
Gerd Hoffmann 2024-09-05 16:12:10 +02:00
parent f2594d9284
commit a5bd044b15
5 changed files with 53 additions and 0 deletions

View file

@ -305,6 +305,21 @@ static void machine_set_kernel(Object *obj, const char *value, Error **errp)
ms->kernel_filename = g_strdup(value);
}
static char *machine_get_shim(Object *obj, Error **errp)
{
MachineState *ms = MACHINE(obj);
return g_strdup(ms->shim_filename);
}
static void machine_set_shim(Object *obj, const char *value, Error **errp)
{
MachineState *ms = MACHINE(obj);
g_free(ms->shim_filename);
ms->shim_filename = g_strdup(value);
}
static char *machine_get_initrd(Object *obj, Error **errp)
{
MachineState *ms = MACHINE(obj);
@ -1082,6 +1097,11 @@ static void machine_class_init(ObjectClass *oc, void *data)
object_class_property_set_description(oc, "kernel",
"Linux kernel image file");
object_class_property_add_str(oc, "shim",
machine_get_shim, machine_set_shim);
object_class_property_set_description(oc, "shim",
"shim.efi file");
object_class_property_add_str(oc, "initrd",
machine_get_initrd, machine_set_initrd);
object_class_property_set_description(oc, "initrd",