Build overview

From SeaBIOS
Revision as of 01:04, 7 March 2011 by Koconnor (talk | contribs) (Page with info on compiling and running SeaBIOS)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The SeaBIOS code can be built using standard GNU tools. A recent Linux distribution should be able to build SeaBIOS using the standard compiler tools.

Quick start

For QEMU and KVM users, obtain the code and run make. The resulting binary image will be located in out/bios.bin. For coreboot users, please see the coreboot SeaBIOS page.

It is possible to configure additional compile time options - run make menuconfig to do this.

Testing images on QEMU

To test under QEMU, one will need to create a directory with all the bios images and then overwrite the main bios image. For example:

cp /usr/share/qemu/*.bin mybiosdir/
cp out/bios.bin mybiosdir/

Once this is setup, one can instruct QEMU to use the newly created directory for rom images. For example:

qemu -L mybiosdir/ -fda myfdimage.img

For best results, please use QEMU version 0.12.0 or later.

Testing images on Bochs

To test the bios under bochs, some config option changs are needed. Run make menuconfig, set CONFIG_OPTIONROMS_DEPLOYED, and unset CONFIG_MTRR_INIT. Then one can run Bochs with the resulting bios.bin file - for example:

bochs -q 'floppya: 1_44=myfdimage.img, status=inserted' 'romimage: file=out/bios.bin'

For best results, please use Bochs version 2.4.5 or later.

Debug information

SeaBIOS writes informational messages to a special debug port. Under QEMU, one can view these messages using the isa-debugcon module. For example:

qemu -fda myfdimage.img -chardev stdio,id=seabios -device isa-debugcon,iobase=0x402,chardev=seabios

It's possible to increase the verbosity of the SeaBIOS debug information. To do this, run make menuconfig and set CONFIG_DEBUG_LEVEL to a higher value. When reporting issues, please set the debug level to 8 (levels above 8 will frequently cause too much data) and include the full log along with a description of the problem in the trouble report.

Debugging with QEMU and GDB

The gdb-server mechanism of QEMU is also useful. One can use gdb with QEMU to debug system images. To use this, add '-s -S' to the QEMU command line. For example:

qemu -L mybiosdir/ -fda myfdimage.img -s -S

Then, in another session, run gdb with either out/rom16.o (to debug bios 16bit code) or out/rom32.o (to debug bios 32bit code). For example:

gdb out/rom16.o

Once in gdb, use the command target remote localhost:1234 to have gdb connect to qemu. See the QEMU documentation for more information on using gdb and qemu in this mode. Note that gdb seems to get breakpoints confused when the cpu is in 16-bit real mode. This makes stepping through the program difficult (though 'step instruction' still works). Also, one may need to set 16bit break points at both the cpu address and memory address (eg, break *0x1234 ; break *0xf1234).