All of lore.kernel.org
 help / color / mirror / Atom feed
* grub_machine_fini on efi systems
@ 2009-02-16 22:53 phcoder
  2009-02-16 23:16 ` phcoder
  2009-02-17  2:56 ` Peter Cros
  0 siblings, 2 replies; 6+ messages in thread
From: phcoder @ 2009-02-16 22:53 UTC (permalink / raw)
  To: The development of GRUB 2

Hello. I found a serious problem which may be the cause of linux not 
booting on some efi systems. grub_machine_fini is called before 
grub_linux_boot. grub_machine_fini returns all memory allocated by grub2 
to efi. This includes all memory used to load modules. So actually efi 
can rightfully destroy linux module before it has slightest chance to do 
its job. I asked step21 to declare linux boot as returnable to stop 
grub_machine_fini. However it's nothing more then a workaround. I hope 
that someone will find a way to fix this nicely because for the moment I 
see none. (perhaps tomorrow I'll find sth)
Regards
Vladimir 'phcoder' Serbinenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: grub_machine_fini on efi systems
  2009-02-16 22:53 grub_machine_fini on efi systems phcoder
@ 2009-02-16 23:16 ` phcoder
  2009-02-17  2:56 ` Peter Cros
  1 sibling, 0 replies; 6+ messages in thread
From: phcoder @ 2009-02-16 23:16 UTC (permalink / raw)
  To: The development of GRUB 2

Remark 1: when loading OS grub has to call grub_efi_exit_boot_services 
which unloads efi nearly completely. On the other hand it shouldn't be 
called when returning with exit command. Perhaps we should split 
grub_machine_fini in two: one for preparing for OS and other for 
exiting. But then when one chainloads then grub_efi_exit_boot_services 
shouldn't be called. So I propose that loader function should cope with 
environment preparation. For cases when some preparation is needed 
independently of the type of loaded os (like setting 'map' hook) the 
best solution IMO would be preboot hooks.
Remark 2: it should be clearly stated somewhere what the boot function 
may and may not use (e.g. boot function isn't allowed to read from disk, 
boot function may use grub_printf but not and so on) so that boot 
function conflicts neither with grub_machine_fini nor with preboot hooks
Remark 3: in case of an error the non-returning boot function may 
return. I see 3 possible solution:
a) forbid such an action. Use grub_fatal if really necessary
b) loader should call a special function at point of noreturn
c) delete the separation between returnable and not returnable booters. 
  grub_machine_prepare_for_os and preboot_hooks in my proposition patch 
would then be extended with second function which is called upon the 
return to undo the action of the hook itself
Regards
Vladimir 'phcoder' Serbinenko
phcoder wrote:
> Hello. I found a serious problem which may be the cause of linux not 
> booting on some efi systems. grub_machine_fini is called before 
> grub_linux_boot. grub_machine_fini returns all memory allocated by grub2 
> to efi. This includes all memory used to load modules. So actually efi 
> can rightfully destroy linux module before it has slightest chance to do 
> its job. I asked step21 to declare linux boot as returnable to stop 
> grub_machine_fini. However it's nothing more then a workaround. I hope 
> that someone will find a way to fix this nicely because for the moment I 
> see none. (perhaps tomorrow I'll find sth)
> Regards
> Vladimir 'phcoder' Serbinenko




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: grub_machine_fini on efi systems
  2009-02-16 22:53 grub_machine_fini on efi systems phcoder
  2009-02-16 23:16 ` phcoder
@ 2009-02-17  2:56 ` Peter Cros
  2009-02-17  3:02   ` Bean
  1 sibling, 1 reply; 6+ messages in thread
From: Peter Cros @ 2009-02-17  2:56 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 1312 bytes --]

There is also a problem with Apple 64 bit grub.efi booting ubuntu 2.6.27
linux in which the kernel is booted and starting but all video is lost after
the boot command. I don't know if there may be a connection.

 A temporary fix is to change Video frame buufer settings in
/loader/i386/efi/linux.c:
grub_find_video_card and grub_linux_setup_video

Then proceeds to the next bug (libata hangup during initrd ).


On Tue, Feb 17, 2009 at 9:53 AM, phcoder <phcoder@gmail.com> wrote:

> Hello. I found a serious problem which may be the cause of linux not
> booting on some efi systems. grub_machine_fini is called before
> grub_linux_boot. grub_machine_fini returns all memory allocated by grub2 to
> efi. This includes all memory used to load modules. So actually efi can
> rightfully destroy linux module before it has slightest chance to do its
> job. I asked step21 to declare linux boot as returnable to stop
> grub_machine_fini. However it's nothing more then a workaround. I hope that
> someone will find a way to fix this nicely because for the moment I see
> none. (perhaps tomorrow I'll find sth)
> Regards
> Vladimir 'phcoder' Serbinenko
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Cros

[-- Attachment #2: Type: text/html, Size: 1834 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: grub_machine_fini on efi systems
  2009-02-17  2:56 ` Peter Cros
@ 2009-02-17  3:02   ` Bean
  2009-02-17  5:01     ` Peter Cros
  0 siblings, 1 reply; 6+ messages in thread
From: Bean @ 2009-02-17  3:02 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, Feb 17, 2009 at 10:56 AM, Peter Cros <pxwpxw8@gmail.com> wrote:
> There is also a problem with Apple 64 bit grub.efi booting ubuntu 2.6.27
> linux in which the kernel is booted and starting but all video is lost after
> the boot command. I don't know if there may be a connection.
>  A temporary fix is to change Video frame buufer settings in
> /loader/i386/efi/linux.c:
> grub_find_video_card and grub_linux_setup_video
> Then proceeds to the next bug (libata hangup during initrd ).

Hi,

What's your frame buffer address, does grub_find_video_card detect it wrong ?

-- 
Bean



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: grub_machine_fini on efi systems
  2009-02-17  3:02   ` Bean
@ 2009-02-17  5:01     ` Peter Cros
  2009-02-17 12:11       ` Peter Cros
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Cros @ 2009-02-17  5:01 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 1703 bytes --]

1. Initially - With 2GB RAM

Imac8,1 has 256MB VRAM Radeon HD2600 1920x1200
MBP4,1 has 512MB VRAM Nvidia 8600 1920x1200

Imac8,1 grub boot linux shows Video frame buffer at 90520000 and blank
screen.

MBP4,1  gives 90000000 and scrambled video.

2. By overriding video_base  to set it at 2GB

grub_linux_setup_video ()

video_base = 0;
  grub_pci_iterate (grub_find_video_card);
/* override */
video_base = 0x80000000;

Result  -
MBP gets readable text screens from kernel boot and init.
Imac gets scrambled video (better than nothing)

3. further fiddling with
grub_linux_setup_video()

params->lfb_line_len = 8192;
 changed fromm 8192 to = width*4 gets clear script for Imac, but MBP wants
8192.

4. The results with 4GB RAM will differ I expect, and later effects unknown
as the linux initialization is not completing (other issues with libata).


On Tue, Feb 17, 2009 at 2:02 PM, Bean <bean123ch@gmail.com> wrote:

> On Tue, Feb 17, 2009 at 10:56 AM, Peter Cros <pxwpxw8@gmail.com> wrote:
> > There is also a problem with Apple 64 bit grub.efi booting ubuntu 2.6.27
> > linux in which the kernel is booted and starting but all video is lost
> after
> > the boot command. I don't know if there may be a connection.
> >  A temporary fix is to change Video frame buufer settings in
> > /loader/i386/efi/linux.c:
> > grub_find_video_card and grub_linux_setup_video
> > Then proceeds to the next bug (libata hangup during initrd ).
>
> Hi,
>
> What's your frame buffer address, does grub_find_video_card detect it wrong
> ?
>
> --
> Bean
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Cros

[-- Attachment #2: Type: text/html, Size: 2718 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: grub_machine_fini on efi systems
  2009-02-17  5:01     ` Peter Cros
@ 2009-02-17 12:11       ` Peter Cros
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Cros @ 2009-02-17 12:11 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 2220 bytes --]

Update - with Imac8,1 booting linux now with 4GB RAM,
the linux load video settings shown for 4GB RAM (with blank boot linux video
screen) are now

Video mode 1920x1200 - 32@60
Video frame buffer: d0520000    ( was 0x90520000 for 2GB RAM )

The VFB value needs changing again, when I have the source update to enable
running with 4GB.

On Tue, Feb 17, 2009 at 4:01 PM, Peter Cros <pxwpxw8@gmail.com> wrote:

> 1. Initially - With 2GB RAM
>
> Imac8,1 has 256MB VRAM Radeon HD2600 1920x1200
> MBP4,1 has 512MB VRAM Nvidia 8600 1920x1200
>
> Imac8,1 grub boot linux shows Video frame buffer at 90520000 and blank
> screen.
>
> MBP4,1  gives 90000000 and scrambled video.
>
> 2. By overriding video_base  to set it at 2GB
>
> grub_linux_setup_video ()
>
> video_base = 0;
>   grub_pci_iterate (grub_find_video_card);
> /* override */
> video_base = 0x80000000;
>
> Result  -
> MBP gets readable text screens from kernel boot and init.
> Imac gets scrambled video (better than nothing)
>
> 3. further fiddling with
> grub_linux_setup_video()
>
> params->lfb_line_len = 8192;
>  changed fromm 8192 to = width*4 gets clear script for Imac, but MBP wants
> 8192.
>
> 4. The results with 4GB RAM will differ I expect, and later effects unknown
> as the linux initialization is not completing (other issues with libata).
>
>
> On Tue, Feb 17, 2009 at 2:02 PM, Bean <bean123ch@gmail.com> wrote:
>
>> On Tue, Feb 17, 2009 at 10:56 AM, Peter Cros <pxwpxw8@gmail.com> wrote:
>> > There is also a problem with Apple 64 bit grub.efi booting ubuntu 2.6.27
>> > linux in which the kernel is booted and starting but all video is lost
>> after
>> > the boot command. I don't know if there may be a connection.
>> >  A temporary fix is to change Video frame buufer settings in
>> > /loader/i386/efi/linux.c:
>> > grub_find_video_card and grub_linux_setup_video
>> > Then proceeds to the next bug (libata hangup during initrd ).
>>
>> Hi,
>>
>> What's your frame buffer address, does grub_find_video_card detect it
>> wrong ?
>>
>> --
>> Bean
>>
>>
>> _______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> http://lists.gnu.org/mailman/listinfo/grub-devel
>>
>
>
>
> --
> Cros
>



-- 
Cros (pxw)

[-- Attachment #2: Type: text/html, Size: 3601 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-02-17 12:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-16 22:53 grub_machine_fini on efi systems phcoder
2009-02-16 23:16 ` phcoder
2009-02-17  2:56 ` Peter Cros
2009-02-17  3:02   ` Bean
2009-02-17  5:01     ` Peter Cros
2009-02-17 12:11       ` Peter Cros

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.