[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug #36532] boot in EFI mode (x86_64) fails on some systems
From: |
Vladimir 'φ-coder/phcoder' Serbinenko |
Subject: |
Re: [bug #36532] boot in EFI mode (x86_64) fails on some systems |
Date: |
Mon, 11 Jun 2012 21:29:02 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4 |
On 11.06.2012 21:13, address@hidden wrote:
>>
>> On 07.06.2012 21:02, address@hidden wrote:
>>
>>> Vladimir,
>>>
>>> On 27 May you had asked me to test a patch to see if it fixed the
>> x86_64 EFI boot issue I was seeing
>> (http://lists.gnu.org/archive/html/grub-devel/2012-05/msg00064.html).
>>>
>>> This patch apparently moved the linux real mode allocation into
>> grub_linux_boot(). It appeared that the relevant changes (the changes
>> in grub-core/loader/i386/linux.c) in the patch you attached to that
>> email were already in HEAD, at least by the time I got it.
>>
>>>
>>> So I will re-work my patch with the changes you requested on 26 May
>> (http://lists.gnu.org/archive/html/grub-devel/2012-05/msg00063.html).
>>
>> There should be no need for it now. Please test that latest HEAD works
>> for you
>>
>> --
>> Regards
>> Vladimir 'φ-coder/phcoder' Serbinenko
>
> Just re-tested HEAD from 7 june. It doesn't appear that
> grub-core/loader/i386/linux.c has changed from the previous version I tested,
> and it still fails.
>
> I see that your patch to move the EFI memory map buffer allocation into
> grub_linux_boot() is moving the allocation a lot closer to when the buffer is
> used, but it doesn't appear to be close enough.
>
> I added a couple prints, and, on the particular system I'm working with, the
> efi memory map buffer is 16384 bytes when grub_efi_finish_boot_services() is
> called, but it needs a buffer of 18816 bytes to hold the efi memory map at
> that time.
>
> So allocating one additional page for the EFI memory map on top of what is
> currently allocated (which I believe is already one page more than is needed)
> would do the trick on my particular system (in its current configuration),
> but I'd still be worried that it might still break on other systems, since
> the EFI memory map buffer is still being allocated before it is used.
>
> I could submit a patch to do this (as well as to clean up find_efi_mmap_size
> a bit) if you prefer to keep the EFI memory map in real mode memory. If so,
> please let me know what version you want the patch for (HEAD?).
>
It looks like the problem is that we set video mode. Other than that we do only
mmap iterating and allocating the memory in question. How about this patch (not
tested):
=== modified file 'grub-core/loader/i386/linux.c'
--- grub-core/loader/i386/linux.c 2012-05-31 12:06:11 +0000
+++ grub-core/loader/i386/linux.c 2012-06-11 19:27:48 +0000
@@ -383,6 +383,103 @@
grub_size_t real_size, mmap_size;
grub_size_t cl_offset;
+ modevar = grub_env_get ("gfxpayload");
+
+ /* Now all graphical modes are acceptable.
+ May change in future if we have modes without framebuffer. */
+ if (modevar && *modevar != 0)
+ {
+ tmp = grub_xasprintf ("%s;" DEFAULT_VIDEO_MODE, modevar);
+ if (! tmp)
+ return grub_errno;
+#if ACCEPTS_PURE_TEXT
+ err = grub_video_set_mode (tmp, 0, 0);
+#else
+ err = grub_video_set_mode (tmp, GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
+#endif
+ grub_free (tmp);
+ }
+ else
+ {
+#if ACCEPTS_PURE_TEXT
+ err = grub_video_set_mode (DEFAULT_VIDEO_MODE, 0, 0);
+#else
+ err = grub_video_set_mode (DEFAULT_VIDEO_MODE,
+ GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
+#endif
+ }
+ if (err)
+ {
+ grub_print_error ();
+ grub_puts_ (N_("Booting in blind mode"));
+ grub_errno = GRUB_ERR_NONE;
+ }
+
+#ifdef GRUB_MACHINE_IEEE1275
+ {
+ const char *bootpath;
+ grub_ssize_t len;
+
+ bootpath = grub_env_get ("root");
+ if (bootpath)
+ grub_ieee1275_set_property (grub_ieee1275_chosen,
+ "bootpath", bootpath,
+ grub_strlen (bootpath) + 1,
+ &len);
+ }
+#endif
+
+ if (grub_linux_setup_video (&linux_params))
+ {
+#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) ||
defined (GRUB_MACHINE_QEMU)
+ linux_params.have_vga = GRUB_VIDEO_LINUX_TYPE_TEXT;
+ linux_params.video_mode = 0x3;
+#else
+ linux_params.have_vga = 0;
+ linux_params.video_mode = 0;
+ linux_params.video_width = 0;
+ linux_params.video_height = 0;
+#endif
+ }
+
+ /* Initialize these last, because terminal position could be affected by
printfs above. */
+#ifndef GRUB_MACHINE_IEEE1275
+ if (linux_params.have_vga == GRUB_VIDEO_LINUX_TYPE_TEXT)
+#endif
+ {
+ grub_term_output_t term;
+ int found = 0;
+ FOR_ACTIVE_TERM_OUTPUTS(term)
+ if (grub_strcmp (term->name, "vga_text") == 0
+ || grub_strcmp (term->name, "console") == 0
+ || grub_strcmp (term->name, "ofconsole") == 0)
+ {
+ grub_uint16_t pos = grub_term_getxy (term);
+ linux_params.video_cursor_x = pos >> 8;
+ linux_params.video_cursor_y = pos & 0xff;
+ linux_params.video_width = grub_term_width (term);
+ linux_params.video_height = grub_term_height (term);
+ found = 1;
+ break;
+ }
+ if (!found)
+ {
+ linux_params.video_cursor_x = 0;
+ linux_params.video_cursor_y = 0;
+ linux_params.video_width = 80;
+ linux_params.video_height = 25;
+ }
+ }
+
+#ifdef GRUB_MACHINE_IEEE1275
+ {
+ linux_params.ofw_signature = GRUB_LINUX_OFW_SIGNATURE;
+ linux_params.ofw_num_items = 1;
+ linux_params.ofw_cif_handler = (grub_uint32_t) grub_ieee1275_entry_fn;
+ linux_params.ofw_idt = 0;
+ }
+#endif
+
mmap_size = find_mmap_size ();
/* Make sure that each size is aligned to a page boundary. */
cl_offset = ALIGN_UP (mmap_size + sizeof (*params), 4096);
@@ -466,20 +563,6 @@
grub_memcpy ((char *) params + cl_offset, linux_cmdline,
maximal_cmdline_size);
-#ifdef GRUB_MACHINE_IEEE1275
- {
- const char *bootpath;
- grub_ssize_t len;
-
- bootpath = grub_env_get ("root");
- if (bootpath)
- grub_ieee1275_set_property (grub_ieee1275_chosen,
- "bootpath", bootpath,
- grub_strlen (bootpath) + 1,
- &len);
- }
-#endif
-
grub_dprintf ("linux", "code32_start = %x\n",
(unsigned) params->code32_start);
@@ -522,89 +605,6 @@
return grub_errno;
params->mmap_size = e820_num;
- modevar = grub_env_get ("gfxpayload");
-
- /* Now all graphical modes are acceptable.
- May change in future if we have modes without framebuffer. */
- if (modevar && *modevar != 0)
- {
- tmp = grub_xasprintf ("%s;" DEFAULT_VIDEO_MODE, modevar);
- if (! tmp)
- return grub_errno;
-#if ACCEPTS_PURE_TEXT
- err = grub_video_set_mode (tmp, 0, 0);
-#else
- err = grub_video_set_mode (tmp, GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
-#endif
- grub_free (tmp);
- }
- else
- {
-#if ACCEPTS_PURE_TEXT
- err = grub_video_set_mode (DEFAULT_VIDEO_MODE, 0, 0);
-#else
- err = grub_video_set_mode (DEFAULT_VIDEO_MODE,
- GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
-#endif
- }
- if (err)
- {
- grub_print_error ();
- grub_puts_ (N_("Booting in blind mode"));
- grub_errno = GRUB_ERR_NONE;
- }
-
- if (grub_linux_setup_video (params))
- {
-#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) ||
defined (GRUB_MACHINE_QEMU)
- params->have_vga = GRUB_VIDEO_LINUX_TYPE_TEXT;
- params->video_mode = 0x3;
-#else
- params->have_vga = 0;
- params->video_mode = 0;
- params->video_width = 0;
- params->video_height = 0;
-#endif
- }
-
- /* Initialize these last, because terminal position could be affected by
printfs above. */
-#ifndef GRUB_MACHINE_IEEE1275
- if (params->have_vga == GRUB_VIDEO_LINUX_TYPE_TEXT)
-#endif
- {
- grub_term_output_t term;
- int found = 0;
- FOR_ACTIVE_TERM_OUTPUTS(term)
- if (grub_strcmp (term->name, "vga_text") == 0
- || grub_strcmp (term->name, "console") == 0
- || grub_strcmp (term->name, "ofconsole") == 0)
- {
- grub_uint16_t pos = grub_term_getxy (term);
- params->video_cursor_x = pos >> 8;
- params->video_cursor_y = pos & 0xff;
- params->video_width = grub_term_width (term);
- params->video_height = grub_term_height (term);
- found = 1;
- break;
- }
- if (!found)
- {
- params->video_cursor_x = 0;
- params->video_cursor_y = 0;
- params->video_width = 80;
- params->video_height = 25;
- }
- }
-
-#ifdef GRUB_MACHINE_IEEE1275
- {
- params->ofw_signature = GRUB_LINUX_OFW_SIGNATURE;
- params->ofw_num_items = 1;
- params->ofw_cif_handler = (grub_uint32_t) grub_ieee1275_entry_fn;
- params->ofw_idt = 0;
- }
-#endif
-
#ifdef GRUB_MACHINE_EFI
{
grub_efi_uintn_t efi_desc_size;
> Thanks,
> Stuart
>
>
>
> _______________________________________________
> Bug-grub mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/bug-grub
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
signature.asc
Description: OpenPGP digital signature
- RE: [bug #36532] boot in EFI mode (x86_64) fails on some systems, Stuart_Hayes, 2012/06/07
- Re: [bug #36532] boot in EFI mode (x86_64) fails on some systems, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/06/07
- RE: [bug #36532] boot in EFI mode (x86_64) fails on some systems, Stuart_Hayes, 2012/06/11
- RE: [bug #36532] boot in EFI mode (x86_64) fails on some systems, Stuart_Hayes, 2012/06/12
- Re: [bug #36532] boot in EFI mode (x86_64) fails on some systems, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/06/12
- RE: [bug #36532] boot in EFI mode (x86_64) fails on some systems, Stuart_Hayes, 2012/06/12
- RE: [bug #36532] boot in EFI mode (x86_64) fails on some systems, Stuart_Hayes, 2012/06/27
- Re: [bug #36532] boot in EFI mode (x86_64) fails on some systems, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/06/27
- RE: [bug #36532] boot in EFI mode (x86_64) fails on some systems, Stuart_Hayes, 2012/06/27
- RE: [bug #36532] boot in EFI mode (x86_64) fails on some systems, Stuart_Hayes, 2012/06/28
- RE: [bug #36532] boot in EFI mode (x86_64) fails on some systems, Stuart_Hayes, 2012/06/29