char16_t *loader;
char16_t *devicetree;
char16_t *options;
+ bool options_implied; /* If true, these options are implied if we invoke the PE binary without any parameters (as in: UKI). If false we must specify these options explicitly. */
char16_t **initrd;
char16_t key;
EFI_STATUS (*call)(void);
print_at(1, y_status, COLOR_EDIT, clearline + 2);
exit = line_edit(&config->entries[idx_highlight]->options, x_max - 2, y_status);
print_at(1, y_status, COLOR_NORMAL, clearline + 2);
+
+ /* The options string was now edited, hence we have to pass it to the invoked
+ * binary. */
+ config->entries[idx_highlight]->options_implied = false;
break;
case KEYPRESS(0, 0, 'v'):
if (err == EFI_SUCCESS) {
entry->options = xstrn8_to_16(content, cmdline_len);
mangle_stub_cmdline(entry->options);
+ entry->options_implied = true;
}
}
}
if (err != EFI_SUCCESS)
return log_error_status(err, "Error getting LoadedImageProtocol handle: %m");
- char16_t *options = options_initrd ?: entry->options;
+ /* If we had to append an initrd= entry to the command line, we have to pass it, and measure
+ * it. Otherwise, only pass/measure it if it is not implicit anyway (i.e. embedded into the UKI or
+ * so). */
+ char16_t *options = options_initrd ?: entry->options_implied ? NULL : entry->options;
if (options) {
loaded_image->LoadOptions = options;
loaded_image->LoadOptionsSize = strsize16(options);