Difference between revisions of "Libpayload"
m |
m (Fixed downloading from Subversion to Git) |
||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 38: | Line 38: | ||
== Downloading and building libpayload == | == Downloading and building libpayload == | ||
| − | $ ''' | + | It is now in main coreboot git tree (see [[Download_coreboot]] for additional reference) |
| − | $ '''cd libpayload''' | + | |
| + | $ '''git clone http://review.coreboot.org/p/coreboot''' | ||
| + | $ '''cd payloads/libpayload''' | ||
$ '''make menuconfig''' | $ '''make menuconfig''' | ||
| − | $ '''make''' | + | $ '''make install''' |
| + | |||
| + | Here [http://review.coreboot.org/#/q/status:open+project:coreboot+message:libpayload,n,z gerrit] you can find pending patches for libpayload | ||
== Documentation == | == Documentation == | ||
| Line 61: | Line 65: | ||
|- | |- | ||
|- bgcolor="#eeeeee" valign="top" | |- bgcolor="#eeeeee" valign="top" | ||
| − | | style="background: | + | | style="background:lime" | no |
| assert() | | assert() | ||
| Line 130: | Line 134: | ||
| colspan=2 | '''errno.h''' | | colspan=2 | '''errno.h''' | ||
|- | |- | ||
| − | | style="background: | + | | style="background:lime" | no |
| <code>errno</code> (global) | | <code>errno</code> (global) | ||
| Line 424: | Line 428: | ||
| <code>double strtod(const char* s, char** endp)</code> | | <code>double strtod(const char* s, char** endp)</code> | ||
|- | |- | ||
| − | | style="background: | + | | style="background:lime" | no |
| <code>long strtol(const char* s, char** endp, int base)</code> | | <code>long strtol(const char* s, char** endp, int base)</code> | ||
|- | |- | ||
| Line 448: | Line 452: | ||
| <code>void abort()</code> | | <code>void abort()</code> | ||
|- | |- | ||
| − | | style="background: | + | | style="background:lime" | no |
| <code>void exit(int status)</code> | | <code>void exit(int status)</code> | ||
|- | |- | ||
| Line 481: | Line 485: | ||
| <code>char* strncpy(char* s, const char* ct, size_t n)</code> | | <code>char* strncpy(char* s, const char* ct, size_t n)</code> | ||
|- | |- | ||
| − | | style="background: | + | | style="background:lime" | no |
| <code>char* strcat(char* s, const char* ct)</code> | | <code>char* strcat(char* s, const char* ct)</code> | ||
|- | |- | ||
| Line 499: | Line 503: | ||
| <code>char* strchr(const char* cs, int c)</code> | | <code>char* strchr(const char* cs, int c)</code> | ||
|- | |- | ||
| − | | style="background: | + | | style="background:lime" | no |
| <code>char* strrchr(const char* cs, int c)</code> | | <code>char* strrchr(const char* cs, int c)</code> | ||
|- | |- | ||
| − | | style="background: | + | | style="background:lime" | no |
| <code>size_t strspn(const char* cs, const char* ct)</code> | | <code>size_t strspn(const char* cs, const char* ct)</code> | ||
|- | |- | ||
| − | | style="background: | + | | style="background:lime" | no |
| <code>size_t strcspn(const char* cs, const char* ct)</code> | | <code>size_t strcspn(const char* cs, const char* ct)</code> | ||
|- | |- | ||
| Line 526: | Line 530: | ||
| <code>char* strerror(int n)</code> | | <code>char* strerror(int n)</code> | ||
|- | |- | ||
| − | | style="background: | + | | style="background:lime" | no |
| <code>char* strtok(char* s, const char* t)</code> | | <code>char* strtok(char* s, const char* t)</code> | ||
| + | |- | ||
| + | | style="background:lime" | no | ||
| + | | <code>char* strtok_r(char* s, const char* t, char **p)</code> | ||
|- | |- | ||
| style="background:red" | no | | style="background:red" | no | ||
Latest revision as of 10:23, 1 June 2012
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.
Contents |
[edit] 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
- USB stack
- Reads and parses the coreboot table.
[edit] Design
[edit] 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, or an NVRAM dump.
- GRUB invaders has been ported successfully to libpayload (patch pending).
- tint (a "falling blocks" game) has been successfully ported to libpayload.
- lxdialog from the Linux kconfig utility has been ported to be usable when linked with libpayload (patch pending).
[edit] Downloading and building libpayload
It is now in main coreboot git tree (see Download_coreboot for additional reference)
$ git clone http://review.coreboot.org/p/coreboot $ cd payloads/libpayload $ make menuconfig $ make install
Here gerrit you can find pending patches for libpayload
[edit] Documentation
See the autogenerated documentation for libpayload here.
[edit] Libc coverage
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[edit] 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: |