Announcing POSIX-UEFI
Posted: Sun Jan 31, 2021 7:48 pm
Hi All,
I don't know about you, but I personally hate GUIDs and find UEFI API ugly as hell. So I've wrapped all that up in a nice and friendly POSIX layer. It is called
POSIX-UEFI.
It's is extremely lightweight (about 12 files, 150K source, and 32K compiled), works on POSIX systems like Linux and provides POSIX interface for your UEFI application. It also sets up the build environment for you, by detecting your compiler (works with both GNU gcc and LLVM CLang), if it need cross-compiler or can use the host's, what flags to use, etc.
A traditional Hello World example with this library:And the Makefile:
Compilation:
That's it, everything is taken care for you, and you'll get helloworld.efi in no time!
Support is not fully POSIX compatible, the goal was not to create a libc, but to hide UEFI functions behind and interface that looks and works like POSIX. Despite of that and it's small size, there are quite a lot of convenience functions: wide-char to UTF-8 and vice versa converters, locatime() to get the current time, fopen, fread, fwrite, fprintf etc. The standard getchar() returns UNICODE codepoints in wchar_t too. Take a look at the documentation.
Known limitations: the build environment can handle any architecture, the lib is multi-platform too, but there's only x86_64 crt for now.
As usual, MIT licensed, Free and Open Source Software, without any guarantee and the hope that it will be useful. If you find any issues with it, please use the Gitlab's issue tracker.
Cheers,
bzt
I don't know about you, but I personally hate GUIDs and find UEFI API ugly as hell. So I've wrapped all that up in a nice and friendly POSIX layer. It is called
POSIX-UEFI.
It's is extremely lightweight (about 12 files, 150K source, and 32K compiled), works on POSIX systems like Linux and provides POSIX interface for your UEFI application. It also sets up the build environment for you, by detecting your compiler (works with both GNU gcc and LLVM CLang), if it need cross-compiler or can use the host's, what flags to use, etc.
A traditional Hello World example with this library:
Code: Select all
#include <uefi.h>
int main (int argc, wchar_t **argv)
{
printf(L"Hello, world!\n");
return 0;
}
Code: Select all
TARGET = helloworld.efi
include uefi/Makefile
Code: Select all
$ make
Support is not fully POSIX compatible, the goal was not to create a libc, but to hide UEFI functions behind and interface that looks and works like POSIX. Despite of that and it's small size, there are quite a lot of convenience functions: wide-char to UTF-8 and vice versa converters, locatime() to get the current time, fopen, fread, fwrite, fprintf etc. The standard getchar() returns UNICODE codepoints in wchar_t too. Take a look at the documentation.
Known limitations: the build environment can handle any architecture, the lib is multi-platform too, but there's only x86_64 crt for now.
As usual, MIT licensed, Free and Open Source Software, without any guarantee and the hope that it will be useful. If you find any issues with it, please use the Gitlab's issue tracker.
Cheers,
bzt