crosvm/cros_fdt/test-files/compile_testfiles.sh
Jakob Vukalovic 8b21047281 cros_fdt: Add device tree overlay tests
Add test for the device tree overlay mechanism.

Bug: b/296796644
Test: cd cros_fdt && cargo test
Change-Id: I8e8d129344e1ad4ddf0d7af7b3f21c0c9d9ca038
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4855966
Commit-Queue: Jakob Vukalović <jakobvukalovic@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-07 18:15:21 +00:00

24 lines
664 B
Bash
Executable file

#!/bin/sh
# Copyright 2023 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Compile device tree source files to binaries used as test inputs.
# Run this when source files are changed.
# Check if dtc is present
if ! command -v dtc >/dev/null 2>&1; then
echo "Error: device tree compiler (dtc) not found."
exit 1
fi
# Compile all dts files
testfiles_loc="$(dirname -- "$0")"
for source_file in "$testfiles_loc"/*.dts; do
if [ -f "$source_file" ]; then
binary_file="${source_file%.dts}.dtb"
dtc -@ -I dts -O dtb -o "$binary_file" "$source_file"
fi
done