Libpayload: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
|||
Line 1: | Line 1: | ||
'''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. | '''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: | The benefits of linking a coreboot payload against libpayload are: | ||
Line 22: | Line 22: | ||
** Geode framebuffer | ** Geode framebuffer | ||
** USB stack | ** USB stack | ||
* Reads and parses the coreboot table. | * Reads and parses the coreboot table. | ||
== Design == | == Design == | ||
* [[Payload API|Discussion of the API for passing parameters to the payload]] | * [[Payload API|Discussion of the API for passing parameters to the payload]] | ||
Line 30: | Line 31: | ||
* [[FILO]] is a bootloader which loads boot images from a local filesystem, without help from legacy BIOS services. | * [[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 | * [[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). | * [[GRUB invaders]] has been ported successfully to libpayload (patch pending). | ||
* [[tint]] (a | * [[tint]] (a "falling blocks" game) has been successfully ported to libpayload. | ||
* [http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=tree;f=scripts/kconfig/lxdialog;hb=HEAD lxdialog] from the Linux '''kconfig''' utility has been ported to be usable when linked with libpayload (patch pending). | * [http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=tree;f=scripts/kconfig/lxdialog;hb=HEAD lxdialog] from the Linux '''kconfig''' utility has been ported to be usable when linked with libpayload (patch pending). | ||
== Downloading and building libpayload == | == Downloading and building libpayload == | ||
$ svn co svn://coreboot.org/coreboot/trunk/payloads/libpayload | $ '''svn co svn://coreboot.org/coreboot/trunk/payloads/libpayload''' | ||
$ cd libpayload | $ '''cd libpayload''' | ||
$ make menuconfig | $ '''make menuconfig''' | ||
$ make | $ '''make''' | ||
== Documentation == | == Documentation == | ||
Line 592: | Line 593: | ||
Here's an example of a very simple payload (hello.c) and how to build it: | Here's an example of a very simple payload (hello.c) and how to build it: | ||
< | <source lang="C"> | ||
#include <libpayload.h> | #include <libpayload.h> | ||
Line 601: | Line 602: | ||
return 0; | return 0; | ||
} | } | ||
</ | </source> | ||
Building the payload: | Building the payload: | ||
lpgcc -o hello.elf hello.c | $ '''lpgcc -o hello.elf hello.c''' | ||
{{PD-self}} | {{PD-self}} |
Revision as of 22:56, 19 September 2010
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
- USB stack
- Reads and parses the coreboot table.
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, 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).
Downloading and building libpayload
$ svn co svn://coreboot.org/coreboot/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:
<source lang="C">
- include <libpayload.h>
int main(void) {
printf("Hello, world!\n"); halt(); return 0;
} </source>
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: |