Skip to contentSkip to conversation

EFI Boot Stub Early Console

DISCUSSION Shea Levy 5 participants 16 messages Mar 12, 2012 – Mar 20, 2012 1 message not in the archive

lore
Share & tools
lore

Shea Levy

author
#0 lore raw

Hello,

How do I get the early boot console to show up on my screen when booting with the EFI boot stub? I can see it through the serial port if I set console=tty0, and I see the second half of the boot sequence after my initrd loads fbcon, but the screen remains unchanging until then. I'm using 3.3-rc7 on Virtualbox's EFI implementation.

Thanks,
Shea

author
#1 lore raw
Quoted 1 line · Shea Levy

console=tty0

Sorry, that should have been console=ttyS0

#2 lore raw
Quoted 4 lines · Shea Levy
Quoted 1 line · Shea Levy

console=tty0

Sorry, that should have been console=ttyS0

Have you tried earlyprintk=serial,ttyS0?

-hpa

author
#3 lore raw
Quoted 8 lines · H. Peter Anvin
Quoted 3 lines · Shea Levy
Quoted 1 line · Shea Levy

console=tty0

Sorry, that should have been console=ttyS0

Have you tried earlyprintk=serial,ttyS0?

-hpa

Just tried. Still nothing in the VirtualBox window, serial port showed boot output up until "[ 0.000000] console [tty0] enabled, bootconsole disabled", when the rest of the boot process happened in VirtualBox.

~Shea

#4 lore raw
Quoted 5 lines · Shea Levy
Quoted 4 lines · H. Peter Anvin
Quoted 3 lines · Shea Levy
Quoted 1 line · Shea Levy

console=tty0

Sorry, that should have been console=ttyS0

Quoted 9 lines
Quoted 4 lines

Have you tried earlyprintk=serial,ttyS0?

-hpa

Just tried. Still nothing in the VirtualBox window, serial port showed
boot output up until "[ 0.000000] console [tty0] enabled, bootconsole
disabled", when the rest of the boot process happened in VirtualBox.

That sounds like one would expect, no?

I don't think anyone has implemented an EFI earlyconsole yet, and you can't rely on EFI handing over the screen in a mode the kernel can handle with earlyconsole=vga, so there aren't really any other alternatives.

-hpa

author
#5 lore raw
Quoted 3 lines · H. Peter Anvin

I don't think anyone has implemented an EFI earlyconsole yet, and you can't rely on EFI handing over the screen in a mode the kernel can handle with earlyconsole=vga, so there aren't really any other alternatives.

Ah, ok, so what I'm looking for doesn't exist (yet?). Thanks.

~Shea

author
#6 lore raw
In reply to H. Peter Anvin
Quoted 1 line · H. Peter Anvin

I don't think anyone has implemented an EFI earlyconsole yet

I'm considering taking a shot at this. Do you have any pointers about where to look or how to approach it? Will I have to use UGA/GOP or is there some way to take advantage of the text console after exit_boot_services?

Cheers,
Shea

#7 lore raw
In reply to Shea Levy
Quoted 7 lines · Shea Levy
Quoted 1 line · H. Peter Anvin

I don't think anyone has implemented an EFI earlyconsole yet

I'm considering taking a shot at this. Do you have any pointers about where to look or how to approach it? Will I have to use UGA/GOP or is there some way to take advantage of the text console after exit_boot_services?

I don't think you'll need to use the graphics protocols, you should just be able to put something together using the 'output_string' function from the EFI simple text output protocol, e.g. something like this,

	https://lkml.org/lkml/2012/3/16/193
author
#8 lore raw

Hi Matt,

Quoted 1 line · Matt Fleming

I don't think you'll need to use the graphics protocols, you should just be able to put something together using the 'output_string' function from the EFI simple text output protocol, e.g. something like this, https://lkml.org/lkml/2012/3/16/193

From the UEFI 2.3.1 spec:

Quoted 1 line

Prior to a call to ExitBootServices(), all of the fields of the EFI System Table are valid. After an operating system has taken control of the platform with a call to ExitBootServices(), only the Hdr, FirmwareVendor, FirmwareRevision, RuntimeServices, NumberOfTableEntries, and ConfigurationTable fields are valid.

Doesn't this mean that ConOut can't be used for the earlyprintk, since any bootloader (including the bootstub) will call ExitBootServices() before any printk'ing actually happens?? Or am I misunderstanding the spec somehow? I suppose I could just try it and see what happens...

Cheers,
Shea

#9 lore raw
Quoted 16 lines · Shea Levy

Hi Matt,

Quoted 4 lines · Matt Fleming

I don't think you'll need to use the graphics protocols, you should just be able to put something together using the 'output_string' function from the EFI simple text output protocol, e.g. something like this, https://lkml.org/lkml/2012/3/16/193

From the UEFI 2.3.1 spec:

Quoted 5 lines

Prior to a call to ExitBootServices(), all of the fields of the EFI System Table are valid. After an operating system has taken control of the platform with a call to ExitBootServices(), only the Hdr, FirmwareVendor, FirmwareRevision, RuntimeServices, NumberOfTableEntries, and ConfigurationTable fields are valid.

Quoted 4 lines

Doesn't this mean that ConOut can't be used for the earlyprintk, since any bootloader (including the bootstub) will call ExitBootServices() before any printk'ing actually happens?? Or am I misunderstanding the spec somehow? I suppose I could just try it and see what happens...

Oops. Good point, that isn't going to work.

#10 lore raw
Quoted 5 lines
Quoted 3 lines

any bootloader (including the bootstub) will call ExitBootServices() before any printk'ing actually happens?? Or am I misunderstanding the spec somehow? I suppose I could just try it and see what happens...

Oops. Good point, that isn't going to work.

Surely it works fine if you are using bootstub directly from EFI ?

author
#11 lore raw
Quoted 5 lines · Alan Cox
Quoted 4 lines
Quoted 3 lines

any bootloader (including the bootstub) will call ExitBootServices() before any printk'ing actually happens?? Or am I misunderstanding the spec somehow? I suppose I could just try it and see what happens...

Oops. Good point, that isn't going to work.

Surely it works fine if you are using bootstub directly from EFI ?

ConOut will work before the call to ExitBootServices(), but any bootloader (including the boot stub) calls that before starting the normal kernel boot process. I'm working on a generic earlyprintk that provides the same functionality as the existing earlyprintks that will work for any EFI boot. Matt already submitted a patch for an efi_printk that will be sufficient for the boot stub itself before the call to ExitBootServices().

~Shea

#12 lore raw
In reply to Alan Cox
Quoted 7 lines · Alan Cox
Quoted 5 lines
Quoted 3 lines

any bootloader (including the bootstub) will call ExitBootServices() before any printk'ing actually happens?? Or am I misunderstanding the spec somehow? I suppose I could just try it and see what happens...

Oops. Good point, that isn't going to work.

Surely it works fine if you are using bootstub directly from EFI ?

Yeah, up until the point you call ExitBootServices(), which is very early in the boot process. After that you can't rely on the validity of the console pointers in the system table.

#13 lore raw

Hey Matt,

Op 19-03-12 17:03, Matt Fleming schreef:

Quoted 10 lines · Alan Cox
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines

any bootloader (including the bootstub) will call ExitBootServices() before any printk'ing actually happens?? Or am I misunderstanding the spec somehow? I suppose I could just try it and see what happens...

Oops. Good point, that isn't going to work.

Surely it works fine if you are using bootstub directly from EFI ?

Yeah, up until the point you call ExitBootServices(), which is very early in the boot process. After that you can't rely on the validity of the console pointers in the system table.

I think my system spontaneously rebooted when I tried to
do some output right after ExitBootServices when debugging the efi stub, so not only is this unreliable, it will fail to boot for at least some systems out there.

~Maarten

#14 lore raw
Quoted 9 lines · Maarten Lankhorst

Hey Matt,

Op 19-03-12 17:03, Matt Fleming schreef:

Quoted 6 lines · Alan Cox
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines

any bootloader (including the bootstub) will call ExitBootServices() before any printk'ing actually happens?? Or am I misunderstanding the spec somehow? I suppose I could just try it and see what happens...

Oops. Good point, that isn't going to work.

Surely it works fine if you are using bootstub directly from EFI ?

Quoted 9 lines
Quoted 4 lines

Yeah, up until the point you call ExitBootServices(), which is very early in the boot process. After that you can't rely on the validity of the console pointers in the system table.

I think my system spontaneously rebooted when I tried to
do some output right after ExitBootServices when debugging the efi stub, so not only is this unreliable, it will fail to boot for at least some systems out there.

I would expect it to fail for just about any system.

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.