freebsd-dev/sys/tools/fdt/make_dtbo.sh
Emmanuel Vadot efdf807990 Switch to the new device-tree vendor tree
The old vendor tree was never fully merged and doing partial merge isn't
supported with git subtree merge so a new one was created.
Switch the build to use the new DTS from sys/contrib/device-tree
This also bump the DTS used to be in sync with Linux 5.9
While here change the way to get the linux version, simply hardcode
the value in sys/dts/freebsd-compatible.dts and use awk to get that
to put it in the CFLAGS.
As a bonus we now have the bindings docs available
in sys/contrib/device-tree/Bindings/ so no need to link to the Linux repo
or to the vendor tree.
2021-01-15 20:08:39 +01:00

29 lines
686 B
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
# Script generates dtbo file ($3) from dtso source ($2) in build tree S ($1)
S=$1
dtso="$2"
dtbo_path=$3
if [ -z "$dtso" ]; then
echo "No DTS overlays specified"
exit 1
fi
if [ -z "${MACHINE}" ]; then
MACHINE=$(uname -m)
fi
: "${DTC:=dtc}"
: "${ECHO:=echo}"
: "${CPP:=cpp}"
for d in ${dtso}; do
dtb="${dtbo_path}/$(basename "$d" .dtso).dtbo"
${ECHO} "converting $d -> $dtb"
${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 |
${DTC} -@ -O dtb -o "$dtb" -i "$S/dts/${MACHINE}" -i "$S/contrib/device-tree/src/${MACHINE}"
done