Skip to contentSkip to conversation

bug fix for x86_64 efi

PATCH In review Bean 3 participants 8 messages Feb 19, 2009 – Feb 27, 2009

lore
Share & tools
lore

Bean

author
#0 lore raw

PATCH 1/1 bug fix for x86_64 efi

Hi,

This patch contains several important update for x86_64 efi:

1, Support memory larger than 2G.
2, Fix a bug in efi_call_6 that could cause chainloadering osx to fail. 3, Improve the method to detect frame buffer address and line length in linux loader.

2009-02-19 Bean <[email protected]>

* configure.ac: Check for -mcmodel=large in x86_64 target.

* include/grub/efi/api.h (efi_call_10): New macro. (efi_wrap_10): New function.

* include/grub/efi/pe32.h (GRUB_PE32_REL_BASE_HIGH): New macro. (GRUB_PE32_REL_BASED_HIGH): Likewise. (GRUB_PE32_REL_BASED_LOW): Likewise. (GRUB_PE32_REL_BASED_HIGHLOW): Likewise. (GRUB_PE32_REL_BASED_HIGHADJ): Likewise. (GRUB_PE32_REL_BASED_MIPS_JMPADDR): Likewise. (GRUB_PE32_REL_BASED_SECTION): Likewise. (GRUB_PE32_REL_BASED_REL): Likewise. (GRUB_PE32_REL_BASED_IA64_IMM64): Likewise. (GRUB_PE32_REL_BASED_DIR64): Likewise. (GRUB_PE32_REL_BASED_HIGH3ADJ): Likewise.

* kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Fixed relocation issue.

* kern/x86_64/efi/callwrap.S (efi_wrap_6): Bug fix. (efi_wrap_10): New function.

* kern/x86_64/efi/startup.S (codestart): Use relative addressing.

* loader/efi/appleloader.c (devpath_5): Add support for late 2008 MB/MBP model (NV chipset).
(devdata_devs): Add devpath_5 to the list.

* load/i386/efi/linux.c (video_base): Remove variable. (RGB_MASK): New macro.
(RGB_MAGIC): Likewise.
(LINE_MIN): Likewise.
(LINE_MAX): Likewise.
(FBTEST_STEP): Likewise.
(FBTEST_COUNT): Likewise.
(fb_list): New variable.
(grub_find_video_card): Remove function. (find_framebuf): New function. (grub_linux_setup_video): Use find_framebuf to get frame buffer and line length.

* util/i386/efi/grub-mkimage.c (grub_reloc_section): Fix relocation problem for x86_64.

Signature · 1 line
Bean
configure.ac +10 -1
index 7658c7a..fd89d30 100644
@@ -299,7 +299,16 @@ fi
 
 if test "x$target_m64" = x1; then
   # Force 64-bit mode.
-  TARGET_CFLAGS="$TARGET_CFLAGS -m64"
+  AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
+    CFLAGS="-m64 -mcmodel=large"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+		      [grub_cv_cc_mcmodel=yes],
+		      [grub_cv_cc_mcmodel=no])
+  ])
+  if test "x$grub_cv_cc_mcmodel" = xno; then
+    AC_MSG_ERROR([-mcmodel=large not supported, upgrade your gcc])
+  fi
+  TARGET_CFLAGS="$TARGET_CFLAGS -m64 -mcmodel=large"
   TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
 fi
 
include/grub/efi/api.h +28 -7
index 44b7d27..8c38fc9 100644
@@ -1104,16 +1104,31 @@ typedef struct grub_efi_block_io grub_efi_block_io_t;
 #define efi_call_4(func, a, b, c, d)	func(a, b, c, d)
 #define efi_call_5(func, a, b, c, d, e)	func(a, b, c, d, e)
 #define efi_call_6(func, a, b, c, d, e, f) func(a, b, c, d, e, f)
+#define efi_call_10(func, a, b, c, d, e, f, g, h, i, j)	func(a, b, c, d, e, f, g, h, i, j)
 
 #else
 
-#define efi_call_0(func)		efi_wrap_0(func)
-#define efi_call_1(func, a)		efi_wrap_1(func, (grub_uint64_t) a)
-#define efi_call_2(func, a, b)		efi_wrap_2(func, (grub_uint64_t) a, (grub_uint64_t) b)
-#define efi_call_3(func, a, b, c)	efi_wrap_3(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c)
-#define efi_call_4(func, a, b, c, d)	efi_wrap_4(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, (grub_uint64_t) d)
-#define efi_call_5(func, a, b, c, d, e)	efi_wrap_5(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, (grub_uint64_t) d, (grub_uint64_t) e)
-#define efi_call_6(func, a, b, c, d, e, f) efi_wrap_6(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, (grub_uint64_t) d, (grub_uint64_t) e, (grub_uint64_t) f)
+#define efi_call_0(func) \
+  efi_wrap_0(func)
+#define efi_call_1(func, a) \
+  efi_wrap_1(func, (grub_uint64_t) a)
+#define efi_call_2(func, a, b) \
+  efi_wrap_2(func, (grub_uint64_t) a, (grub_uint64_t) b)
+#define efi_call_3(func, a, b, c) \
+  efi_wrap_3(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c)
+#define efi_call_4(func, a, b, c, d) \
+  efi_wrap_4(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
+  (grub_uint64_t) d)
+#define efi_call_5(func, a, b, c, d, e)	\
+  efi_wrap_5(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
+  (grub_uint64_t) d, (grub_uint64_t) e)
+#define efi_call_6(func, a, b, c, d, e, f) \
+  efi_wrap_6(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
+  (grub_uint64_t) d, (grub_uint64_t) e, (grub_uint64_t) f)
+#define efi_call_10(func, a, b, c, d, e, f, g, h, i, j) \
+  efi_wrap_10(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
+  (grub_uint64_t) d, (grub_uint64_t) e, (grub_uint64_t) f, (grub_uint64_t) g, \
+  (grub_uint64_t) h, (grub_uint64_t) i, (grub_uint64_t) j)
 
 grub_uint64_t EXPORT_FUNC(efi_wrap_0) (void *func);
 grub_uint64_t EXPORT_FUNC(efi_wrap_1) (void *func, grub_uint64_t arg1);
@@ -1131,6 +1146,12 @@ grub_uint64_t EXPORT_FUNC(efi_wrap_6) (void *func, grub_uint64_t arg1,
                                        grub_uint64_t arg2, grub_uint64_t arg3,
                                        grub_uint64_t arg4, grub_uint64_t arg5,
                                        grub_uint64_t arg6);
+grub_uint64_t EXPORT_FUNC(efi_wrap_10) (void *func, grub_uint64_t arg1,
+                                        grub_uint64_t arg2, grub_uint64_t arg3,
+                                        grub_uint64_t arg4, grub_uint64_t arg5,
+                                        grub_uint64_t arg6, grub_uint64_t arg7,
+                                        grub_uint64_t arg8, grub_uint64_t arg9,
+                                        grub_uint64_t arg10);
 #endif
 
 #endif /* ! GRUB_EFI_API_HEADER */
include/grub/efi/pe32.h +9 -0
index 50b4102..4fb8d09 100644
@@ -231,7 +231,16 @@ struct grub_pe32_fixup_block
 #define GRUB_PE32_FIXUP_ENTRY(type, offset)	(((type) << 12) | (offset))
 
 #define GRUB_PE32_REL_BASED_ABSOLUTE	0
+#define GRUB_PE32_REL_BASED_HIGH	1
+#define GRUB_PE32_REL_BASED_LOW		2
 #define GRUB_PE32_REL_BASED_HIGHLOW	3
+#define GRUB_PE32_REL_BASED_HIGHADJ	4
+#define GRUB_PE32_REL_BASED_MIPS_JMPADDR 5
+#define GRUB_PE32_REL_BASED_SECTION	6
+#define GRUB_PE32_REL_BASED_REL		7
+#define GRUB_PE32_REL_BASED_IA64_IMM64	9
+#define GRUB_PE32_REL_BASED_DIR64	10
+#define GRUB_PE32_REL_BASED_HIGH3ADJ	11
 
 struct grub_pe32_symbol
 {
kern/x86_64/dl.c +3 -3
index bef3270..a84ac44 100644
@@ -97,17 +97,17 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
 		switch (ELF64_R_TYPE (rel->r_info))
 		  {
 		  case R_X86_64_64:
-		    *addr64 = rel->r_addend + sym->st_value;
+		    *addr64 += rel->r_addend + sym->st_value;
 		    break;
 
 		  case R_X86_64_PC32:
-		    *addr32 = rel->r_addend + sym->st_value -
+		    *addr32 += rel->r_addend + sym->st_value -
 		              (Elf64_Xword) seg->addr - rel->r_offset;
 		    break;
 
                   case R_X86_64_32:
                   case R_X86_64_32S:
-                    *addr32 = rel->r_addend + sym->st_value;
+                    *addr32 += rel->r_addend + sym->st_value;
                     break;
 
                   default:
kern/x86_64/efi/callwrap.S +22 -2
index 6c390ec..558d280 100644
@@ -1,7 +1,7 @@
 /* callwrap.S - wrapper for x86_64 efi calls */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2006,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2006,2007,2009  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -87,10 +87,30 @@ FUNCTION(efi_wrap_6)
 	subq $56, %rsp
 	mov 56+8(%rsp), %rax
 	mov %rax, 40(%rsp)
-	mov %r9, (%rsp)
+	mov %r9, 32(%rsp)
 	mov %r8, %r9
 	mov %rcx, %r8
 	mov %rsi, %rcx
 	call *%rdi
 	addq $56, %rsp
 	ret
+
+FUNCTION(efi_wrap_10)
+	subq $88, %rsp
+	mov 88+40(%rsp), %rax
+	mov %rax, 72(%rsp)
+	mov 88+32(%rsp), %rax
+	mov %rax, 64(%rsp)
+	mov 88+24(%rsp), %rax
+	mov %rax, 56(%rsp)
+	mov 88+16(%rsp), %rax
+	mov %rax, 48(%rsp)
+	mov 88+8(%rsp), %rax
+	mov %rax, 40(%rsp)
+	mov %r9, 32(%rsp)
+	mov %r8, %r9
+	mov %rcx, %r8
+	mov %rsi, %rcx
+	call *%rdi
+	addq $88, %rsp
+	ret
\ No newline at end of file
kern/x86_64/efi/startup.S +3 -4
index 2fa6766..835c4fb 100644
@@ -1,7 +1,7 @@
 /* startup.S - bootstrap GRUB itself */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2006,2007  Free Software Foundation, Inc.
+ *  Copyright (C) 2006,2007,2009  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -55,9 +55,8 @@ VARIABLE(grub_prefix)
         . = EXT_C(start) + 0x50
 
 codestart:
-
-	movq	%rcx, EXT_C(grub_efi_image_handle)
-	movq	%rdx, EXT_C(grub_efi_system_table)
+	movq	%rcx, EXT_C(grub_efi_image_handle)(%rip)
+	movq	%rdx, EXT_C(grub_efi_system_table)(%rip)
 
 	call	EXT_C(grub_main)
 	ret
loader/efi/appleloader.c +11 -0
index 910a13d..5e9936c 100644
@@ -103,6 +103,16 @@ static grub_uint8_t devpath_4[] =
   0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00,
 };
 
+/* late-2008 MB/MBP (NVidia chipset)  */
+static grub_uint8_t devpath_5[] = {
+    0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00,
+    0x00, 0x40, 0xCB, 0xFF, 0x00, 0x00, 0x00, 0x00,
+    0xFF, 0xBF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
+    0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B,
+    0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B,
+    0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00,
+};
+
 struct devdata
 {
   char *model;
@@ -115,6 +125,7 @@ struct devdata devs[] =
   {"Mac Pro", (grub_efi_device_path_t *) devpath_2},
   {"MBP", (grub_efi_device_path_t *) devpath_3},
   {"MBA", (grub_efi_device_path_t *) devpath_4},
+  {"MB NV", (grub_efi_device_path_t *) devpath_5},
   {NULL, NULL},
 };
 
loader/i386/efi/linux.c +42 -49

149 lines not on this page · raw message

util/i386/efi/grub-mkimage.c +9 -5
index 36ea31f..52a37b9 100644
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2004,2005,2006,2007,2008  Free Software Foundation, Inc.
+ *  Copyright (C) 2004,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -807,17 +807,21 @@ make_reloc_section (FILE *out, Elf_Addr current_address, Elf_Ehdr *e,
 						   out);
 	      }
 #else
-	    if ((ELF_R_TYPE (info) == R_X86_64_64) ||
-                (ELF_R_TYPE (info) == R_X86_64_32) ||
+	    if ((ELF_R_TYPE (info) == R_X86_64_32) ||
                 (ELF_R_TYPE (info) == R_X86_64_32S))
 	      {
+		grub_util_error ("Can\'t add fixup entry for R_X86_64_32(S)");
+	      }
+	    else if (ELF_R_TYPE (info) == R_X86_64_64)
+	      {
 		Elf_Addr addr;
 
 		addr = section_address + offset;
 		grub_util_info ("adding a relocation entry for 0x%llx", addr);
 		current_address = add_fixup_entry (&fixup_block,
-						   GRUB_PE32_REL_BASED_HIGHLOW,
-						   addr, 0, current_address,
+						   GRUB_PE32_REL_BASED_DIR64,
+						   addr,
+						   0, current_address,
 						   out);
 	      }
 #endif
#1 lore raw

Tested the patch applied to rev 1996 for grub.efi 64 bit and 32 bit, on Imac81 (4GB ram), MacBookPro41 (4GB and 2GB ram) MacBook21 (i386) with Macosx 10.4 10.5, ubuntu810.
All good.

64bit Macs have other ongoing EFI problems with linux kernel initializtion and keyboard.

Quoted 65 lines · Bean

Hi,

This patch contains several important update for x86_64 efi:

1, Support memory larger than 2G.
2, Fix a bug in efi_call_6 that could cause chainloadering osx to fail. 3, Improve the method to detect frame buffer address and line length in linux loader.

2009-02-19 Bean <[email protected]>

* configure.ac: Check for -mcmodel=large in x86_64 target.

* include/grub/efi/api.h (efi_call_10): New macro. (efi_wrap_10): New function.

* include/grub/efi/pe32.h (GRUB_PE32_REL_BASE_HIGH): New macro. (GRUB_PE32_REL_BASED_HIGH): Likewise. (GRUB_PE32_REL_BASED_LOW): Likewise. (GRUB_PE32_REL_BASED_HIGHLOW): Likewise. (GRUB_PE32_REL_BASED_HIGHADJ): Likewise. (GRUB_PE32_REL_BASED_MIPS_JMPADDR): Likewise. (GRUB_PE32_REL_BASED_SECTION): Likewise. (GRUB_PE32_REL_BASED_REL): Likewise. (GRUB_PE32_REL_BASED_IA64_IMM64): Likewise. (GRUB_PE32_REL_BASED_DIR64): Likewise. (GRUB_PE32_REL_BASED_HIGH3ADJ): Likewise.

* kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Fixed relocation issue.

* kern/x86_64/efi/callwrap.S (efi_wrap_6): Bug fix. (efi_wrap_10): New function.

* kern/x86_64/efi/startup.S (codestart): Use relative addressing.

* loader/efi/appleloader.c (devpath_5): Add support for late 2008 MB/MBP model (NV chipset).
(devdata_devs): Add devpath_5 to the list.

* load/i386/efi/linux.c (video_base): Remove variable. (RGB_MASK): New macro.
(RGB_MAGIC): Likewise.
(LINE_MIN): Likewise.
(LINE_MAX): Likewise.
(FBTEST_STEP): Likewise.
(FBTEST_COUNT): Likewise.
(fb_list): New variable.
(grub_find_video_card): Remove function. (find_framebuf): New function. (grub_linux_setup_video): Use find_framebuf to get frame buffer and line length.

* util/i386/efi/grub-mkimage.c (grub_reloc_section): Fix relocation problem for x86_64.

--
Bean

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 1 line
Cros (pxw)
#2 lore raw

Hi Peter / phcoder / all other grub gurus,

I've joined the grub-devel mail list while attempting to get MacIntel Xserves to boot linux. I work with a 3d Movie Effects company that has 25 MacIntel Xserves that are becoming close to as useful as paperweights because they can't run Maya at 64bit for rendering. (and we can't repurpose them as linux servers).

Any chance we can help test this patch in an xserve environment, and/or do you have any ideas that would help us?

Here's the most discouraging info I've received in my research to date:

The Xserve does not have BIOS compatibility, and so you'll need to boot through EFI. The Apple EFI implementation will not boot directly off ISO9660 media, so you'll need to find a way to get to the EFI console. You'll need a kernel configured with EFI support. There's no especially sensible way to get a working framebuffer on this hardware, so you'll need to work out what arguments need to be passed to your distribution's installer in order to get it to run over the serial port. elilo or grub-efi should be able to boot the kernel and initramfs.

I've been catologing my research at:
http://drewsta.com/xserve.html

Thanks!

Drew

Quoted 88 lines · Peter Cros

Tested the patch applied to rev 1996 for grub.efi 64 bit and 32 bit, on Imac81 (4GB ram), MacBookPro41 (4GB and 2GB ram) MacBook21 (i386) with Macosx 10.4 10.5, ubuntu810.
All good.

64bit Macs have other ongoing EFI problems with linux kernel initializtion and keyboard.

On Fri, Feb 20, 2009 at 2:12 AM, Bean <[email protected]> wrote:
Hi,

This patch contains several important update for x86_64 efi:

1, Support memory larger than 2G.
2, Fix a bug in efi_call_6 that could cause chainloadering osx to fail. 3, Improve the method to detect frame buffer address and line length in linux loader.

2009-02-19 Bean <[email protected]>

       * configure.ac: Check for -mcmodel=large in x86_64 target.

       * include/grub/efi/api.h (efi_call_10): New macro.
       (efi_wrap_10): New function.

       * include/grub/efi/pe32.h (GRUB_PE32_REL_BASE_HIGH): New macro.
       (GRUB_PE32_REL_BASED_HIGH): Likewise.
       (GRUB_PE32_REL_BASED_LOW): Likewise.
       (GRUB_PE32_REL_BASED_HIGHLOW): Likewise.
       (GRUB_PE32_REL_BASED_HIGHADJ): Likewise.
       (GRUB_PE32_REL_BASED_MIPS_JMPADDR): Likewise.
       (GRUB_PE32_REL_BASED_SECTION): Likewise.
       (GRUB_PE32_REL_BASED_REL): Likewise.
       (GRUB_PE32_REL_BASED_IA64_IMM64): Likewise.
       (GRUB_PE32_REL_BASED_DIR64): Likewise.
       (GRUB_PE32_REL_BASED_HIGH3ADJ): Likewise.

       * kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Fixed  

relocation
issue.

* kern/x86_64/efi/callwrap.S (efi_wrap_6): Bug fix. (efi_wrap_10): New function.

* kern/x86_64/efi/startup.S (codestart): Use relative
addressing.

* loader/efi/appleloader.c (devpath_5): Add support for late
2008
MB/MBP model (NV chipset).
(devdata_devs): Add devpath_5 to the list.

* load/i386/efi/linux.c (video_base): Remove variable. (RGB_MASK): New macro.
(RGB_MAGIC): Likewise.
(LINE_MIN): Likewise.
(LINE_MAX): Likewise.
(FBTEST_STEP): Likewise.
(FBTEST_COUNT): Likewise.
(fb_list): New variable. (grub_find_video_card): Remove function. (find_framebuf): New function. (grub_linux_setup_video): Use find_framebuf to get frame
buffer and
line length.

* util/i386/efi/grub-mkimage.c (grub_reloc_section): Fix
relocation

       problem for x86_64.

--
Bean

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 7 lines
Cros (pxw)


_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
#3 lore raw

I am just a grub.efi user/tester/enthusiast.

I don't know the Xserve but some previous reports in this list of people getting grub.efi to boot on Xserve, and if so it will boot hd/usb linux on other Apple intel Macs with varying results .

There are some grub.efi 64/32 bit test packages on ubuntuforums that you might try (include the patch) . Xserve results would be interesting.

grub2 EFI boot loader internal/external booting<http://ubuntuforums.org/showthread.php?t=995704>

Quoted 128 lines · Drew Rosen

Hi Peter / phcoder / all other grub gurus,
I've joined the grub-devel mail list while attempting to get MacIntel Xserves to boot linux. I work with a 3d Movie Effects company that has 25 MacIntel Xserves that are becoming close to as useful as paperweights because they can't run Maya at 64bit for rendering. (and we can't repurpose them as linux servers).

Any chance we can help test this patch in an xserve environment, and/or do you have any ideas that would help us?

Here's the most discouraging info I've received in my research to date:

The Xserve does not have BIOS compatibility, and so you'll need to boot through EFI. The Apple EFI implementation will not boot directly off ISO9660 media, so you'll need to find a way to get to the EFI console. You'll need a kernel configured with EFI support. There's no especially sensible way to get a working framebuffer on this hardware, so you'll need to work out what arguments need to be passed to your distribution's installer in order to get it to run over the serial port. elilo or grub-efi should be able to boot the kernel and initramfs.

I've been catologing my research at:
http://drewsta.com/xserve.html

Thanks!

Drew

On Feb 20, 2009, at 6:28 AM, Peter Cros wrote:

Tested the patch applied to rev 1996 for grub.efi 64 bit and 32 bit, on Imac81 (4GB ram), MacBookPro41 (4GB and 2GB ram) MacBook21 (i386) with Macosx 10.4 10.5, ubuntu810.
All good.

64bit Macs have other ongoing EFI problems with linux kernel initializtion and keyboard.

Quoted 57 lines · Bean

Hi,

This patch contains several important update for x86_64 efi:

1, Support memory larger than 2G.
2, Fix a bug in efi_call_6 that could cause chainloadering osx to fail. 3, Improve the method to detect frame buffer address and line length in linux loader.

2009-02-19 Bean <[email protected]>

       * configure.ac: Check for -mcmodel=large in x86_64 target.

       * include/grub/efi/api.h (efi_call_10): New macro.
       (efi_wrap_10): New function.

       * include/grub/efi/pe32.h (GRUB_PE32_REL_BASE_HIGH): New macro.
       (GRUB_PE32_REL_BASED_HIGH): Likewise.
       (GRUB_PE32_REL_BASED_LOW): Likewise.
       (GRUB_PE32_REL_BASED_HIGHLOW): Likewise.
       (GRUB_PE32_REL_BASED_HIGHADJ): Likewise.
       (GRUB_PE32_REL_BASED_MIPS_JMPADDR): Likewise.
       (GRUB_PE32_REL_BASED_SECTION): Likewise.
       (GRUB_PE32_REL_BASED_REL): Likewise.
       (GRUB_PE32_REL_BASED_IA64_IMM64): Likewise.
       (GRUB_PE32_REL_BASED_DIR64): Likewise.
       (GRUB_PE32_REL_BASED_HIGH3ADJ): Likewise.

       * kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Fixed

relocation
issue.

* kern/x86_64/efi/callwrap.S (efi_wrap_6): Bug fix. (efi_wrap_10): New function.

* kern/x86_64/efi/startup.S (codestart): Use relative addressing.

* loader/efi/appleloader.c (devpath_5): Add support for late 2008 MB/MBP model (NV chipset).
(devdata_devs): Add devpath_5 to the list.

* load/i386/efi/linux.c (video_base): Remove variable. (RGB_MASK): New macro.
(RGB_MAGIC): Likewise.
(LINE_MIN): Likewise.
(LINE_MAX): Likewise.
(FBTEST_STEP): Likewise.
(FBTEST_COUNT): Likewise.
(fb_list): New variable.
(grub_find_video_card): Remove function. (find_framebuf): New function. (grub_linux_setup_video): Use find_framebuf to get frame buffer and line length.

* util/i386/efi/grub-mkimage.c (grub_reloc_section): Fix relocation problem for x86_64.

Quoted 9 lines

--
Bean

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

--
Cros (pxw)

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 1 line
Cros (pxw)
#4 lore raw

Thanks for your interest in helping Peter. At first look, the ubuntu forum looks like we're seeing xserver info, but no one using MacIntel Xserve hardware to test grub. If you know anyone who could help us push thru what is causing the Xserve to not work like the MacIntel Mac Pro Desktops, I'M LOOKING FOR THAT PERSON...

Cheers.

Quoted 138 lines · Peter Cros

I am just a grub.efi user/tester/enthusiast.

I don't know the Xserve but some previous reports in this list of people getting grub.efi to boot on Xserve, and if so it will boot hd/usb linux on other Apple intel Macs with varying results .

There are some grub.efi 64/32 bit test packages on ubuntuforums that you might try (include the patch) . Xserve results would be interesting.

grub2 EFI boot loader internal/external booting

On Sat, Feb 21, 2009 at 3:16 AM, Drew Rosen <[email protected]> wrote:
Hi Peter / phcoder / all other grub gurus,

I've joined the grub-devel mail list while attempting to get MacIntel Xserves to boot linux. I work with a 3d Movie Effects company that has 25 MacIntel Xserves that are becoming close to as useful as paperweights because they can't run Maya at 64bit for rendering. (and we can't repurpose them as linux servers).

Any chance we can help test this patch in an xserve environment, and/or do you have any ideas that would help us?

Here's the most discouraging info I've received in my research to date:

The Xserve does not have BIOS compatibility, and so you'll need to boot through EFI. The Apple EFI implementation will not boot directly off ISO9660 media, so you'll need to find a way to get to the EFI console. You'll need a kernel configured with EFI support. There's no especially sensible way to get a working framebuffer on this hardware, so you'll need to work out what arguments need to be passed to your distribution's installer in order to get it to run over the serial port. elilo or grub-efi should be able to boot the kernel and initramfs.

I've been catologing my research at:
http://drewsta.com/xserve.html

Thanks!

Drew

Quoted 70 lines · Peter Cros

Tested the patch applied to rev 1996 for grub.efi 64 bit and 32 bit, on Imac81 (4GB ram), MacBookPro41 (4GB and 2GB ram) MacBook21 (i386) with Macosx 10.4 10.5, ubuntu810.
All good.

64bit Macs have other ongoing EFI problems with linux kernel initializtion and keyboard.

On Fri, Feb 20, 2009 at 2:12 AM, Bean <[email protected]> wrote:
Hi,

This patch contains several important update for x86_64 efi:

1, Support memory larger than 2G.
2, Fix a bug in efi_call_6 that could cause chainloadering osx to fail. 3, Improve the method to detect frame buffer address and line length in linux loader.

2009-02-19 Bean <[email protected]>

* configure.ac: Check for -mcmodel=large in x86_64 target.

* include/grub/efi/api.h (efi_call_10): New macro. (efi_wrap_10): New function.

* include/grub/efi/pe32.h (GRUB_PE32_REL_BASE_HIGH): New
macro.

       (GRUB_PE32_REL_BASED_HIGH): Likewise.
       (GRUB_PE32_REL_BASED_LOW): Likewise.
       (GRUB_PE32_REL_BASED_HIGHLOW): Likewise.
       (GRUB_PE32_REL_BASED_HIGHADJ): Likewise.
       (GRUB_PE32_REL_BASED_MIPS_JMPADDR): Likewise.
       (GRUB_PE32_REL_BASED_SECTION): Likewise.
       (GRUB_PE32_REL_BASED_REL): Likewise.
       (GRUB_PE32_REL_BASED_IA64_IMM64): Likewise.
       (GRUB_PE32_REL_BASED_DIR64): Likewise.
       (GRUB_PE32_REL_BASED_HIGH3ADJ): Likewise.

       * kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Fixed  

relocation
issue.

* kern/x86_64/efi/callwrap.S (efi_wrap_6): Bug fix. (efi_wrap_10): New function.

* kern/x86_64/efi/startup.S (codestart): Use relative
addressing.

* loader/efi/appleloader.c (devpath_5): Add support for late
2008
MB/MBP model (NV chipset).
(devdata_devs): Add devpath_5 to the list.

* load/i386/efi/linux.c (video_base): Remove variable. (RGB_MASK): New macro.
(RGB_MAGIC): Likewise.
(LINE_MIN): Likewise.
(LINE_MAX): Likewise.
(FBTEST_STEP): Likewise.
(FBTEST_COUNT): Likewise.
(fb_list): New variable. (grub_find_video_card): Remove function. (find_framebuf): New function. (grub_linux_setup_video): Use find_framebuf to get frame
buffer and
line length.

* util/i386/efi/grub-mkimage.c (grub_reloc_section): Fix
relocation

       problem for x86_64.
Quoted 19 lines

--
Bean

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 7 lines
Cros (pxw)


_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 7 lines
Cros (pxw)


_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
#5 lore raw

Hi,

True we don't have any grub.efi Apple intel Xserve hardware tests so far, at the apple intel ubuntu forum, but the grub-efi test packages there could be used to test.
Seems you will need to get some current grub.efi test result to point to problems specific to the Xserve, sufficient to attract help at developer level.

There are also some graphics limitations (use of framebuffer driver) after EFI linux booting for other intel macs, might be important for your application.

Quoted 173 lines · Drew Rosen

Thanks for your interest in helping Peter. At first look, the ubuntu forum looks like we're seeing xserver info, but no one using MacIntel Xserve hardware to test grub. If you know anyone who could help us push thru what is causing the Xserve to not work like the MacIntel Mac Pro Desktops, I'M LOOKING FOR THAT PERSON...
Cheers.

On Feb 20, 2009, at 9:32 PM, Peter Cros wrote:

I am just a grub.efi user/tester/enthusiast.

I don't know the Xserve but some previous reports in this list of people getting grub.efi to boot on Xserve, and if so it will boot hd/usb linux on other Apple intel Macs with varying results .

There are some grub.efi 64/32 bit test packages on ubuntuforums that you might try (include the patch) . Xserve results would be interesting.

grub2 EFI boot loader internal/external booting<http://ubuntuforums.org/showthread.php?t=995704>

Quoted 124 lines · Drew Rosen

Hi Peter / phcoder / all other grub gurus,
I've joined the grub-devel mail list while attempting to get MacIntel Xserves to boot linux. I work with a 3d Movie Effects company that has 25 MacIntel Xserves that are becoming close to as useful as paperweights because they can't run Maya at 64bit for rendering. (and we can't repurpose them as linux servers).

Any chance we can help test this patch in an xserve environment, and/or do you have any ideas that would help us?

Here's the most discouraging info I've received in my research to date:

The Xserve does not have BIOS compatibility, and so you'll need to boot through EFI. The Apple EFI implementation will not boot directly off ISO9660 media, so you'll need to find a way to get to the EFI console. You'll need a kernel configured with EFI support. There's no especially sensible way to get a working framebuffer on this hardware, so you'll need to work out what arguments need to be passed to your distribution's installer in order to get it to run over the serial port. elilo or grub-efi should be able to boot the kernel and initramfs.

I've been catologing my research at:
http://drewsta.com/xserve.html

Thanks!

Drew

On Feb 20, 2009, at 6:28 AM, Peter Cros wrote:

Tested the patch applied to rev 1996 for grub.efi 64 bit and 32 bit, on Imac81 (4GB ram), MacBookPro41 (4GB and 2GB ram) MacBook21 (i386) with Macosx 10.4 10.5, ubuntu810.
All good.

64bit Macs have other ongoing EFI problems with linux kernel initializtion and keyboard.

Quoted 59 lines · Bean

Hi,

This patch contains several important update for x86_64 efi:

1, Support memory larger than 2G.
2, Fix a bug in efi_call_6 that could cause chainloadering osx to fail. 3, Improve the method to detect frame buffer address and line length in linux loader.

2009-02-19 Bean <[email protected]>

       * configure.ac: Check for -mcmodel=large in x86_64 target.

       * include/grub/efi/api.h (efi_call_10): New macro.
       (efi_wrap_10): New function.

       * include/grub/efi/pe32.h (GRUB_PE32_REL_BASE_HIGH): New macro.
       (GRUB_PE32_REL_BASED_HIGH): Likewise.
       (GRUB_PE32_REL_BASED_LOW): Likewise.
       (GRUB_PE32_REL_BASED_HIGHLOW): Likewise.
       (GRUB_PE32_REL_BASED_HIGHADJ): Likewise.
       (GRUB_PE32_REL_BASED_MIPS_JMPADDR): Likewise.
       (GRUB_PE32_REL_BASED_SECTION): Likewise.
       (GRUB_PE32_REL_BASED_REL): Likewise.
       (GRUB_PE32_REL_BASED_IA64_IMM64): Likewise.
       (GRUB_PE32_REL_BASED_DIR64): Likewise.
       (GRUB_PE32_REL_BASED_HIGH3ADJ): Likewise.

       * kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Fixed

relocation
issue.

* kern/x86_64/efi/callwrap.S (efi_wrap_6): Bug fix. (efi_wrap_10): New function.

* kern/x86_64/efi/startup.S (codestart): Use relative addressing.

* loader/efi/appleloader.c (devpath_5): Add support for late 2008 MB/MBP model (NV chipset).
(devdata_devs): Add devpath_5 to the list.

* load/i386/efi/linux.c (video_base): Remove variable. (RGB_MASK): New macro.
(RGB_MAGIC): Likewise.
(LINE_MIN): Likewise.
(LINE_MAX): Likewise.
(FBTEST_STEP): Likewise.
(FBTEST_COUNT): Likewise.
(fb_list): New variable.
(grub_find_video_card): Remove function. (find_framebuf): New function. (grub_linux_setup_video): Use find_framebuf to get frame buffer
and
line length.

* util/i386/efi/grub-mkimage.c (grub_reloc_section): Fix
relocation

       problem for x86_64.
Quoted 9 lines

--
Bean

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

--
Cros (pxw)

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Quoted 6 lines

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

--
Cros (pxw)

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 1 line
Cros (pxw)
author
#6 lore raw

Committed.

Signature · 1 line
Bean
#7 lore raw
In reply to Peter Cros

I'd be happy to document errors and such if someone can recommend what the best path of target is.

Maya rendering doesn't actually touch the video cards (some of our linux systems don't even have video cards), and general usage servers don't care much so drivers for the systems aren't a huge concern as long as the systems don't crash.

i'll try to setup a dev system this weekend and get some feedback posted. are there any critical steps and/or locations for submitting data for this project that i should know? or just post on a web wiki and send an email?

thanks!!!

Quoted 172 lines · Peter Cros

Hi,

True we don't have any grub.efi Apple intel Xserve hardware tests so far, at the apple intel ubuntu forum, but the grub-efi test packages there could be used to test. Seems you will need to get some current grub.efi test result to point to problems specific to the Xserve, sufficient to attract help at developer level.

There are also some graphics limitations (use of framebuffer driver) after EFI linux booting for other intel macs, might be important for your application.

On Sun, Feb 22, 2009 at 2:16 PM, Drew Rosen <[email protected]> wrote:
Thanks for your interest in helping Peter. At first look, the ubuntu forum looks like we're seeing xserver info, but no one using MacIntel Xserve hardware to test grub. If you know anyone who could help us push thru what is causing the Xserve to not work like the MacIntel Mac Pro Desktops, I'M LOOKING FOR THAT PERSON...

Cheers.

Quoted 122 lines · Peter Cros

I am just a grub.efi user/tester/enthusiast.

I don't know the Xserve but some previous reports in this list of people getting grub.efi to boot on Xserve, and if so it will boot hd/usb linux on other Apple intel Macs with varying results .

There are some grub.efi 64/32 bit test packages on ubuntuforums that you might try (include the patch) . Xserve results would be interesting.

grub2 EFI boot loader internal/external booting

On Sat, Feb 21, 2009 at 3:16 AM, Drew Rosen <[email protected]> wrote:
Hi Peter / phcoder / all other grub gurus,

I've joined the grub-devel mail list while attempting to get MacIntel Xserves to boot linux. I work with a 3d Movie Effects company that has 25 MacIntel Xserves that are becoming close to as useful as paperweights because they can't run Maya at 64bit for rendering. (and we can't repurpose them as linux servers).

Any chance we can help test this patch in an xserve environment, and/or do you have any ideas that would help us?

Here's the most discouraging info I've received in my research to date:

The Xserve does not have BIOS compatibility, and so you'll need to boot through EFI. The Apple EFI implementation will not boot directly off ISO9660 media, so you'll need to find a way to get to the EFI console. You'll need a kernel configured with EFI support. There's no especially sensible way to get a working framebuffer on this hardware, so you'll need to work out what arguments need to be passed to your distribution's installer in order to get it to run over the serial port. elilo or grub-efi should be able to boot the kernel and initramfs.

I've been catologing my research at:
http://drewsta.com/xserve.html

Thanks!

Drew

Quoted 70 lines · Peter Cros

Tested the patch applied to rev 1996 for grub.efi 64 bit and 32 bit, on Imac81 (4GB ram), MacBookPro41 (4GB and 2GB ram) MacBook21 (i386) with Macosx 10.4 10.5, ubuntu810.
All good.

64bit Macs have other ongoing EFI problems with linux kernel initializtion and keyboard.

On Fri, Feb 20, 2009 at 2:12 AM, Bean <[email protected]> wrote:
Hi,

This patch contains several important update for x86_64 efi:

1, Support memory larger than 2G.
2, Fix a bug in efi_call_6 that could cause chainloadering osx to fail. 3, Improve the method to detect frame buffer address and line length in linux loader.

2009-02-19 Bean <[email protected]>

* configure.ac: Check for -mcmodel=large in x86_64 target.

* include/grub/efi/api.h (efi_call_10): New macro. (efi_wrap_10): New function.

* include/grub/efi/pe32.h (GRUB_PE32_REL_BASE_HIGH): New
macro.

       (GRUB_PE32_REL_BASED_HIGH): Likewise.
       (GRUB_PE32_REL_BASED_LOW): Likewise.
       (GRUB_PE32_REL_BASED_HIGHLOW): Likewise.
       (GRUB_PE32_REL_BASED_HIGHADJ): Likewise.
       (GRUB_PE32_REL_BASED_MIPS_JMPADDR): Likewise.
       (GRUB_PE32_REL_BASED_SECTION): Likewise.
       (GRUB_PE32_REL_BASED_REL): Likewise.
       (GRUB_PE32_REL_BASED_IA64_IMM64): Likewise.
       (GRUB_PE32_REL_BASED_DIR64): Likewise.
       (GRUB_PE32_REL_BASED_HIGH3ADJ): Likewise.

       * kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Fixed  

relocation
issue.

* kern/x86_64/efi/callwrap.S (efi_wrap_6): Bug fix. (efi_wrap_10): New function.

* kern/x86_64/efi/startup.S (codestart): Use relative
addressing.

* loader/efi/appleloader.c (devpath_5): Add support for
late 2008
MB/MBP model (NV chipset).
(devdata_devs): Add devpath_5 to the list.

* load/i386/efi/linux.c (video_base): Remove variable. (RGB_MASK): New macro.
(RGB_MAGIC): Likewise.
(LINE_MIN): Likewise.
(LINE_MAX): Likewise.
(FBTEST_STEP): Likewise.
(FBTEST_COUNT): Likewise.
(fb_list): New variable. (grub_find_video_card): Remove function. (find_framebuf): New function. (grub_linux_setup_video): Use find_framebuf to get frame
buffer and
line length.

* util/i386/efi/grub-mkimage.c (grub_reloc_section): Fix
relocation

       problem for x86_64.
Quoted 19 lines

--
Bean

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 7 lines
Cros (pxw)


_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 16 lines

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 7 lines
Cros (pxw)


_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 7 lines
Cros (pxw)


_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel