EDK2 Build Flow

The EDK    II Build Process is handled in three major stages:

  •     Pre-build or AutoGen stage:    parse meta-data files,UCS-2LE encoded files and VFR files to generate some C source code files and the Makefiles.
  •     Build or $(MAKE) stage: process source code files to create PE32/PE32+/COFF images that are processed to EFI format using NMAKE (Microsoft operating system development platforms) or MAKE (for UNIX style operating system development platforms).
  •     Post-build or ImageGen stage: takes the binary, EFI format files and creates EFI "FLASH" images, EFI update capsules, UEFI applications or PCI Option ROMs.

EDK2 Build Flow

Parse EDK II Meta-Data - AutoGen stage 

EDK2 Build Flow

The first file the build tool is looking for in AutoGen stage is target.txt in directory $(WORKSPACE)/Conf . All the configurations in target.txt can be overridden by command line options of build tool. If no platform description file is specified in either target.txt and command line, the build tool will try to find one in current directory. And if build tool finds a description file of a module (INF file) in current directory, it will try to build just that module only rather than building a whole platform.

Once the build tool gets what to build and how to build, it starts to parse the platform description file (DSC). From the DSC file, the build tools will locate the INF files for all modules and libraries, as well as other settings of the platform (including DEC specified default values for PCDs used by modules and libraries that do not have values specified in the DSC file).

From module description files, the build tool will find out what package description files the module depends on. In this way, the build tool will find out and parse all modules and packages that make up a platform.

The next thing to do in the AutoGen stage is to generate files required to build a module. The files include: AutoGen.h , AutoGen.c , $(BASENAME).depex and Makefile .

AutoGen.c and $(BASENAME).depex files will not be generated for library modules, and $(BASENAME).depex file is generated only if there's [Depex] section found in the module's INF file.

Each module found in DSC file will have a makefile generated for it. Once all of the makefiles have been generated, the build tool will call nmake (or make) for each module's Makefile .