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