Difference between revisions of "Libpayload"
From coreboot
Whiterocker (Talk | contribs) m (add place-holder for libpayload software licence info, add PD dedication for article) |
(Updates, fixes.) |
||
| Line 1: | Line 1: | ||
| + | '''libpayload''' is a small BSD-licensed "library" (a lightweight implementation of common and useful functions) intended to be used as a basis for coreboot payloads. | ||
| + | |||
== Overview == | == Overview == | ||
| − | + | The benefits of linking a coreboot payload against libpayload are: | |
| − | * | + | |
| − | * | + | * Payloads do not have to implement and maintain low-level code for I/O, common functions, etc. |
| − | * libpayload functions tested and scrutinized outside payload development | + | * Payloads can be recompiled and deployed for CPU architectures supported by coreboot in the future. |
| − | * | + | * The libpayload functions can be tested and scrutinized outside payload development. |
| − | * | + | * Payloads themselves may be partly host-tested, e.g. against an emulation libpayload. |
| + | * Leads to the possibility of payloads using dynamic linking, reducing total payload footprint. | ||
| − | '' | + | ''Just give us a main() and a pocket full of dreams and we'll do the rest.'' |
== Feature Wish List == | == Feature Wish List == | ||
| Line 170: | Line 173: | ||
| Full Support | | Full Support | ||
|} | |} | ||
| − | |||
== Usage Example == | == Usage Example == | ||
hello_payload.c: | hello_payload.c: | ||
| + | |||
<pre> | <pre> | ||
#include <stdio.h> | #include <stdio.h> | ||
| − | int main( void ) | + | int main(void) |
{ | { | ||
| − | printf( "Hello, world!\n" ); | + | printf("Hello, world!\n"); |
return 0; | return 0; | ||
} | } | ||
</pre> | </pre> | ||
| − | + | Build: | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | gcc -o hello_payload hello_payload.c | |
| − | |||
{{PD-self}} | {{PD-self}} | ||
Revision as of 19:36, 7 March 2008
libpayload is a small BSD-licensed "library" (a lightweight implementation of common and useful functions) intended to be used as a basis for coreboot payloads.
Contents |
Overview
The benefits of linking a coreboot payload against libpayload are:
- Payloads do not have to implement and maintain low-level code for I/O, common functions, etc.
- Payloads can be recompiled and deployed for CPU architectures supported by coreboot in the future.
- The libpayload functions can be tested and scrutinized outside payload development.
- Payloads themselves may be partly host-tested, e.g. against an emulation libpayload.
- Leads to the possibility of payloads using dynamic linking, reducing total payload footprint.
Just give us a main() and a pocket full of dreams and we'll do the rest.
Feature Wish List
- Basics
- coreboot services and structures (e.g. read CMOS, device tree)
- subset of C-library functions (e.g. printf, puts, getch)
- light ncurses from the Google Summer Of Code project
- Fancies
- directFB
- TWIN
Libc Coverage
| Function/Macro/Variable | Status |
|---|---|
| assert.h | |
assert( ) (macro)
|
no |
| ctype.h | |
int isalnum(int character)
|
no |
int isalpha(int character)
|
no |
int iscntrl(int character)
|
no |
int isdigit(int character)
|
no |
int isgraph(int character)
|
no |
int islower(int character)
|
no |
int isprint(int character)
|
no |
int ispunct(int character)
|
no |
int isspace(int character)
|
no |
int isupper(int character)
|
no |
int isxdigit(int character)
|
no |
| errno.h | |
errno (global)
|
no |
| float.h | |
| limits.h | |
| locale.h | |
char *setlocale(int category, const char *locale)
|
no |
struct lconv *localeconv(void)
|
no |
| math.h | |
| TODO | |
| setjmp.h | |
| TODO | |
| signal.h | |
| TODO | |
| stdarg.h | |
| TODO | |
| stddef.h | |
| TODO | |
| stdio.h | |
| TODO | |
| stdlib.h | |
| TODO | |
| string.h | |
| TODO | |
| time.h | |
| TODO | |
| No Support |
| Partial Support |
| Full Support |
Usage Example
hello_payload.c:
#include <stdio.h>
int main(void)
{
printf("Hello, world!\n");
return 0;
}
Build:
gcc -o hello_payload hello_payload.c
| |
I, the copyright holder of this work, hereby release it into the public domain. This applies worldwide.
In case this is not legally possible: |