xref: /freebsd/sys/tools/fdt/make_dtbo.sh (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
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