summaryrefslogtreecommitdiffstats
path: root/BaseTools/Conf/build_rule.template
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2017-08-29 14:21:02 +0100
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2017-08-31 08:59:00 +0100
commitf29ca8e8b96adc2539f44d41ed8521ef6d29c14c (patch)
treeef5b0c23a4223267beba30e3ac43310c9713c1a1 /BaseTools/Conf/build_rule.template
parentf3f0bd168f816b1315ebf0a3fe4522cf6f5b6883 (diff)
downloadedk2-f29ca8e8b96adc2539f44d41ed8521ef6d29c14c.tar.gz
edk2-f29ca8e8b96adc2539f44d41ed8521ef6d29c14c.tar.bz2
edk2-f29ca8e8b96adc2539f44d41ed8521ef6d29c14c.zip
BaseTools/Gcc ARM AARCH64: add support for building device tree binaries
While modern AARCH64 server systems use ACPI for describing the platform topology to the OS, ARM systems and AARCH64 outside of the server space mostly use device tree binaries, which are compiled from device tree source files using the device tree compiler. Currently, such source files and binaries may be kept in the EDK2 platform trees, but are not integrated with the build, which means they need to be kept in sync and recompiled manually, which is cumbersome. So let's wire up BaseTools support for them: add tool definitions for the DTC compiler and preprocessor flags that allow these source files to use FixedPcd expressions and other macros defined by AutoGen.h This way, a device tree binary can be built from source and emitted into a FFS file automatically using something like: DeviceTree.inf: [Defines] INF_VERSION = 0x00010019 BASE_NAME = SomePlatformDeviceTree FILE_GUID = 25462CDA-221F-47DF-AC1D-259CFAA4E326 # gDtPlatformDefaultDtbFileGuid MODULE_TYPE = USER_DEFINED VERSION_STRING = 1.0 [Sources] SomePlatform.dts [Packages] MdePkg/MdePkg.dec SomePlatform.fdf: INF RuleOverride = DTB xxx/yyy/DeviceTree.inf [Rule.Common.USER_DEFINED.DTB] FILE FREEFORM = $(NAMED_GUID) { RAW BIN |.dtb } where it can be picked at runtime by the DTB loader that may refer to it using gDtPlatformDefaultDtbFileGuid. Note that this is very similar to how ACPI tables may be emitted into a FFS file with a known GUID and picked up by AcpiTableDxe at runtime. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Conf/build_rule.template')
-rwxr-xr-xBaseTools/Conf/build_rule.template14
1 files changed, 14 insertions, 0 deletions
diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template
index d8c8253983..3e6aa8ff0f 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -238,6 +238,20 @@
# For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
"$(ASM)" $(ASM_FLAGS) -o ${dst} ${d_path}(+)${s_base}.iii
+[Device-Tree-Source-File]
+ <InputFile>
+ ?.dts
+
+ <ExtraDependency>
+ $(MAKE_FILE)
+
+ <OutputFile>
+ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dtb
+
+ <Command.GCC>
+ "$(PP)" $(DTCPP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
+ "$(DTC)" -I dts -O dtb -o ${dst} ${d_path}(+)${s_base}.i
+
[Visual-Form-Representation-File]
<InputFile>
?.vfr