xref: /freebsd/sys/tools/fdt/make_dtbo.sh (revision f126890ac5386406dadf7c4cfa9566cbb56537c5)
1#!/bin/sh
2#
3
4# Script generates dtbo file ($3) from dtso source ($2) in build tree S ($1)
5S=$1
6dtso="$2"
7dtbo_path=$3
8
9if [ -z "$dtso" ]; then
10    echo "No DTS overlays specified"
11    exit 1
12fi
13
14if [ -z "${MACHINE}" ]; then
15    MACHINE=$(uname -m)
16fi
17
18: "${DTC:=dtc}"
19: "${ECHO:=echo}"
20: "${CPP:=cpp}"
21
22for d in ${dtso}; do
23    dtb="${dtbo_path}/$(basename "$d" .dtso).dtbo"
24    ${CPP} -P -x assembler-with-cpp -I "$S/contrib/device-tree/include" -I "$S/dts/${MACHINE}" -I "$S/contrib/device-tree/src/${MACHINE}" -include "$d" /dev/null |
25	${DTC} -@ -O dtb -o "$dtb" -i "$S/dts/${MACHINE}" -i "$S/contrib/device-tree/src/${MACHINE}"
26done
27