Page 1 of 1

UEFI text output

Posted: Wed Nov 04, 2020 5:56 pm
by PeterX
Sorry for the naive question, but:

There is ConOut etc. in the UEFI system table. And you can envoke OutputString(). But I think I've read somewhere that UEFI hasn't a text video mode. This seems to be a contradiction.

Can you explain that?

Greetings
Peter

Re: UEFI text output

Posted: Wed Nov 04, 2020 6:14 pm
by Octocontrabass
It uses a bitmap font to draw the text.

Re: UEFI text output

Posted: Wed Nov 04, 2020 9:29 pm
by kzinti
You can use conout/conin until you call ExitBootServices(). After that, you are on your own.

I suppose the point is that you can use them to implement some simple menu to display options before booting your kernel.

Re: UEFI text output

Posted: Thu Nov 05, 2020 5:35 am
by bzt
PeterX wrote:Sorry for the naive question, but:

There is ConOut etc. in the UEFI system table. And you can envoke OutputString(). But I think I've read somewhere that UEFI hasn't a text video mode. This seems to be a contradiction.
Under UEFI the console is not a real device. It's a meta device.
PeterX wrote:Can you explain that?
When the low-level devices are initialized, they register hooks in the console. For example it is pretty common that video drivers register a ConOut handler that prints bitmap fonts, but serial port drivers also register a function that can interpret ANSI escape sequences. For TianoCore this is the default, on real machines you usually have an option in the boot menu to add more devices to the console. It is possible to set up UEFI in a way that ConOut->OutputString() only prints to the serial port, but not on screen.

Similarly ConIn is a meta device too, PS/2 (if exists), USB HID and serial port registers hooks in run-time during boot to actually implement that. If it's configured, then you can use CSI codes over serial instead of a keyboard.

Cheers,
bzt