分类: LINUX
2013-09-12 09:17:41
These are instructions for setting up EDK II build environment on Ubuntu, and building OVMF images for use with qemu.
Recent EDK2 checkouts (as of 2 Sept 2012) are known to build correctly on precise.
sudo apt-get install build-essential git uuid-dev iasl
In a suitable working directory (~/src/ in this case, but you can alter this) checkout the latest EDKII source:
$ mkdir ~/src $ cd ~/src $ git clone git://github.com/tianocore/edk2.git $ cd edk2
The following instructions assume that you remain in the ~/src/edk2 directory
For MS Windows, prebuilt binaries of the base tools are shipped with the source; on Ubuntu the base tools required for building EDKII need to be built first.
$ make -C BaseTools
To set up the build target you need to modify the conf file Conf/target.txt. This will enable the firmware package to be built and set up the compiler version used.
$ vi Conf/target.txt
Find
ACTIVE_PLATFORM = Nt32Pkg/Nt32Pkg.dsc
and replace it with
ACTIVE_PLATFORM = MdeModulePkg/MdeModulePkg.dsc
Find
TARGET_ARCH = IA32
and replace it with 'X64' for 64bit or 'IA32 X64' to build both architectures.
TARGET_ARCH = X64You need to set EDK_TOOLS_PATH and set up the build environment by running the edksetup.sh script provided in the source. This script will copy template and configuration files to edk2/Conf directory.
$ . edksetup.sh EmulatorPkg provides an environment where a UEFI environment can be emulated under an environment where a full UEFI compatible environment is not possible. On systems with the bash shell you can use EmulatorPkg/build.sh to simplify building and running EmulatorPkg. For example, to build + run: $ EmulatorPkg/build.sh $ EmulatorPkg/build.sh runBuild a full system firmware image (OVMF)
The Open Virtual Machine Firmware (or "OVMF") can be used to enable UEFI within virtual machines. It provides libraries and drivers related to virtual machines. Currently OVMF support QEMU for emulating UEFI on IA32 and X86-64 based systems. You could also build OVMF with source level debugging enabled.
Set up build target
You can build OVMF for IA32 or X64 architechtures. In this example we will build OVMF for X64 architecture. You will need to modify Conf/target.txt and replace ACTIVE_PLATFORM with the right dsc file. $ vi Conf/target.txt
Find ACTIVE_PLATFORM = MdeModulePkg/MdeModulePkg.dsc replace with ACTIVE_PLATFORM = OvmfPkg/OvmfPkgX64.dsc This will set the Target Arch to X64, PEI code to X64 and DXE/UEFI code to X64.Build a full system firmware image (OVMF)
The Open Virtual Machine Firmware (or "OVMF") can be used to enable UEFI within virtual machines.
It provides libraries and drivers related to virtual machines. Currently OVMF support QEMU for emulating UEFI on IA32 and X86-64 based systems.
You could also build OVMF with source level debugging enabled.Set up build target
You can build OVMF for IA32 or X64 architechtures. In this example we will build OVMF for X64 architecture. You will need to modify Conf/target.
txt and replace ACTIVE_PLATFORM with the right dsc file.
$ vi Conf/target.txt
FindACTIVE_PLATFORM = MdeModulePkg/MdeModulePkg.dscreplace with
ACTIVE_PLATFORM = OvmfPkg/OvmfPkgX64.dsc
This will set the Target Arch to X64, PEI code to X64 and DXE/UEFI code to X64.Build OvmfPkg
$ cd OvmfPkg $ buildOn an i7 with 16GB RAM the total build time is less than 30 seconds. The firmware image produced will be located in Build/OvmfX64/DEBUG_GCC46/FV/OVMF.fd.If you'd like debug output on the serial console, use the DEBUG_ON_SERIAL_PORT option:
$ build -DDEBUG_ON_SERIAL_PORT=TRUEBuilding OvmfPkg with Secure Boot support
If you wish to build OVMF with Secure Boot, you must follow the openssl installation instructions found in CryptoPkg/Library/OpensslLib/Patch-HOWTO.txt,
$ cd OvmfPkg
and build with the SECURE_BOOT_ENABLE option:$ build -DSECURE_BOOT_ENABLE=TRUE If you see an error that "the required fv image size exceeds the set fv image size" consult .This issue has been fixed in recent builds.Running UEFI in QEMU
See the page for running the OVMF images under qemu.