#!/bin/sh12# Copyright 2023 The ChromiumOS Authors3# Use of this source code is governed by a BSD-style license that can be4# found in the LICENSE file.56# Compile device tree source files to binaries used as test inputs.7# Run this when source files are changed.89# Check if dtc is present10if ! command -v dtc >/dev/null 2>&1; then11echo "Error: device tree compiler (dtc) not found."12exit 113fi1415# Compile all dts files16testfiles_loc="$(dirname -- "$0")"17for source_file in "$testfiles_loc"/*.dts; do18if [ -f "$source_file" ]; then19binary_file="${source_file%.dts}.dtb"20dtc -@ -I dts -O dtb -o "$binary_file" "$source_file"21fi22done232425