Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LWVBY-0006jx-9f for mharc-grub-devel@gnu.org; Mon, 09 Feb 2009 07:24:24 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LWVBV-0006iy-Gp for grub-devel@gnu.org; Mon, 09 Feb 2009 07:24:21 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LWVBT-0006i8-GC for Grub-devel@gnu.org; Mon, 09 Feb 2009 07:24:20 -0500 Received: from [199.232.76.173] (port=52662 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LWVBT-0006i5-BX for Grub-devel@gnu.org; Mon, 09 Feb 2009 07:24:19 -0500 Received: from wa-out-1112.google.com ([209.85.146.179]:37478) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LWVBS-0006xm-Mx for Grub-devel@gnu.org; Mon, 09 Feb 2009 07:24:19 -0500 Received: by wa-out-1112.google.com with SMTP id k17so904111waf.26 for ; Mon, 09 Feb 2009 04:24:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=jI/dUtmtssgpN238HrUWQtBGqHEc9h2wDj9l9NO93Xg=; b=mGZ4MNhaLPB/n8Ww7ffc8WMyagdToZ2YCTIUrXs6A84wOrrVNmEQB0QAjpFON3ligK yp4bU8STEhd/Yyetrs9hrc+cTNF1zAV/FcEuMWMkECbR2Gn+pNwEDEdtuKl8bMTlaqfg Kimrs0CsqZNHRr5z2FXEk4WsUz4lxPTxaUVUk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=tvPpaaupMvabRa87ODkzBegQiq5GSwqEvrTjSLbDf9jl58EofmrwuZbNIk9HnOtkon BKZFN1vbn/p00kaShaGkxXzlA98JQFJiXpkQ7Da/MdG5oX8zxlyt6WBMXypdl3CnL5eK 1I96sfLdfBGt5Zhg0W1jbtGelV0l//8ZZtEi8= MIME-Version: 1.0 Received: by 10.114.170.1 with SMTP id s1mr3567358wae.57.1234182257175; Mon, 09 Feb 2009 04:24:17 -0800 (PST) Date: Mon, 9 Feb 2009 23:24:17 +1100 Message-ID: <48f46e890902090424sc91d00eycceea4244d27a3b7@mail.gmail.com> From: Peter Cros To: Grub-devel@gnu.org Content-Type: multipart/alternative; boundary=0016364c716b06eef504627b73f8 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Subject: grub.efi x86_64 on Apple 64bit efi models - status of testing X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Feb 2009 12:24:22 -0000 --0016364c716b06eef504627b73f8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 --0016364c716b06eef504627b73f8 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable  I have got to a standstill with this, some major stoppers found and c= ould 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 capabilit= ies, 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 t= he Apple pc-bios emulation which cannot boot external drives and has other = installation problems for Linux users. Apple Mac users multi-booting GNU/Li= nux and Mac OSX are a good testing ground for EFI booting. A number of peop= le in the ubuntuforums have tested grub.efi x86 and x86_64 on Apple intel M= acs from intel core2duo on. There have also been some recent reported probl= ems 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.cf= g 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 stoppi= ng 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 R= AM enables grub.efi to boot and display grub.cfg  menu with fully func= tional 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 progre= ss 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.e= fi tests, and other issues with accelerated graphics and keyboard. - Not ye= t the issue here.

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

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

But I am not a programm= er 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 ne= ed 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 co= mmented 'pxwdebug' to show where I got to )

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

grub2 r=3D1972

--- grub2a/kern/= x86_64/efi/startup.S    2009-02-04 17:04:14.000000000 +1100<= br> +++ grub2b/kern/x86_64/efi/startup.S    2009-02-09 18:19:32.= 000000000 +1100
@@ -57,10 +57,12 @@ VARIABLE(grub_prefix)
 codes= tart:
 
     movq    %rcx, EX= T_C(grub_efi_image_handle)
     movq  &nbs= p; %rdx, EXT_C(grub_efi_system_table)
 
+/*pxwdebug - with 4GB RAM,  startup hangs before the call *= /
+
     call    EXT_C(grub_main)<= br>     ret
 
-------------------------
&= nbsp;
Diff 2. Failure of efi chainloader for Mac OSX

grub2 r=3D1= 972

--- 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_c= md_chainloader (int argc, c
       if (grub_errno =3D=3D GRUB_ERR_NONE)     grub_error (GRUB_ERR_BAD_OS, "too small&quo= t;);
 
       goto fail;
 =     }
-
+/* pxwdebug macosx 10.4 10.5 fail to load wit= h grub.efi x86_64 */
   status =3D efi_call_6 (b->load_imag= e, 0, grub_efi_image_handle, file_path,
               (void= *) ((grub_addr_t) address), size,
       =         &image_handle);
   if (st= atus !=3D GRUB_EFI_SUCCESS)
     {
  &n= bsp;    if (status =3D=3D GRUB_EFI_OUT_OF_RESOURCES)
&nbs= p;    grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of resou= rces");
       else
     grub_= error (GRUB_ERR_BAD_OS, "cannot load image");
-  &nb= sp;  
+/*pxwdebug  error message is "cannot load im= age" */
       goto fail;
 &n= bsp;   }
 
-------------------------------
Diff 3.  efi Linux boot fails.

grub2 r=3D1972

--- grub2a= /loader/i386/efi/linux.c    2009-02-04 17:04:22.000000000 +1= 100
+++ grub2b/loader/i386/efi/linux.c    2009-02-09 18:0= 9:22.000000000 +1100
@@ -419,19 +419,19 @@ grub_linux_boot (void)
   asm volatile ("cli" : : );
  
 = ;  /* Load the IDT and the GDT for the bootstrap.  */
 &n= bsp; asm volatile ("lidt %0" : : "m" (idt_desc));
&n= bsp;  asm volatile ("lgdt %0" : : "m" (gdt_desc));=
-
+/*pxwdebug x86_64 linux boot fails */
 #ifdef __x86_64__
&= nbsp;
   jumpvector.kernel_entry =3D (grub_uint64_t) grub_linu= x_real_boot;
   jumpvector.kernel_cs =3D 0x10;
 
&n= bsp;  asm volatile ( "mov %0, %%rbx" : : "m" (para= ms->code32_start));
   asm volatile ( "mov %0, %%rsi" : : "m" (re= al_mode_mem));
-
+/*pxwdebug boot fails after ljmp */
  = asm volatile ( "ljmp *%0" : : "m" (jumpvector));
&n= bsp;
 #else
 
   /* Pass parameters.  */
-------------------------
<= br clear=3D"all">
--
Cros
--0016364c716b06eef504627b73f8--