Libpayload: Difference between revisions
Jump to navigation
Jump to search
(FILO uses libpayload) |
(added some functions found as implemented in Doxygen) |
||
Line 72: | Line 72: | ||
| style="background:lime" | yes | | style="background:lime" | yes | ||
| int isalpha(int character) | | int isalpha(int character) | ||
|- | |||
|- bgcolor="#dddddd" valign="top" | |||
| style="background:lime" | yes | |||
| int isascii(int character) | |||
|- | |||
|- bgcolor="#dddddd" valign="top" | |||
| style="background:lime" | yes | |||
| int isblanc(int character) | |||
|- | |- | ||
|- bgcolor="#eeeeee" valign="top" | |- bgcolor="#eeeeee" valign="top" | ||
Line 108: | Line 116: | ||
| style="background:lime" | yes | | style="background:lime" | yes | ||
| int isxdigit(int character) | | int isxdigit(int character) | ||
|- | |||
|- bgcolor="#eeeeee" valign="top" | |||
| style="background:lime" | yes | |||
| int tolower(int character) | |||
|- | |||
|- bgcolor="#eeeeee" valign="top" | |||
| style="background:lime" | yes | |||
| int toupper(int character) | |||
|- bgcolor="#6699ff" | |- bgcolor="#6699ff" | ||
Line 276: | Line 292: | ||
| style="background:lime" | yes | | style="background:lime" | yes | ||
| <code>int sprintf(char* s, const char* format, ...)</code> | | <code>int sprintf(char* s, const char* format, ...)</code> | ||
|- | |||
| style="background:lime" | yes | |||
| <code>int snprintf(char* s, size_t size, const char* format, ...)</code> | |||
|- | |- | ||
| style="background:red" | no | | style="background:red" | no | ||
Line 285: | Line 304: | ||
| style="background:lime" | yes | | 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> | ||
|- | |||
| style="background:lime" | yes | |||
| <code>int vsnprintf(char* s, size_t size, const char* format, va_list arg)</code> | |||
|- | |- | ||
| style="background:red" | no | | style="background:red" | no | ||
Line 403: | Line 425: | ||
| <code>long strtol(const char* s, char** endp, int base)</code> | | <code>long strtol(const char* s, char** endp, int base)</code> | ||
|- | |- | ||
| style="background: | | style="background:lime" | yes | ||
| <code>unsigned long strtoul(const char* s, char** endp, int base)</code> | | <code>unsigned long strtoul(const char* s, char** endp, int base)</code> | ||
|- | |- | ||
Line 417: | Line 439: | ||
| style="background:lime" | yes | | style="background:lime" | yes | ||
| <code>void free(void* p)</code> | | <code>void free(void* p)</code> | ||
|- | |||
| style="background:lime" | yes | |||
| <code>void * memalign (size_t align, size_t size)</code> | |||
|- | |- | ||
| style="background:lime" | yes | | style="background:lime" | yes | ||
Line 489: | Line 514: | ||
| style="background:lime" | yes | | style="background:lime" | yes | ||
| <code>size_t strlen(const char* cs)</code> | | <code>size_t strlen(const char* cs)</code> | ||
|- | |||
| style="background:lime" | yes | |||
| <code>size_t strnlen(const char* cs, size_t maxlen)</code> | |||
|- | |||
| style="background:lime" | yes | |||
| <code>char * strdup (const char *s)</code> | |||
|- | |- | ||
| style="background:red" | no | | style="background:red" | no | ||
Line 519: | Line 550: | ||
| style="background:red" | no | | style="background:red" | no | ||
| <code>clock_t clock(void)</code> | | <code>clock_t clock(void)</code> | ||
|- | |||
| style="background:lime" | yes | |||
| <code>int gettimeofday (struct timeval *tv, void *tz)</code> | |||
|- | |- | ||
| style="background:red" | no | | style="background:red" | no | ||
Line 543: | Line 577: | ||
| style="background:red" | no | | style="background:red" | no | ||
| <code>size_t strftime(char* s, size_t smax, const char* fmt,<br />const struct tm* tp)</code> | | <code>size_t strftime(char* s, size_t smax, const char* fmt,<br />const struct tm* tp)</code> | ||
|- bgcolor="#6699ff" | |||
| colspan=2 | '''unistd.h''' | |||
|- | |||
| style="background:lime" | yes | |||
| <code>int exec (long addr, int argc, char **argv)</code> | |||
|} | |} |
Revision as of 19:23, 22 April 2009
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.http://qa.coreboot.org/docs/libpayload/
Design
Payloads using libpayload
- FILO is a bootloader which loads boot images from a local filesystem, without help from legacy BIOS services.
- 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
Documentation
See the autogenerated documentation for libpayload here.
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: |