Difference between revisions of "SeaBIOS"

From coreboot
Jump to: navigation, search
(PCIBIOS should not be disabled; OPTIONROMS_DEPLOYED should be disabled; Fix gitweb link; AVOIDCOMBINE now autodetected.)
(Rework build to use romfs and coreboot-v2)
Line 40: Line 40:
 
#define CONFIG_DEBUG_SERIAL 1
 
#define CONFIG_DEBUG_SERIAL 1
 
#define CONFIG_OPTIONROMS_DEPLOYED 0
 
#define CONFIG_OPTIONROMS_DEPLOYED 0
 +
#define CONFIG_COREBOOT_FLASH 1
 
</source>
 
</source>
  
Line 52: Line 53:
 
=== coreboot ===
 
=== coreboot ===
  
Finally, you have to build coreboot (v3 in this example) with SeaBIOS as payload:
+
For best results, use coreboot-v2 and edit the target Config.lb with the following:
 +
 
 +
option CONFIG_ROMFS=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:
 +
 
 +
<source lang="C">
 +
uint64_t high_tables_base = 0;
 +
uint64_t high_tables_size;
 +
</source>
 +
 
 +
to:
 +
 
 +
<source lang="C">
 +
uint64_t high_tables_base = ( <memorysize> )*1024*1024 - (64*1024);
 +
uint64_t high_tables_size = 64*1024;
 +
</source>
 +
 
 +
where <memorysize> is the amount of memory (in MiB) available on the target machine.  Alternatively, one can add proper support for HAVE_HIGH_TABLES.
 +
 
 +
Once the above is done, the final image will be in '''coreboot.romfs'''.
 +
 
 +
=== Adding a VGA option rom ===
 +
 
 +
Once a '''coreboot.romfs''' file has been prepared, one can add option roms to it.  It is frequently necessary to add a vga option rom for built-in VGA adapters so that they are properly initialized.
 +
 
 +
The first step is to find the vendor and device id of the VGA adapter.  This information can be found from '''lspci''':
  
 
<source lang="bash">
 
<source lang="bash">
$ cd ..
+
$ lspci -vnn
$ svn co svn://coreboot.org/repository/coreboot-v3
+
...
$ cp seabios/out/bios.bin.elf coreboot-v3/payload.elf
+
01:00.0 VGA compatible controller [0300]: VIA Technologies, Inc. UniChrome Pro IGP [1106:3344] (rev 01) (prog-if 00 [VGA controller])
$ cd coreboot-v3
 
$ make menuconfig
 
 
</source>
 
</source>
  
Now enter the '''Payload''' menu and select '''Payload type''' and then '''An ELF executable payload file'''. Now exit the menu, save your settings, and build coreboot:
+
In the above example, the VGA vendor/deviceid is "1106:3344". Obtain the vga rom (eg, vgabios.bin) and add it to the rom with:
  
 
<source lang="bash">
 
<source lang="bash">
$ make
+
$ ./romtool coreboot.romfs add vgabios.bin pci1106,3344.rom 0
 +
$ ./romtool coreboot.romfs print
 
</source>
 
</source>
  
The file '''build/coreboot.rom''' (or '''build/bios.bin''') is your final coreboot v3 image, which also contains the SeaBIOS payload.
+
After the above is done, one can write the coreboot.romfs file to flash. SeaBIOS will extract the vga rom and run it during boot.
  
== Running SeaBIOS in QEMU ==
+
=== Adding gpxe support ===
  
For running coreboot+SeaBIOS in QEMU, you need a patched version of '''vgabios-cirrus.bin''' in your '''build''' directory first:
+
A [[http://www.etherboot.org/ 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:
  
 
<source lang="bash">
 
<source lang="bash">
$ cd build
+
$ lspci -vnn
$ wget http://www.coreboot.org/images/0/0d/Vgabios-cirrus.zip
+
...
$ unzip Vgabios-cirrus.zip
+
00:09.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL-8110SC/8169SC Gigabit Ethernet [10ec:8167] (rev 10)
$ cd ..
 
 
</source>
 
</source>
  
You can now run SeaBIOS in QEMU:
+
Then one can build a gpxe option rom.  For example:
  
 
<source lang="bash">
 
<source lang="bash">
$ qemu -L build -hda /dev/zero -serial stdio
+
$ cd gpxe/src/
 +
$ make bin/10ec8167.rom
 
</source>
 
</source>
  
== Ready-made SeaBIOS QEMU image ==
+
Then add it to the coreboot image.  For example:
  
TODO
+
<source lang="bash">
 +
$ ./romtool coreboot.romfs add /path/to/gpxe/src/bin/10ec8167.rom pci10ec,8167.rom 0
 +
$ ./romtool coreboot.romfs print
 +
</source>
  
{{PD-self}}
+
In addition to gpxe, other option roms can be added in the same manor.

Revision as of 02:28, 14 April 2009

SeaBIOS (previously known as LegacyBIOS) is an open-source legacy BIOS implementation, which can also be used as coreboot payload.

Use cases

Any software requiring 16-bit BIOS services benefits from SeaBIOS.

Windows XP

Windows XP has been booted on real hardware with coreboot and SeaBIOS. Some patches are required.

Windows Vista

Windows Vista (64/32 bit) has been booted on real hardware with coreboot and SeaBIOS. Some patches are required.

Windows 7 Beta

Windows 7 Beta (?? bit) has been booted on real hardware with coreboot and SeaBIOS. Some patches are required.

GRUB

GRUB works with coreboot and SeaBIOS on real hardware and boots Linux just fine.

Building

SeaBIOS

You can download the latest version of SeaBIOS through a git repository:

$ git clone git://git.linuxtogo.org/home/kevin/seabios.git seabios
$ cd seabios

Alternatively, the released versions of SeaBIOS can be found at http://linuxtogo.org/~kevin/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_OPTIONROMS_DEPLOYED 0
#define CONFIG_COREBOOT_FLASH 1

Then:

$ make

The final SeaBIOS payload file is out/bios.bin.elf, which can be used with coreboot v2 or v3.

coreboot

For best results, use coreboot-v2 and edit the target Config.lb with the following:

option CONFIG_ROMFS=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;

to:

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. Alternatively, one can add proper support for HAVE_HIGH_TABLES.

Once the above is done, the final image will be in coreboot.romfs.

Adding a VGA option rom

Once a coreboot.romfs file has been prepared, one can add option roms to it. It is frequently necessary to add a vga option rom for built-in VGA adapters so that they are properly initialized.

The first step is to find the vendor and device id of the VGA adapter. This information can be found from lspci:

$ lspci -vnn
...
01:00.0 VGA compatible controller [0300]: VIA Technologies, Inc. UniChrome Pro IGP [1106:3344] (rev 01) (prog-if 00 [VGA controller])

In the above example, the VGA vendor/deviceid is "1106:3344". Obtain the vga rom (eg, vgabios.bin) and add it to the rom with:

$ ./romtool coreboot.romfs add vgabios.bin pci1106,3344.rom 0
$ ./romtool coreboot.romfs print

After the above is done, one can write the coreboot.romfs 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 [0200]: Realtek Semiconductor Co., Ltd. RTL-8110SC/8169SC Gigabit Ethernet [10ec:8167] (rev 10)

Then one can build a gpxe option rom. For example:

$ cd gpxe/src/
$ make bin/10ec8167.rom

Then add it to the coreboot image. For example:

$ ./romtool coreboot.romfs add /path/to/gpxe/src/bin/10ec8167.rom pci10ec,8167.rom 0
$ ./romtool coreboot.romfs print

In addition to gpxe, other option roms can be added in the same manor.