05_EDK2 build - manojkumarpaladugu/UEFI-BIOS-Development GitHub Wiki
Prerequisites:
- Install nasm compiler (https://www.nasm.us/pub/nasm/releasebuilds/2.12.02/win64/) to C:\NASM
- Install Python 3 and above
- Copy ASL tools(https://acpica.org/downloads/binary-tools) to C:\ASL
- Install Visual Studio 2019. But, in case if EDK2 source code is not building, then install Visual Studio 2015 toolset + Windows 8.1 SDK.
Clone EDK2 source code:
mkdir edk2_workspace
cd edk2_workspace
git clone https://github.com/tianocore/edk2.git
cd edk2
git submodule update --init
cd ..
Build EDK2 source code:
- Open cmd prompt
- cd edk2_workspace
- set WORKSPACE=%CD%
set PACKAGES_PATH=%WORKSPACE%\edk2
set NASM_PREFIX=C:\nasm\ - cd edk2
- Run edksetup.bat Rebuild (if building first time), otherwise run edksetup.bat
- Now, build the OvmfPkg.
build -p OvmfPkg\OvmfPkgX64.dsc -D SOURCE_DEBUG_ENABLE=TRUE -a X64 -b DEBUG
Run BIOS in QEMU:
- set QEMU=C:\Program Files\qemu
- Now, run the BIOS in QEMU virtual platform.
"%QEMU%\qemu-system-x86_64" -debugcon file:debug.log -global isa-debugcon.iobase=0x402 -net none -pflash ..\Build\OvmfX64\DEBUG_VS2015x86\FV\OVMF.fd
(or)
To enable fs0:
"%QEMU%\qemu-system-x86_64" -drive file=fat:rw:..\Build\OvmfX64\DEBUG_VS2015x86\X64,format=raw -debugcon file:debug.log -global isa-debugcon.iobase=0x402 -net none -pflash ..\Build\OvmfX64\DEBUG_VS2015x86\FV\OVMF.fd
EDK2 File Extensions:
-
EDK2 Spec:
- .DEC: Package Declaration
- .DSC: Platform Description
- .INF: Module Definition define a component
- .FDF: Flash Description
-
Source:
- .VFR: Visual Forms Representation for User Interface
- .UNI: Unicode text files with ease of localization
- .c & .h: Source code files
-
Output:
- .FD: Final Flash Device Image
- .FV: Firmware Volume File
EDK2 File Contents:
-
.DEC: Package Declaration
- [Defines]
- [Includes]
- [LibraryClasses]
- [Guids]
- [Protocols]
- [PcdsFixedAtBuild]
- [PcdsFeatureFlag]
-
.DSC: Platform Description
DSC file is the recipe for creating a package- [Defines]
- [BuildOptions]
- [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
- [Library Classes]
- [Components]
-
.FDF: Flash Description File
FDF file describes about what components goes into flash parts.
Rules for combining binaries (Firmware Image) built from a DSC file.- [Defines]
- <FD>
- <FV>
- [Capsules]
- [VTF]
- [Rules]
- [OptionRom]
- [UserExtensions]
.FDF file layout:
- FV Recovery file: Used to store SEC\PEI phase code.
- FTW spare space
- FTW working space
- Event Log: NVRAM storage for event logs
- Microcode: CPU microcode
- Variable Region: Variables and Platform Settings
- FV Main: Contains DXE drivers