POSIX-UEFI: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
m added examples
mNo edit summary
Line 32:
 
Don't care. POSIX-UEFI has your back covered and chooses the correct script for you.
 
 
=== Code Examples ===
 
The repository contains [https://gitlab.com/bztsrc/posix-uefi/-/tree/master/examples examples] for all the functions that a boot loader might need:
* The source for the Hello World example we are talking about
* Querying and displaying command line arguments
* Listing directories and loading files (lot simpler to use "fopen" than [[Loading_files_under_UEFI|using UEFI to load files]])
* Reading and writing sectors (again, lot simpler than [[Reading_sectors_under_UEFI|using UEFI to read sectors]])
* Using the serial port with fprintf to print debug messages
* Detecting and listing [[Detecting_Memory_(x86)|memory map]]
* Querying and setting video modes with [[GOP]]
* Printing UTF-8 strings with bitmap fonts, similar to [[VGA Fonts]] but proportional
* Printing UTF-8 strings with vector based fonts using [[Scalable Screen Font]] library
* Loading and blitting PNG images to the screen (without libpng using GOP->Blt)
* Loading and parsing [[ELF]] files
* Exit Boot Services and pass parameters to an ELF "kernel"
You can use these examples as a base for your [[Rolling_Your_Own_Bootloader|bootloader]]. If this isn't enough, then I'd suggest to take a look at the [[BOOTBOOT]] loader.
 
== Creating an EFI executable ==
Line 74 ⟶ 92:
</source>
On the other hand, POSIX-UEFI provides standard libc API (hence its name). For example, opening a file goes just like under Linux, you can use fopen. Printing with printf, fprintf; using streams like stdin, stdout, stderr; allocating using malloc / free works the same way as expected on a POSIX compliant system.
 
== Code Examples ==
 
The repository contains [https://gitlab.com/bztsrc/posix-uefi/-/tree/master/examples examples] for all the functions that a boot loader might need:
* The Hello World from above
* Querying and displaying command line arguments
* Listing directories and loading files (lot simpler to use "fopen" than [[Loading_files_under_UEFI|using UEFI to load files]])
* Reading and writing sectors (again, lot simpler than [[Reading_sectors_under_UEFI|using UEFI to read sectors]])
* Using the serial port with fprintf to print debug messages
* Querying and setting video modes with [[GOP]]
* Printing UTF-8 strings with bitmap fonts, similar to [[VGA Fonts]] but proportional
* Printing UTF-8 strings with vector based fonts using [[Scalable Screen Font]] library
* Loading and blitting PNG images to the screen (without libpng using GOP->Blt)
* Loading and parsing [[ELF]] files
* Exit Boot Services and pass parameters to an ELF "kernel"
You can use these examples as a base for your [[Rolling_Your_Own_Bootloader|bootloader]]. If this isn't enough, then I'd suggest to take a look at the [[BOOTBOOT]] loader.
 
== See also ==