Libpayload: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(→Libc coverage: libc coverage update.) |
||
Line 58: | Line 58: | ||
|- | |- | ||
|- bgcolor="#eeeeee" valign="top" | |- bgcolor="#eeeeee" valign="top" | ||
| style="background: | | style="background:lime" | yes | ||
| int isalnum(int character) | | int isalnum(int character) | ||
|- | |- | ||
|- bgcolor="#dddddd" valign="top" | |- bgcolor="#dddddd" valign="top" | ||
| style="background: | | style="background:lime" | yes | ||
| int isalpha(int character) | | int isalpha(int character) | ||
|- | |- | ||
|- bgcolor="#eeeeee" valign="top" | |- bgcolor="#eeeeee" valign="top" | ||
| style="background: | | style="background:lime" | yes | ||
| int iscntrl(int character) | | int iscntrl(int character) | ||
|- | |- | ||
Line 74: | Line 74: | ||
|- | |- | ||
|- bgcolor="#eeeeee" valign="top" | |- bgcolor="#eeeeee" valign="top" | ||
| style="background: | | style="background:lime" | yes | ||
| int isgraph(int character) | | int isgraph(int character) | ||
|- | |- | ||
|- bgcolor="#dddddd" valign="top" | |- bgcolor="#dddddd" valign="top" | ||
| style="background: | | style="background:lime" | yes | ||
| int islower(int character) | | int islower(int character) | ||
|- | |- | ||
|- bgcolor="#eeeeee" valign="top" | |- bgcolor="#eeeeee" valign="top" | ||
| style="background: | | style="background:lime" | yes | ||
| int isprint(int character) | | int isprint(int character) | ||
|- | |- | ||
|- bgcolor="#dddddd" valign="top" | |- bgcolor="#dddddd" valign="top" | ||
| style="background: | | style="background:lime" | yes | ||
| int ispunct(int character) | | int ispunct(int character) | ||
|- | |- | ||
Line 94: | Line 94: | ||
|- | |- | ||
|- bgcolor="#dddddd" valign="top" | |- bgcolor="#dddddd" valign="top" | ||
| style="background: | | style="background:lime" | yes | ||
| int isupper(int character) | | int isupper(int character) | ||
|- | |- | ||
|- bgcolor="#eeeeee" valign="top" | |- bgcolor="#eeeeee" valign="top" | ||
| style="background: | | style="background:lime" | yes | ||
| int isxdigit(int character) | | int isxdigit(int character) | ||
Line 263: | Line 263: | ||
| <code>int fprintf(FILE* stream, const char* format, ...)</code> | | <code>int fprintf(FILE* stream, const char* format, ...)</code> | ||
|- | |- | ||
| style="background: | | style="background:lime" | yes | ||
| <code>int printf(const char* format, ...)</code> | | <code>int printf(const char* format, ...)</code> | ||
|- | |- | ||
| style="background: | | style="background:lime" | yes | ||
| <code>int sprintf(char* s, const char* format, ...)</code> | | <code>int sprintf(char* s, const char* format, ...)</code> | ||
|- | |- | ||
Line 272: | Line 272: | ||
| <code>int vfprintf(FILE* stream, const char* format, va_list arg)</code> | | <code>int vfprintf(FILE* stream, const char* format, va_list arg)</code> | ||
|- | |- | ||
| style="background: | | style="background:lime" | yes | ||
| <code>int vprintf(const char* format, va_list arg)</code> | | <code>int vprintf(const char* format, va_list arg)</code> | ||
|- | |- | ||
| style="background: | | style="background:lime" | yes | ||
| <code>int vsprintf(char* s, const char* format, va_list arg)</code> | | <code>int vsprintf(char* s, const char* format, va_list arg)</code> | ||
|- | |- | ||
Line 365: | Line 365: | ||
| colspan=2 | '''stdlib.h''' | | colspan=2 | '''stdlib.h''' | ||
|- | |- | ||
| style="background: | | style="background:lime" | yes | ||
| <code>int abs(int n)</code> | | <code>int abs(int n)</code> | ||
|- | |- | ||
| style="background: | | style="background:lime" | yes | ||
| <code>long labs(long n)</code> | | <code>long labs(long n)</code> | ||
|- | |||
| style="background:lime" | yes | |||
| <code>long long llabs(long long n)</code> | |||
|- | |- | ||
| style="background:red" | no | | style="background:red" | no | ||
Line 407: | Line 410: | ||
| <code>void free(void* p)</code> | | <code>void free(void* p)</code> | ||
|- | |- | ||
| style="background:lime" | yes | | style="background:lime" | yes</code> | ||
| <code>void abort()</code> | | <code>void abort()</code> | ||
|- | |- | ||
Line 428: | Line 431: | ||
| <code>void qsort(void* base, size_t n, size_t size, <br />int (*cmp)(const void*, const void*))</code> | | <code>void qsort(void* base, size_t n, size_t size, <br />int (*cmp)(const void*, const void*))</code> | ||
|- | |- | ||
| style="background: | | style="background:lime" | yes | ||
| <code>int rand(void)</code> | | <code>int rand(void)</code> | ||
|- | |- | ||
| style="background: | | style="background:lime" | yes | ||
| <code>void srand(unsigned int seed)</code> | | <code>void srand(unsigned int seed)</code> | ||
Revision as of 20:30, 11 April 2008
libpayload is a small BSD-licensed static library (a lightweight implementation of common and useful functions) intended to be used as a basis for coreboot payloads.
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.
Just give us a main() and a pocket full of dreams and we'll do the rest.
Features
- Provides a subset of libc functions (e.g. malloc, printf, strcmp, etc).
- Provides an optional tiny (n)curses implementation.
- Provides various small drivers for
- keyboard
- PC speaker
- NVRAM/CMOS access
- serial console
- VGA
- Geode framebuffer
- Reads and parses the coreboot table.
Payloads using libpayload
- coreinfo is a small payload which can display system information such as PCI info, an NVRAM dump, or the coreboot v3 printk buffer.
- GRUB invaders has been ported successfully to libpayload (patch pending).
- tint (a console tetris clone) has been successfully ported to libpayload.
- lxdialog from the Linux kconfig utility has been ported to be usable when linked with libpayload (patch pending).
Downloading and building libpayload
$ svn co svn://coreboot.org/repos/trunk/payloads/libpayload $ cd libpayload $ make menuconfig $ make
Libc coverage
|
|
Usage example
Here's an example of a very simple payload (hello.c) and how to build it:
#include <libpayload.h> int main(void) { printf("Hello, world!\n"); halt(); return 0; }
Building the payload:
lpgcc -o hello.elf hello.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: |