Skip to contentSkip to conversation

Default initrd path with the EFI stub

PATCH David Michael 1 participant 1 message Aug 12, 2014 EFI

lore
Share & tools
lore
#0 lore raw

---
Hi,

I'd like to specify a default initrd path for the EFI stub at compile time. Is there a way to do this?

I got it to successfully load an initrd by setting the parameter in CONFIG_CMDLINE with this proof-of-concept patch on 3.16. (This patch is against the efi tree's next branch.) If the EFI stub doesn't currently support this functionality, I'd appreciate it if something like this could be applied.

Thanks.

David

 drivers/firmware/efi/libstub/efi-stub-helper.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/firmware/efi/libstub/efi-stub-helper.c +9 -0
index a920fec..eac30dc 100644
@@ -675,6 +675,10 @@ char *efi_convert_cmdline(efi_system_table_t *sys_table_arg,
 
 	options_bytes++;	/* NUL termination */
 
+#ifdef CONFIG_CMDLINE
+	options_bytes += sizeof(CONFIG_CMDLINE);
+#endif
+
 	status = efi_low_alloc(sys_table_arg, options_bytes, 0, &cmdline_addr);
 	if (status != EFI_SUCCESS)
 		return NULL;
@@ -682,6 +686,11 @@ char *efi_convert_cmdline(efi_system_table_t *sys_table_arg,
 	s1 = (u8 *)cmdline_addr;
 	s2 = (const u16 *)options;
 
+#ifdef CONFIG_CMDLINE
+	memcpy((void *)s1, CONFIG_CMDLINE " ", sizeof(CONFIG_CMDLINE));
+	s1 += sizeof(CONFIG_CMDLINE);
+#endif
+
 	s1 = efi_utf16_to_utf8(s1, s2, options_chars);
 	*s1 = '\0';
 
Signature · 1 line
1.9.3