The wiki is being retired!
Documentation is now handled by the same processes we use for code: Add something to the Documentation/ directory in the coreboot repo, and it will be rendered to https://doc.coreboot.org/. Contributions welcome!
SeaBIOS is an open-source legacy BIOS implementation which can be used as a coreboot payload. It implements the standard BIOS calling interfaces that a typical x86 proprietary BIOS implements.
This page describes using SeaBIOS with coreboot. SeaBIOS can also run natively in qemu and bochs - see the SeaBIOS README file for information on non-coreboot uses.
Any software requiring 16-bit BIOS services benefits from SeaBIOS (eg, Windows and DOS). SeaBIOS also enables booting Linux out of the box (using standard boot-loaders like GRUB and Syslinux).
SeaBIOS supports booting from ATA hard drives, ATAPI cdroms, USB hard drives, USB cdroms, payloads in flash, and from Option ROMs (eg, SCSI or network cards). SeaBIOS can initialize and use a ps2 keyboard or USB keyboard.
SeaBIOS has been tested with Windows XP, Windows Vista (64/32 bit), and Windows 7 Beta (64 bit).
However, Windows has a very strict ACPI interpreter, and many coreboot boards do not have a complete ACPI definition. As a result, many coreboot boards will fail during Windows boot (eg, it may fail with a STOP 0xA5 code).
SeaBIOS has been tested with GRUB, LILO, and Syslinux. Linux booting works well.
SeaBIOS has also been tested with FreeDOS and NetBSD.
Because SeaBIOS implements the standard x86 BIOS interfaces, it is expected many other operating systems and boot-loaders will work.
One can download the latest version of SeaBIOS through a git repository:
$ git clone git://git.linuxtogo.org/home/kevin/seabios.git seabios $ cd seabios
There's also a gitweb facility to browse the latest source code online.
Edit src/config.h and set the following values:
#define CONFIG_COREBOOT 1 #define CONFIG_DEBUG_SERIAL 1 #define CONFIG_VGAHOOKS 1
The final SeaBIOS payload file is out/bios.bin.elf, which can be used with coreboot v2 or v3.
Compiled SeaBIOS images
It is also possible to download a compiled SeaBIOS image. The latest released version compiled for coreboot is: http://linuxtogo.org/~kevin/SeaBIOS/bios.bin.elf-0.6.0
Other versions are also available at: http://linuxtogo.org/~kevin/SeaBIOS/
For best results, use coreboot-v2 and edit the targets/..../Config.lb with the following:
option CONFIG_CBFS = 1 option HAVE_HIGH_TABLES = 1 ... romimage "fallback" ... payload /path/to/seabios/out/bios.bin.elf end
Unfortunately, many boards don't have HAVE_HIGH_TABLES support, yet. If the build fails complaining about this option, one can edit the src/mainboard/<vendor>/<board>/Options.lb file and add a "uses HAVE_HIGH_TABLES" line. Then one can edit src/arch/i386/boot/tables.c and change the lines:
uint64_t high_tables_base = 0; uint64_t high_tables_size;
uint64_t high_tables_base = ( <memorysize> ) * 1024 * 1024 - (64 * 1024); uint64_t high_tables_size = 64 * 1024;
where <memorysize> is the amount of memory (in MiB) available on the target machine, but not more than 3072. So, if there is more than 3GiB of RAM installed, put 3072. Otherwise, put the number of MiB of RAM installed in the machine.
Alternatively, one can add proper support for HAVE_HIGH_TABLES.
Once the above is done, the final image will be in coreboot.rom.
SeaBIOS and CBFS
SeaBIOS can read the coreboot flash filesystem and extract option ROMs and payloads.
When SeaBIOS scans the target machine's PCI devices, it will recognize option ROMs in CBFS that have the form pciVVVV,DDDD.rom. It will also run any file in the directory vgaroms/ as a vga option ROM not specific to a device and files in genroms/ as a generic option ROM not specific to a device. In the above cases, SeaBIOS will recognize files with a .lzma suffix, and automatically decompress them (eg, pci1106,3344.rom.lzma and vgaroms/sgabios.bin.lzma).
SeaBIOS will also load payloads found in the CBFS directory img/ and floppy images found in the floppyimg/ directory.
The examples below show some common uses of this feature.
Adding a VGA option ROM
It is frequently necessary to add a VGA option ROM to CBFS in order to use a VGA adapter that is built-in to a motherboard. Note, VGA adapters on external cards do not require this step as SeaBIOS will automatically extract the VGA bios directly from the card.
The first step is to find the vendor and device ID of the built-in VGA adapter. This information can be found from lspci:
$ lspci -vnn ... 01:00.0 VGA compatible controller : VIA Technologies, Inc. UniChrome Pro IGP [1106:3344] (rev 01) (prog-if 00 [VGA controller])
In the above example, the VGA vendor/device ID is 1106:3344. Obtain the VGA ROM (eg, vgabios.bin) and add it to the ROM with:
$ ./cbfs/cbfstool coreboot.rom add /path/to/vgabios.bin pci1106,3344.rom 99 $ ./cbfs/cbfstool coreboot.rom print
Alternatively, SeaBIOS supports LZMA compressed option ROMs. Use the following to add a compressed option ROM instead:
$ lzma -zc /path/to/vgabios.bin > vgabios.bin.lzma $ ./cbfs/cbfstool coreboot.rom add vgabios.bin.lzma pci1106,3344.rom.lzma 99 $ ./cbfs/cbfstool coreboot.rom print
After the above is done, one can write the coreboot.rom file to flash. SeaBIOS will extract the VGA ROM and run it during boot.
Adding gpxe support
A gpxe option ROM can nicely complement SeaBIOS and coreboot by adding network boot support. Adding gpxe is similar to #Adding a VGA option ROM. The first step is to find the Ethernet vendor/device ID. For example:
$ lspci -vnn ... 00:09.0 Ethernet controller : Realtek Semiconductor Co., Ltd. RTL-8110SC/8169SC Gigabit Ethernet [10ec:8167] (rev 10)
Then one can build a gpxe option ROM. For example:
$ cd /path/to/gpxe/src/ $ make bin/10ec8167.rom
And add it to the coreboot image. For example:
$ ./cbfs/cbfstool coreboot.rom add /path/to/gpxe/src/bin/10ec8167.rom pci10ec,8167.rom 99 $ ./cbfs/cbfstool coreboot.rom print
As with VGA option ROMs, the gpxe option ROM may be compressed with LZMA. However, compression won't significantly reduce gpxe's size as it implements its own compression.
In addition to gpxe, other option ROMs can be added in the same manor.
Adding sgabios support
An sgabios option ROM can forward some VGA BIOS requests over a serial port.
Unfortunately, the current version of sgabios (as of 20090617) does not implement a proper checksum. As a work around, a tool from the seabios source repo can fix the checksum:
$ /path/to/seabios/tools/buildrom.py /path/to/sgabios.bin sgabios-fixed.bin
Once the above is done, place the ROM file in the vgaroms/ directory of CBFS. For example:
$ ./cbfs/cbfstool coreboot.rom add sgabios-fixed.bin vgaroms/sgabios.bin 99 $ ./cbfs/cbfstool coreboot.rom print
When using sgabios, all the characters that SeaBIOS writes to the screen will be seen twice - once from SeaBIOS sending the character to the serial port and once from sgabios forwarding the character. To prevent the duplicates one can edit the SeaBIOS src/config.h file and set the following:
#define CONFIG_SCREEN_AND_DEBUG 0
Most payloads can also be launched from SeaBIOS. To add a payload, build the corresponding .elf file and then add it to the coreboot.rom file in the img/ directory. For example:
$ ./cbfs/cbfstool coreboot.rom add-payload /path/to/payload.elf img/MyPayload l $ ./cbfs/cbfstool coreboot.rom print
During boot, one can press the F12 key to get a boot menu. SeaBIOS will show all files in the img/ directory, and one can instruct SeaBIOS to run them.
Note, SeaBIOS currently supports uncompressed and LZMA compressed payloads. The nrv2b compression algorithm is not supported.
Adding a floppy image
It is possible to embed an image of a floppy in flash. SeaBIOS can then boot from and redirect floppy BIOS calls to the flash image. This is mainly useful for legacy software (such as DOS utilities). To use this feature, place a floppy image into the CBFS directory floppyimg/. For example:
$ lzma -zc /path/to/myfloppy.img > myfloppy.img.lzma $ ./cbfs/cbfstool coreboot.rom add myfloppy.img.lzma floppyimg/MyFloppy.lzma 99 $ ./cbfs/cbfstool coreboot.rom print
Both uncompressed and lzma compressed images are supported. Several floppy formats are available: 360K, 1.2MB, 720K, 1.44MB, 2.88MB, 160K, 180K, 320K.
The floppy image will appear as writable to the system, however all writes are discarded on reboot.
When using this system, SeaBIOS reserves high-memory to store the floppy. The reserved memory is then no longer available for OS use, so this feature should only be used when needed.
If you are experiencing problems with SeaBIOS, it's useful to increase the debugging level. This is done by editing the src/config.h file and setting the debug level to a higher number (for example 8):
#define CONFIG_DEBUG_LEVEL 8
A debug level of 8 will show a lot of diagnostic information without flooding the serial port (levels above 8 will frequently cause too much data).
To report an issue, please collect the serial boot log with SeaBIOS set to a debug level of 8 and forward the full log along with a description of the problem to the coreboot mailing list.