SeaBIOS: Difference between revisions
m (→Use cases) |
mNo edit summary |
||
Line 3: | Line 3: | ||
= Use cases = | = Use cases = | ||
Any software requiring 16-bit BIOS services benefits from SeaBIOS. Windows or Linux booting | Any software requiring 16-bit BIOS services benefits from SeaBIOS, e.g. Windows or Linux (booting through standard GRUB). Linux booting will work out of the box. Generally Windows booting will also work, but Windows might require some more ACPI tweaks therefore it may not complete the boot (STOP 0xA5). | ||
Linux booting will work out of the box. Generally Windows booting will also work, but Windows might require | |||
some more ACPI tweaks therefore it may not complete the boot (STOP 0xA5) | |||
So far [[ASUS M2V-MX SE]] has known good working ACPI and is able to boot XP/Vista/Windows 7. Please ask on the [[Mailinglist|mailing list]] for the status of other boards/chipsets. | |||
== Windows XP == | == Windows XP == | ||
Line 60: | Line 56: | ||
== coreboot == | == coreboot == | ||
For best results, use coreboot-v2 and edit the | For best results, use coreboot-v2 and edit the '''targets/..../Config.lb''' with the following: | ||
option CONFIG_CBFS=1 | option CONFIG_CBFS = 1 | ||
option HAVE_HIGH_TABLES=1 | option HAVE_HIGH_TABLES = 1 | ||
... | ... | ||
romimage "fallback" | romimage "fallback" | ||
Line 70: | Line 66: | ||
end | end | ||
Unfortunately, many boards don't have HAVE_HIGH_TABLES support yet. | 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"> | <source lang="C"> | ||
Line 80: | Line 76: | ||
<source lang="C"> | <source lang="C"> | ||
uint64_t high_tables_base = ( <memorysize> )*1024*1024 - (64*1024); | uint64_t high_tables_base = ( <memorysize> ) * 1024 * 1024 - (64 * 1024); | ||
uint64_t high_tables_size = 64*1024; | uint64_t high_tables_size = 64 * 1024; | ||
</source> | </source> | ||
where <memorysize> is the amount of memory (in MiB) available on the target machine, but not more than 3072. So, if you have more than 3GiB of | where <memorysize> is the amount of memory (in MiB) available on the target machine, but '''not more than 3072'''. So, if you have more than 3GiB of RAM installed, put 3072. Otherwise, put the number of MiB of RAM installed in your machine. | ||
Alternatively, one can add proper support for HAVE_HIGH_TABLES. | Alternatively, one can add proper support for HAVE_HIGH_TABLES. | ||
Line 92: | Line 88: | ||
= SeaBIOS and CBFS = | = SeaBIOS and CBFS = | ||
SeaBIOS can read the coreboot flash filesystem and extract option | 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 | 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 '''genroms/''' as an 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 '''genroms/sgabios.bin.lzma'''). | ||
SeaBIOS will also load payloads found in the CBFS directory | SeaBIOS will also load payloads found in the CBFS directory '''img/'''. | ||
The examples below show some common uses of this feature. | The examples below show some common uses of this feature. | ||
== Adding a VGA option | == Adding a VGA option ROM == | ||
It is frequently necessary to add a | 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 | 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"> | ||
Line 112: | Line 108: | ||
</source> | </source> | ||
In the above example, the VGA vendor/ | In the above example, the VGA vendor/device ID is '''1106:3344'''. [[VGA support#How_to_retrieve_a_good_video_bios|Obtain the VGA ROM]] (eg, '''vgabios.bin''') and add it to the ROM with: | ||
<source lang="bash"> | <source lang="bash"> | ||
Line 119: | Line 115: | ||
</source> | </source> | ||
Alternatively, SeaBIOS supports | Alternatively, SeaBIOS supports LZMA compressed option ROMs. Use the following to add a compressed option ROM instead: | ||
<source lang="bash"> | <source lang="bash"> | ||
Line 127: | Line 123: | ||
</source> | </source> | ||
After the above is done, one can write the coreboot.rom file to flash. | 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 == | == Adding gpxe support == | ||
A [[ | A [[GPXE|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"> | ||
Line 139: | Line 135: | ||
</source> | </source> | ||
Then one can build a gpxe option | Then one can build a gpxe option ROM. For example: | ||
<source lang="bash"> | <source lang="bash"> | ||
Line 146: | Line 142: | ||
</source> | </source> | ||
And add it to the coreboot image. | And add it to the coreboot image. For example: | ||
<source lang="bash"> | <source lang="bash"> | ||
Line 153: | Line 149: | ||
</source> | </source> | ||
As with VGA option | 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 | In addition to gpxe, other option ROMs can be added in the same manor. | ||
== Adding sgabios support == | == Adding sgabios support == | ||
An | An [http://code.google.com/p/sgabios/ sgabios] option ROM can forward some VGA BIOS requests over a serial port. To use sgabios, place its ROM file in the '''genroms/''' directory of CBFS. For example: | ||
<source lang="bash"> | <source lang="bash"> | ||
Line 168: | Line 164: | ||
== Adding payloads == | == Adding payloads == | ||
Most [[Payloads|payloads]] can also be launched from SeaBIOS. | Most [[Payloads|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: | ||
<source lang="bash"> | <source lang="bash"> | ||
Line 175: | Line 171: | ||
</source> | </source> | ||
During boot, one can press the F12 key to get a boot menu. | 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 | Note, SeaBIOS currently supports uncompressed and LZMA compressed payloads. The nrv2b compression algorithm is not supported. |
Revision as of 01:09, 30 May 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, e.g. Windows or Linux (booting through standard GRUB). Linux booting will work out of the box. Generally Windows booting will also work, but Windows might require some more ACPI tweaks therefore it may not complete the boot (STOP 0xA5).
So far ASUS M2V-MX SE has known good working ACPI and is able to boot XP/Vista/Windows 7. Please ask on the mailing list for the status of other boards/chipsets.
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 (64 bit) has been booted on real hardware with coreboot and SeaBIOS. Some patches 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:
<source lang="bash"> $ git clone git://git.linuxtogo.org/home/kevin/seabios.git seabios $ cd seabios </source>
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:
<source lang="C">
- define CONFIG_COREBOOT 1
- define CONFIG_DEBUG_SERIAL 1
- define CONFIG_OPTIONROMS_DEPLOYED 0
- define CONFIG_COREBOOT_FLASH 1
- define CONFIG_VGAHOOKS 1
</source>
Then:
<source lang="bash"> $ make </source>
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 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:
<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, but not more than 3072. So, if you have more than 3GiB of RAM installed, put 3072. Otherwise, put the number of MiB of RAM installed in your 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 genroms/ as an 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 genroms/sgabios.bin.lzma).
SeaBIOS will also load payloads found in the CBFS directory img/.
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 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"> $ lspci -vnn ... 01:00.0 VGA compatible controller [0300]: VIA Technologies, Inc. UniChrome Pro IGP [1106:3344] (rev 01) (prog-if 00 [VGA controller]) </source>
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:
<source lang="bash"> $ ./cbfstool coreboot.rom add /path/to/vgabios.bin pci1106,3344.rom 0 $ ./cbfstool coreboot.rom print </source>
Alternatively, SeaBIOS supports LZMA compressed option ROMs. Use the following to add a compressed option ROM instead:
<source lang="bash"> $ lzma -zc /path/to/vgabios.bin > vgabios.bin.lzma $ ./cbfstool coreboot.rom add vgabios.bin.lzma pci1106,3344.rom.lzma 0 $ ./cbfstool coreboot.rom print </source>
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:
<source lang="bash"> $ lspci -vnn ... 00:09.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL-8110SC/8169SC Gigabit Ethernet [10ec:8167] (rev 10) </source>
Then one can build a gpxe option ROM. For example:
<source lang="bash"> $ cd /path/to/gpxe/src/ $ make bin/10ec8167.rom </source>
And add it to the coreboot image. For example:
<source lang="bash"> $ ./cbfstool coreboot.rom add /path/to/gpxe/src/bin/10ec8167.rom pci10ec,8167.rom 0 $ ./cbfstool coreboot.rom print </source>
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. To use sgabios, place its ROM file in the genroms/ directory of CBFS. For example:
<source lang="bash"> $ ./cbfstool coreboot.rom add /path/to/sgabios.bin genroms/sgabios.bin 0 $ ./cbfstool coreboot.rom print </source>
Adding payloads
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:
<source lang="bash"> $ ./cbfstool coreboot.rom add-payload /path/to/payload.elf img/MyPayload l $ ./cbfstool coreboot.rom print </source>
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.