linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86, efi: Allow slash in file path of initrd
@ 2012-12-20 11:33 Lee, Chun-Yi
  2013-01-07 16:44 ` Matt Fleming
  0 siblings, 1 reply; 2+ messages in thread
From: Lee, Chun-Yi @ 2012-12-20 11:33 UTC (permalink / raw)
  To: matt.fleming; +Cc: linux-kernel, Lee, Chun-Yi, Matthew Garrett, H. Peter Anvin

When initrd file didn't put at the same place with stub kernel, we
need give the file path of initrd, but need use backslash to separate
directory and file. It's not friendly to unix/linux user, and not so
intuitive for bootloader forward paramters to efi stub kernel by
chainloading.

This patch add support to handle_ramdisks for allow slash in file path
of initrd, it convert slash to backlash when parsing path.

In additional, this patch also separates print code of efi_char16_t from
efi_printk, and print out the path/filename of initrd when failed to open
initrd file. It's good for debug and discover typo.

Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Matt Fleming <matt.fleming@intel.com> 
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
---
 arch/x86/boot/compressed/eboot.c |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index b1942e2..e360288 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -19,23 +19,28 @@
 
 static efi_system_table_t *sys_table;
 
+static void efi_char16_printk(efi_char16_t *str)
+{
+	struct efi_simple_text_output_protocol *out;
+
+	out = (struct efi_simple_text_output_protocol *)sys_table->con_out;
+	efi_call_phys2(out->output_string, out, str);
+}
+
 static void efi_printk(char *str)
 {
 	char *s8;
 
 	for (s8 = str; *s8; s8++) {
-		struct efi_simple_text_output_protocol *out;
 		efi_char16_t ch[2] = { 0 };
 
 		ch[0] = *s8;
-		out = (struct efi_simple_text_output_protocol *)sys_table->con_out;
-
 		if (*s8 == '\n') {
 			efi_char16_t nl[2] = { '\r', 0 };
-			efi_call_phys2(out->output_string, out, nl);
+			efi_char16_printk(nl);
 		}
 
-		efi_call_phys2(out->output_string, out, ch);
+		efi_char16_printk(ch);
 	}
 }
 
@@ -708,7 +713,12 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
 			if ((u8 *)p >= (u8 *)filename_16 + sizeof(filename_16))
 				break;
 
-			*p++ = *str++;
+			if (*str == '/') {
+				*p++ = '\\';
+				*str++;
+			} else {
+				*p++ = *str++;
+			}
 		}
 
 		*p = '\0';
@@ -736,7 +746,9 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
 		status = efi_call_phys5(fh->open, fh, &h, filename_16,
 					EFI_FILE_MODE_READ, (u64)0);
 		if (status != EFI_SUCCESS) {
-			efi_printk("Failed to open initrd file\n");
+			efi_printk("Failed to open initrd file: ");
+			efi_char16_printk(filename_16);
+			efi_printk("\n");
 			goto close_handles;
 		}
 
-- 
1.6.4.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86, efi: Allow slash in file path of initrd
  2012-12-20 11:33 [PATCH] x86, efi: Allow slash in file path of initrd Lee, Chun-Yi
@ 2013-01-07 16:44 ` Matt Fleming
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Fleming @ 2013-01-07 16:44 UTC (permalink / raw)
  To: Lee, Chun-Yi; +Cc: linux-kernel, Lee, Chun-Yi, Matthew Garrett, H. Peter Anvin

On Thu, 2012-12-20 at 19:33 +0800, Lee, Chun-Yi wrote:
> When initrd file didn't put at the same place with stub kernel, we
> need give the file path of initrd, but need use backslash to separate
> directory and file. It's not friendly to unix/linux user, and not so
> intuitive for bootloader forward paramters to efi stub kernel by
> chainloading.
> 
> This patch add support to handle_ramdisks for allow slash in file path
> of initrd, it convert slash to backlash when parsing path.
> 
> In additional, this patch also separates print code of efi_char16_t from
> efi_printk, and print out the path/filename of initrd when failed to open
> initrd file. It's good for debug and discover typo.
> 
> Cc: Matthew Garrett <mjg59@srcf.ucam.org>
> Cc: H. Peter Anvin <hpa@zytor.com>
> Cc: Matt Fleming <matt.fleming@intel.com> 
> Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
> ---
>  arch/x86/boot/compressed/eboot.c |   26 +++++++++++++++++++-------
>  1 files changed, 19 insertions(+), 7 deletions(-)

Thanks, I've queued this up. 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-07 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-20 11:33 [PATCH] x86, efi: Allow slash in file path of initrd Lee, Chun-Yi
2013-01-07 16:44 ` Matt Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).