aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/boot
diff options
context:
space:
mode:
authorLee, Chun-Yi <joeyli.kernel@gmail.com>2012-12-20 06:33:22 -0500
committerMatt Fleming <matt.fleming@intel.com>2013-01-31 09:44:44 -0500
commitdeb94101c4fda22e152c2a311210cf09ae51adf6 (patch)
treec7a7ee83eae23fe9a4949b35f081641745cec951 /arch/x86/boot
parent04c2eee5b9dfcb13f3cd07a5537fb8c785f2751a (diff)
x86, efi: Allow slash in file path of initrd
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> Signed-off-by: Lee, Chun-Yi <jlee@suse.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'arch/x86/boot')
-rw-r--r--arch/x86/boot/compressed/eboot.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index f8fa41190c35..c205035a6b96 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -19,23 +19,28 @@
19 19
20static efi_system_table_t *sys_table; 20static efi_system_table_t *sys_table;
21 21
22static void efi_char16_printk(efi_char16_t *str)
23{
24 struct efi_simple_text_output_protocol *out;
25
26 out = (struct efi_simple_text_output_protocol *)sys_table->con_out;
27 efi_call_phys2(out->output_string, out, str);
28}
29
22static void efi_printk(char *str) 30static void efi_printk(char *str)
23{ 31{
24 char *s8; 32 char *s8;
25 33
26 for (s8 = str; *s8; s8++) { 34 for (s8 = str; *s8; s8++) {
27 struct efi_simple_text_output_protocol *out;
28 efi_char16_t ch[2] = { 0 }; 35 efi_char16_t ch[2] = { 0 };
29 36
30 ch[0] = *s8; 37 ch[0] = *s8;
31 out = (struct efi_simple_text_output_protocol *)sys_table->con_out;
32
33 if (*s8 == '\n') { 38 if (*s8 == '\n') {
34 efi_char16_t nl[2] = { '\r', 0 }; 39 efi_char16_t nl[2] = { '\r', 0 };
35 efi_call_phys2(out->output_string, out, nl); 40 efi_char16_printk(nl);
36 } 41 }
37 42
38 efi_call_phys2(out->output_string, out, ch); 43 efi_char16_printk(ch);
39 } 44 }
40} 45}
41 46
@@ -709,7 +714,12 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
709 if ((u8 *)p >= (u8 *)filename_16 + sizeof(filename_16)) 714 if ((u8 *)p >= (u8 *)filename_16 + sizeof(filename_16))
710 break; 715 break;
711 716
712 *p++ = *str++; 717 if (*str == '/') {
718 *p++ = '\\';
719 *str++;
720 } else {
721 *p++ = *str++;
722 }
713 } 723 }
714 724
715 *p = '\0'; 725 *p = '\0';
@@ -737,7 +747,9 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
737 status = efi_call_phys5(fh->open, fh, &h, filename_16, 747 status = efi_call_phys5(fh->open, fh, &h, filename_16,
738 EFI_FILE_MODE_READ, (u64)0); 748 EFI_FILE_MODE_READ, (u64)0);
739 if (status != EFI_SUCCESS) { 749 if (status != EFI_SUCCESS) {
740 efi_printk("Failed to open initrd file\n"); 750 efi_printk("Failed to open initrd file: ");
751 efi_char16_printk(filename_16);
752 efi_printk("\n");
741 goto close_handles; 753 goto close_handles;
742 } 754 }
743 755