blob: f9561bbf6c9fa6fa00d2a681352d1dbcb2e8dcfb [file] [log] [blame]
# Copyright 2023 The Fuchsia Authors
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT
import("//build/components.gni")
import("//build/devicetree/devicetree.gni")
import("//build/testing/host_test_data.gni")
# Real device produced device tree binary format files. These files are the blobs obtained from such devices.
# Reconstructed 'dts' files live along the 'dtb' files but are not exported.
#
# NOTE: Do NOT regenerate 'dtb' files from the dts file, this might change the structure of the blob obtained
# from the device.
dtb_real = [
"crosvm-arm.dtb",
"muntjac.dtb",
"qemu-arm-gic2.dtb",
"qemu-arm-gic3.dtb",
"qemu-riscv.dtb",
"sifive-hifive-unmatched.dtb",
"vision-five-2.dtb",
"khadas-vim3.dtb",
]
# Synthetic devicetree source files meant for testing, they are not required to reflect any real node.
dts_synthetic = [
"synthetic/arm_gic2_no_msi.dts",
"synthetic/arm_gic3_stride.dts",
"synthetic/arm_gic3_four_stride.dts",
"synthetic/arm_gic3_subsumed_stride.dts",
"synthetic/arm_timer.dts",
"synthetic/arm_timer_no_frequency_override.dts",
"synthetic/chosen.dts",
"synthetic/chosen_with_reg_offset.dts",
"synthetic/chosen_with_translation.dts",
"synthetic/chosen_unknown_intc.dts",
"synthetic/complex_no_properties.dts",
"synthetic/complex_with_alias.dts",
"synthetic/complex_with_alias_first.dts",
"synthetic/cpus_arm.dts",
"synthetic/cpus_arm_no_cpu_map.dts",
"synthetic/cpus_arm_single_cell.dts",
"synthetic/cpus_riscv.dts",
"synthetic/cpus_riscv_nested_clusters.dts",
"synthetic/cpus_no_cpu_map_riscv.dts",
"synthetic/empty.dts",
"synthetic/memory_complex.dts",
"synthetic/memory.dts",
"synthetic/memory_reservations.dts",
"synthetic/plic_riscv.dts",
"synthetic/psci-hvc.dts",
"synthetic/psci-smc.dts",
"synthetic/reserved_memory.dts",
"synthetic/simple_with_properties.dts",
]
# Compile the synthetic source file to get blobs.
dtb_synthetic = []
dtb_synthetic_deps = []
foreach(dts_file, dts_synthetic) {
dtb_target = get_path_info(dts_file, "name")
dtb(dtb_target) {
sources = [ dts_file ]
}
dtb_synthetic += get_target_outputs(":$dtb_target")
dtb_synthetic_deps += [ ":$dtb_target" ]
}
dtb_all = dtb_real + dtb_synthetic
# Check for no overlapping files, so we guarantee that they all fit in the same subdirectory.
filenames = []
foreach(dtb, dtb_all) {
curr = [ get_path_info(dtb, "file") ]
assert(filenames + curr - curr == filenames,
"dtb_all file names must be unique. '${curr[0]}' is duplicated.")
filenames += curr
curr = []
}
if (is_host) {
runtime_path = "test_data/devicetree"
} else {
runtime_path = "data"
}
# Provides relative path from the executable to the repository directory.
# The expected path is platform specific.
config("data_path") {
defines = [ "LIB_DEVICETREE_DATA=\"$runtime_path\"" ]
}
if (is_host) {
host_test_data("data") {
sources = dtb_all
outputs = [ "$root_out_dir/$runtime_path/{{source_file_part}}" ]
deps = dtb_synthetic_deps
}
} else {
resource("data") {
sources = dtb_all
outputs = [ "$runtime_path/{{source_file_part}}" ]
deps = dtb_synthetic_deps
}
}