grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grub.efi x86_64 on Apple 64bit efi models - status of testing


From: Peter Cros
Subject: grub.efi x86_64 on Apple 64bit efi models - status of testing
Date: Mon, 9 Feb 2009 23:24:17 +1100

 I have got to a standstill with this, some major stoppers found and could use some help to debug further. I hope someone can take a look at this please, its getting beyond my limited C code reading and hacking capabilities, but I do want to see grub.efi working on current Apple Intel Macs.

Apple Linux/OSX users can benefit from grub.efi major advantages over the Apple pc-bios emulation which cannot boot external drives and has other installation problems for Linux users. Apple Mac users multi-booting GNU/Linux and Mac OSX are a good testing ground for EFI booting. A number of people in the ubuntuforums have tested grub.efi x86 and x86_64 on Apple intel Macs from intel core2duo on. There have also been some recent reported problems posted on grub-devel list.

I have not seen anything for IA32/64 machines.

From early 2008, Macs have been using 64bit EFI, needing x86_64 grub.efi, and I have posted on ubuntuforums a full x86_64 grub.efi package with all modules and grub.cfg for people to try.

No one has been able to get x86_64 grub.efi to boot and run either Mac OSX (boot.efi) or ubuntu 810 2.6.27 kernels (configured for EFI). All this works well for x86 grub.efi on Intel Macs with the earlier 32 bit firmware.

-------------------------------

Three specific issues are stopping useful testing -

1. Mac models from imac8,1 early 2008 are unable to boot grub.efi 64bit when 4GB RAM is fitted.
  Dropping to 2GB RAM enables grub.efi to boot and display grub.cfg  menu with fully functional command line. This leads to the next problems -

2. The grub.efi chainloader command fails to load /usr/standalone/i386/boot.efi, reporting ' error: cannot load image '

3. grub.efi successfully loads ubuntu x86 2.6.7-7 kernel ( or earlier debian 2.6.26 ) using command line or menuentry, but the boot fails.

After boot command, the boot screen goes to black and no further progress seen,
except in one case some garbled video indicating possible boot but failure to init.

4. Finally, there was a problem getting ubuntu 810 amd64 to complete initialization after booting in earlier 32 bit grub.efi tests, and other issues with accelerated graphics and keyboard. - Not yet the issue here.

-------------------------

I got as far as locating the area in the grub2 code as shown in the attached diffs of commented files, and will continue to look throught the code, or can try any suggested debugging. I have some access to an Imac8,1 MacBook Pro 4,1 and a MacBook2,1.
( So far using set debug=all or selective, grub_printf(); grub_getkey();  asm volatile ("ret" : : ); )

But I am not a programmer and need help to go further. The x86 32 bit grub.efi functions very well on MacBook2,1 and other earlier 32 bit EFI Apples, but the later models need the x86_64 build, and at present it is not functional at all.  The Apple firmware and EFI seems to need special treatment.

-------------------------
Diffs - ( these are just grub2 rev 1972 commented 'pxwdebug' to show where I got to )

Diff 1. Failing to run grub.efi with 4GB RAM.

grub2 r=1972

--- grub2a/kern/x86_64/efi/startup.S    2009-02-04 17:04:14.000000000 +1100
+++ grub2b/kern/x86_64/efi/startup.S    2009-02-09 18:19:32.000000000 +1100
@@ -57,10 +57,12 @@ VARIABLE(grub_prefix)
 codestart:
 
     movq    %rcx, EXT_C(grub_efi_image_handle)
     movq    %rdx, EXT_C(grub_efi_system_table)
 
+/*pxwdebug - with 4GB RAM,  startup hangs before the call */
+
     call    EXT_C(grub_main)
     ret
 
-------------------------
 
Diff 2. Failure of efi chainloader for Mac OSX

grub2 r=1972

--- grub2a/loader/efi/chainloader.c    2009-02-04 17:04:22.000000000 +1100
+++ grub2b/loader/efi/chainloader.c    2009-02-09 17:50:35.000000000 +1100
@@ -253,21 +253,21 @@ grub_rescue_cmd_chainloader (int argc, c
       if (grub_errno == GRUB_ERR_NONE)
     grub_error (GRUB_ERR_BAD_OS, "too small");
 
       goto fail;
     }
-
+/* pxwdebug macosx 10.4 10.5 fail to load with grub.efi x86_64 */
   status = efi_call_6 (b->load_image, 0, grub_efi_image_handle, file_path,
               (void *) ((grub_addr_t) address), size,
               &image_handle);
   if (status != GRUB_EFI_SUCCESS)
     {
       if (status == GRUB_EFI_OUT_OF_RESOURCES)
     grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of resources");
       else
     grub_error (GRUB_ERR_BAD_OS, "cannot load image");
-     
+/*pxwdebug  error message is "cannot load image" */
       goto fail;
     }
 
-------------------------------
Diff 3.  efi Linux boot fails.

grub2 r=1972

--- grub2a/loader/i386/efi/linux.c    2009-02-04 17:04:22.000000000 +1100
+++ grub2b/loader/i386/efi/linux.c    2009-02-09 18:09:22.000000000 +1100
@@ -419,19 +419,19 @@ grub_linux_boot (void)
   asm volatile ("cli" : : );
  
   /* Load the IDT and the GDT for the bootstrap.  */
   asm volatile ("lidt %0" : : "m" (idt_desc));
   asm volatile ("lgdt %0" : : "m" (gdt_desc));
-
+/*pxwdebug x86_64 linux boot fails */
 #ifdef __x86_64__
 
   jumpvector.kernel_entry = (grub_uint64_t) grub_linux_real_boot;
   jumpvector.kernel_cs = 0x10;
 
   asm volatile ( "mov %0, %%rbx" : : "m" (params->code32_start));
   asm volatile ( "mov %0, %%rsi" : : "m" (real_mode_mem));
-
+/*pxwdebug boot fails after ljmp */
   asm volatile ( "ljmp *%0" : : "m" (jumpvector));
 
 #else
 
   /* Pass parameters.  */
-------------------------


--
Cros

reply via email to

[Prev in Thread] Current Thread [Next in Thread]