These changes are the raw update to qemu-2.6.
[kvmfornfv.git] / qemu / roms / seabios / docs / Build_overview.md
1 The SeaBIOS code can be built using standard GNU tools. A recent Linux
2 distribution should be able to build SeaBIOS using the standard
3 compiler tools.
4
5 Building SeaBIOS
6 ================
7
8 First, [obtain the code](Download). SeaBIOS can be compiled for
9 several different build targets. It is also possible to configure
10 additional compile time options - run **make menuconfig** to do this.
11
12 Build for QEMU (along with KVM, Xen, and Bochs)
13 -----------------------------------------------
14
15 To build for QEMU (and similar), one should be able to run "make" in
16 the main directory. The resulting file "out/bios.bin" contains the
17 processed bios image.
18
19 One can use the resulting binary with QEMU by using QEMU's "-bios"
20 option. For example:
21
22 `qemu -bios out/bios.bin -fda myfdimage.img`
23
24 One can also use the resulting binary with Bochs. For example:
25
26 `bochs -q 'floppya: 1_44=myfdimage.img' 'romimage: file=out/bios.bin'`
27
28 Build for coreboot
29 ------------------
30
31 To build for coreboot please see the coreboot build instructions at:
32 <http://www.coreboot.org/SeaBIOS>
33
34 Build as a UEFI Compatibility Support Module (CSM)
35 --------------------------------------------------
36
37 To build as a CSM, first run kconfig (make menuconfig) and enable
38 CONFIG_CSM. Then build SeaBIOS (make) - the resulting binary will be
39 in "out/Csm16.bin".
40
41 This binary may be used with the OMVF/EDK-II UEFI firmware. It will
42 provide "legacy" BIOS services for booting non-EFI operating systems
43 and will also allow OVMF to display on otherwise unsupported video
44 hardware by using the traditional VGA BIOS. (Windows 2008r2 is known
45 to use INT 10h BIOS calls even when booted via EFI, and the presence
46 of a CSM makes this work as expected too.)
47
48 Having built SeaBIOS with CONFIG_CSM, one should be able to drop the
49 result (out/Csm16.bin) into an OVMF build tree at
50 OvmfPkg/Csm/Csm16/Csm16.bin and then build OVMF with 'build -D
51 CSM_ENABLE'. The SeaBIOS binary will be included as a discrete file
52 within the 'Flash Volume' which is created, and there are tools which
53 will extract it and allow it to be replaced.
54
55 Distribution builds
56 ===================
57
58 If one is building a binary version of SeaBIOS as part of a package
59 (such as an rpm) or for wide distribution, please provide the
60 EXTRAVERSION field during the build. For example:
61
62 `make EXTRAVERSION="-${RPM_PACKAGE_RELEASE}"`
63
64 The EXTRAVERSION field should provide the package version (if
65 applicable) and the name of the distribution (if that's not already
66 obvious from the package version). This string will be appended to the
67 main SeaBIOS version. The above information helps SeaBIOS developers
68 correlate defect reports to the source code and build environment.
69
70 If one is building a binary in a build environment that does not have
71 access to the git tool or does not have the full SeaBIOS git repo
72 available, then please use an official SeaBIOS release tar file as
73 source. If building from a snapshot (where there is no official
74 SeaBIOS tar) then one should generate a snapshot tar file on a machine
75 that does support git using the scripts/tarball.sh tool. For example:
76
77 `scripts/tarball.sh`
78
79 The tarball.sh script encodes version information in the resulting tar
80 file which the build can extract and include in the final binary. The
81 above EXTRAVERSION field should still be set when building from a tar.
82
83 Overview of files in the repository
84 ===================================
85
86 The **src/** directory contains the main bios source code. The
87 **src/hw/** directory contains source code specific to hardware
88 drivers. The **src/fw/** directory contains source code for platform
89 firmware initialization. The **src/std/** directory contains header
90 files describing standard bios, firmware, and hardware interfaces.
91
92 The **vgasrc/** directory contains code for [SeaVGABIOS](SeaVGABIOS).
93
94 The **scripts/** directory contains helper utilities for manipulating
95 and building the final roms.
96
97 The **out/** directory is created by the build process - it contains
98 all intermediate and final files.
99
100 When reading the C code be aware that code that runs in 16bit mode can
101 not arbitrarily access non-stack memory - see [Memory Model](Memory
102 Model) for more details. For information on the major C code functions
103 and where code execution starts see [Execution and code
104 flow](Execution and code flow).