Purpose of DEC and DSC Files in UEFI EDK II
In the UEFI EDK II (EFI Development Kit II) framework, Package Declaration (DEC) and Platform Description (DSC) files are fundamental build-system configuration files that separate interface declarations from platform assembly. DEC files act as abstract contracts that declare public interfaces, protocols, and data structures provided by a package, while DSC files specify the concrete components, library mappings, and build rules required to compile a complete firmware target. Understanding the distinct roles of these two file types is essential for developing modular, reusable, and buildable UEFI firmware components.
Package Declaration Files (.dec)
A DEC file serves as the public interface declaration for an EDK II package. It defines what a package provides to other modules and packages within the workspace without detailing how those components are built into a final firmware image.
Key responsibilities of a DEC file include:
- Declaring Public Interfaces: Lists public include directories containing C header files exposed by the package.
- Identifier Definitions: Defines the Globally Unique Identifiers (GUIDs), Protocols, and Pre-EFI Initialization (PEI) Program Interfaces (PPIs) introduced by the package.
- Platform Configuration Database (PCD) Declarations: Defines the names, data types, default values, and token spaces of PCDs. This allows configuration options to be declared with designated access methods (such as FixedAtBuild, FeatureFlag, or Dynamic).
DEC files are consumed by individual module description
(.inf) files that reference the headers, protocols, or PCDs
declared within the package.
Platform Description Files (.dsc)
A DSC file describes the composition of an entire platform or a test harness. It instructs the EDK II build tool on which components to build, which library implementations to link against those components, and how to configure global settings for a specific target.
Key responsibilities of a DSC file include:
- Module Selection: Specifies all the
.infmodules (drivers, applications, libraries) that must be compiled for the target platform. - Library Resolution: Resolves abstract library
classes declared in
.inffiles to concrete library instances via the[LibraryClasses]section. Different platforms can link the same driver to different library instances depending on hardware requirements. - PCD Value Assignment: Overrides default PCD values declared in DEC files. The DSC file establishes the actual values and configurations used for the build target.
- Build Architecture and Flags: Defines platform-wide compiler flags, target architectures (such as IA32, X64, or AARCH64), and output formats.
How DEC and DSC Files Work Together
DEC and DSC files operate in a producer-consumer paradigm:
- The DEC file produces declarations: A package developer creates a DEC file to announce interfaces, GUIDs, and configurable PCD options.
- Modules consume DEC declarations: Individual module
.inffiles reference these declarations to write code against standard interfaces. - The DSC file orchestrates the build: A platform integrator creates a DSC file that selects the modules, assigns concrete library instances to fulfill the interfaces, sets the final values for the PCDs defined in the DEC files, and invokes the EDK II build engine to produce the firmware binary.