bug-grub
[Top][All Lists]
Advanced

[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: Fri, 15 Jun 2012 23:21:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120510 Icedove/10.0.4

On 11.06.2012 22:10, address@hidden wrote:

>>
>> 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;
>>
>>
> 
> Grub crashed with a GPF (13) when I tried to boot with that patch.
> 

There was a bug in that patch. Try this one please.

> 
> _______________________________________________
> Bug-grub mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/bug-grub
> 



-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko

Attachment: efi.diff
Description: Text Data

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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